{"id":15887918,"url":"https://github.com/iwpnd/flashgeotext","last_synced_at":"2025-04-05T07:02:25.087Z","repository":{"id":36956253,"uuid":"224007946","full_name":"iwpnd/flashgeotext","owner":"iwpnd","description":"Extract city and country mentions from Text like GeoText without regex, but FlashText, a Aho-Corasick implementation.","archived":false,"fork":false,"pushed_at":"2025-03-25T14:34:47.000Z","size":5887,"stargazers_count":62,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T06:01:42.031Z","etag":null,"topics":["flashtext","geotext","named-entity-extraction","python","search","search-in-text"],"latest_commit_sha":null,"homepage":"","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/iwpnd.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-25T17:47:02.000Z","updated_at":"2025-03-25T14:34:44.000Z","dependencies_parsed_at":"2023-10-02T15:23:34.954Z","dependency_job_id":"f0e7bd56-7282-4f0c-83de-ae944ec9dc95","html_url":"https://github.com/iwpnd/flashgeotext","commit_stats":{"total_commits":432,"total_committers":6,"mean_commits":72.0,"dds":"0.42592592592592593","last_synced_commit":"53d8ef2680ee807c7b3cbd518cd46afb25d15aca"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Fflashgeotext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Fflashgeotext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Fflashgeotext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Fflashgeotext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iwpnd","download_url":"https://codeload.github.com/iwpnd/flashgeotext/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299829,"owners_count":20916190,"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":["flashtext","geotext","named-entity-extraction","python","search","search-in-text"],"created_at":"2024-10-06T06:05:41.972Z","updated_at":"2025-04-05T07:02:25.066Z","avatar_url":"https://github.com/iwpnd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/iwpnd/flashgeotext/actions\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/iwpnd/flashgeotext/workflows/CI/badge.svg?branch=master\" alt=\"Build Status\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/iwpnd/flashgeotext\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/iwpnd/flashgeotext/branch/master/graph/badge.svg\" alt=\"Coverage\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n# flashgeotext :zap::earth_africa:\n\nExtract and count countries and cities (+their synonyms) from text, like [GeoText](https://github.com/elyase/geotext) on steroids using [FlashText](https://github.com/vi3k6i5/flashtext/), a Aho-Corasick implementation. Flashgeotext is a fast, batteries-included (and BYOD) and native python library that extracts one or more sets of given city and country names (+ synonyms) from an input text.\n\n**introductory blogpost**: [https://iwpnd.github.io/articles/2020-02/flashgeotext-library](https://iwpnd.pw/articles/2020-02/flashgeotext-library)\n\n## Usage\n\n```python\nfrom flashgeotext.geotext import GeoText\n\ngeotext = GeoText()\n\ninput_text = '''Shanghai. The Chinese Ministry of Finance in Shanghai said that China plans\n                to cut tariffs on $75 billion worth of goods that the country\n                imports from the US. Washington welcomes the decision.'''\n\ngeotext.extract(input_text=input_text)\n\u003e\u003e {\n    'cities': {\n        'Shanghai': {\n            'count': 2,\n            'span_info': [(0, 8), (45, 53)],\n            'found_as': ['Shanghai', 'Shanghai'],\n            },\n        'Washington, D.C.': {\n            'count': 1,\n            'span_info': [(175, 185)],\n            'found_as': ['Washington'],\n            }\n        },\n    'countries': {\n        'China': {\n            'count': 1,\n            'span_info': [(64, 69)],\n            'found_as': ['China'],\n            },\n        'United States': {\n            'count': 1,\n            'span_info': [(171, 173)],\n            'found_as': ['US'],\n            }\n        }\n    }\n```\n\n## Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes.\n\n### Installing\n\npip:\n\n```bash\npip install flashgeotext\n```\n\nconda:\n\n```bash\nconda install flashgeotext\n```\n\nfor development:\n\n```bash\ngit clone https://github.com/iwpnd/flashgeotext.git\ncd flashgeotext/\npoetry install\n```\n\n### Running the tests\n\n```bash\npoetry run pytest . -v\n```\n\n## Authors\n\n- **Benjamin Ramser** - _Initial work_ - [iwpnd](https://github.com/iwpnd)\n\nSee also the list of [contributors](https://github.com/iwpnd/flashgeotext/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\nDemo Data cities from [http://www.geonames.org](http://www.geonames.org) licensed under the Creative Commons Attribution 3.0 License.\n\n## Acknowledgments\n\n- Hat tip to [@vi3k6i5](https://github.com/vi3k6i5) for his [paper](https://arxiv.org/abs/1711.00046) and implementation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwpnd%2Fflashgeotext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiwpnd%2Fflashgeotext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwpnd%2Fflashgeotext/lists"}