{"id":18006895,"url":"https://github.com/kavgan/phrase-at-scale","last_synced_at":"2025-03-26T12:31:03.746Z","repository":{"id":48523972,"uuid":"130308478","full_name":"kavgan/phrase-at-scale","owner":"kavgan","description":"Detect common phrases in large amounts of text using a data-driven approach. Size of discovered phrases can be arbitrary. Can be used in languages other than English","archived":false,"fork":false,"pushed_at":"2019-07-15T05:04:59.000Z","size":84530,"stargazers_count":128,"open_issues_count":2,"forks_count":45,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-21T18:22:24.768Z","etag":null,"topics":["collocation-extraction","multiword-expressions","multiword-extraction","natural-language-processing","nlp","nlp-machine-learning","phrase-discovery","phrase-extraction","pyspark","spark"],"latest_commit_sha":null,"homepage":"http://kavita-ganesan.com/how-to-incorporate-phrases-into-word2vec-a-text-mining-approach/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kavgan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-20T04:23:02.000Z","updated_at":"2025-02-27T13:49:22.000Z","dependencies_parsed_at":"2022-08-31T18:31:16.195Z","dependency_job_id":null,"html_url":"https://github.com/kavgan/phrase-at-scale","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavgan%2Fphrase-at-scale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavgan%2Fphrase-at-scale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavgan%2Fphrase-at-scale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavgan%2Fphrase-at-scale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kavgan","download_url":"https://codeload.github.com/kavgan/phrase-at-scale/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245653908,"owners_count":20650771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collocation-extraction","multiword-expressions","multiword-extraction","natural-language-processing","nlp","nlp-machine-learning","phrase-discovery","phrase-extraction","pyspark","spark"],"created_at":"2024-10-30T01:10:52.214Z","updated_at":"2025-03-26T12:30:59.363Z","avatar_url":"https://github.com/kavgan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phrase-At-Scale\n\n`Phrase-At-Scale` provides a fast and easy way to discover phrases from large text corpora using PySpark. Here's an example of phrases extracted from a review dataset:\n\n\u003cdiv align=\"center\" width=\"100%\"\u003e\n\u003cimg src=\"phrase-at-scale.png\" width=\"50%\"\u003e\n\u003c/div\u003e\n\n## Features\n- Discover most common phrases in your text\n- Size of discovered phrases can be arbitrary (typically: bigrams and trigrams)\n- Adjust configuration to control quality of phrases\n- Can be used in languages other than English \n- Can be run locally using multiple threads, or in parallel on multiple machines\n- Annotate your corpora with the phrases discovered\n\n## Quick Start\n\n## Run locally\nTo re-run phrase discovery using the default dataset:\n1. Install [Spark](https://spark.apache.org/downloads.html) \n2. Clone this repo and move into its top-level directory.\n\n\t```\n\tgit clone git@github.com:kavgan/phrase-at-scale.git\n\t```\n3. Run the spark job: \n\t```\n\t\u003cyour_path_to_spark\u003e/bin/spark-submit --master local[200] --driver-memory 4G phrase_generator.py \n\t``` \n  This will use settings (including input data files) as specified in `config.py`.\n\n4. You should be able to monitor the progress of your job at [http://localhost:4040/](http://localhost:4040/)\n\n**Notes:**\n\n- The above command runs the job on master and uses the specified number of threads within `local[num_of_threads]`.\n- This job outputs 2 files: \n\t1. the list of phrases under `top-opinrank-phrases.txt` \n\t1. the annotated corpora under `data/tagged-data/` \n\n\n\n\n## Configuration\nTo change configuration, just edit the [config.py](config.py) file.\n\n| Config  |  Description |\n|---|---|\n|`input_file`   |Path to your input data files. This can be a file or folder with files. The default assumption is one text document (of any size) per line. This can be one sentence per line, one paragraph per line, etc. |\n| `output-folder`  | Path to output your annotated corpora. Can be local path or on HDFS   |\n| `phrase-file`  |Path to file that should hold the list of discovered phrases.    |\n| `stop-file`  | Stop-words file to use to indicate phrase boundary.   |\n| `min-phrase-count`  | Minimum number of occurrence for phrases. Guidelines: use 50 for \u003c 300 MB of text, 100 for \u003c 2GB and larger values for a much larger dataset.  |\n\n\n## Dataset\n\nThe default configuration uses a subset of the [OpinRank](http://kavita-ganesan.com/entity-ranking-data/#.WtrU49Pwads) dataset, consisting of about 255,000 hotel reviews. You can use the following to cite the dataset:\n\n```\n@article{ganesan2012opinion,\n  title={Opinion-based entity ranking},\n  author={Ganesan, Kavita and Zhai, ChengXiang},\n  journal={Information retrieval},\n  volume={15},\n  number={2},\n  pages={116--150},\n  year={2012},\n  publisher={Springer} \n}\n```\n\n## Contact\nThis repository is maintained by [Kavita Ganesan](https://kavita-ganesan.com). Please send me an e-mail or open a GitHub issue if you have questions. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavgan%2Fphrase-at-scale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkavgan%2Fphrase-at-scale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavgan%2Fphrase-at-scale/lists"}