{"id":23715066,"url":"https://github.com/vi3k6i5/synonym-extractor","last_synced_at":"2026-03-08T01:32:22.746Z","repository":{"id":57472929,"uuid":"96009258","full_name":"vi3k6i5/synonym-extractor","owner":"vi3k6i5","description":"Extract synonyms, keywords from sentences using modified implementation of Aho Corasick algorithm","archived":false,"fork":false,"pushed_at":"2017-08-17T10:00:15.000Z","size":34,"stargazers_count":40,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-28T02:16:37.882Z","etag":null,"topics":["algorithm","datastructures","nlp","python","synonyms"],"latest_commit_sha":null,"homepage":"http://synonym-extractor.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vi3k6i5.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-02T07:40:52.000Z","updated_at":"2023-12-01T06:41:15.000Z","dependencies_parsed_at":"2022-09-26T17:40:45.394Z","dependency_job_id":null,"html_url":"https://github.com/vi3k6i5/synonym-extractor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vi3k6i5/synonym-extractor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi3k6i5%2Fsynonym-extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi3k6i5%2Fsynonym-extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi3k6i5%2Fsynonym-extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi3k6i5%2Fsynonym-extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vi3k6i5","download_url":"https://codeload.github.com/vi3k6i5/synonym-extractor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi3k6i5%2Fsynonym-extractor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30240897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"ssl_error","status_checked_at":"2026-03-08T00:55:48.608Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["algorithm","datastructures","nlp","python","synonyms"],"created_at":"2024-12-30T20:52:45.163Z","updated_at":"2026-03-08T01:32:22.720Z","avatar_url":"https://github.com/vi3k6i5.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"This project has moved to `Flash Text \u003chttps://github.com/vi3k6i5/flashtext\u003e`_. \n-----------------------------------------\n\nsynonym-extractor\n=================\n\nSynonym Extractor is a python library that is loosely based on `Aho-Corasick algorithm\n\u003chttps://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm\u003e`_.\n\nThe idea is to extract words that we care about from a given sentence in one pass.\n\nBasically say I have a vocabulary of 10K words and I want to get all the words from that set present in a sentence. A simple regex match will take a lot of time to loop over the 10K documents.\n\nHence we use a simpler yet much faster algorithm to get the desired result.\n\nInstallation\n-------\n::\n\n    pip install synonym-extractor\n\nUsage\n------\n::\n    \n    # import module\n    from synonym.extractor import SynonymExtractor\n\n    # Create an object of SynonymExtractor\n    synonym_extractor = SynonymExtractor()\n\n    # add synonyms\n    synonym_names = ['NY', 'new-york', 'SF']\n    clean_names = ['new york', 'new york', 'san francisco']\n\n    for synonym_name, clean_name in zip(synonym_names, clean_names):\n        synonym_extractor.add_to_synonym(synonym_name, clean_name)\n\n    synonyms_found = synonym_extractor.get_synonyms_from_sentence('I love SF and NY. new-york is the best.')\n\n    synonyms_found\n    \u003e\u003e ['san francisco', 'new york', 'new york']\n\n\nAlgorithm\n----------\n\nsynonym-extractor is based on `Aho-Corasick algorithm\n\u003chttps://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm\u003e`_.\n\nDocumentation\n----------\n\nDocumentation can be found at `Read the Docs\n\u003chttp://synonym-extractor.readthedocs.org\u003e`_.\n\n\nWhy\n------\n\n::\n\nSay you have a corpus where similar words appear frequently.\n\neg: Last weekened I was in NY.\n    I am traveling to new york next weekend.\n\nIf you train a word2vec model on this or do any sort of NLP it will treat NY and new york as 2 different words. \n\nInstead if you create a synonym dictionary like:\n\neg: NY=\u003enew york\n    new york=\u003enew york\n\nThen you can extract NY and new york as the same text.\n\nTo do the same with regex it will take a lot of time:\n\n============  ========== = =========  ============\nDocs count    # Synonyms : Regex      synonym-extractor\n============  ========== = =========  ============\n1.5 million   2K         : 16 hours   NA\n2.5 million   10K        : 15 days    15 mins\n============  ========== = =========  ============\n\nThe idea for this library came from the following `StackOverflow question\n\u003chttps://stackoverflow.com/questions/44178449/regex-replace-is-taking-time-for-millions-of-documents-how-to-make-it-faster\u003e`_.\n\n\nLicense\n-------\n\nThe project is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvi3k6i5%2Fsynonym-extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvi3k6i5%2Fsynonym-extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvi3k6i5%2Fsynonym-extractor/lists"}