Skip to main content

Extract/Replaces keywords in sentences.

Project description

Documentation Status license

Installation

$ pip install flashtext

Usage

Simple example
>>> from flashtext.keyword import KeywordProcessor
>>> keyword_processor = KeywordProcessor()
>>> keyword_processor.add_keyword('Big Apple', 'New York')
>>> keyword_processor.add_keyword('Bay Area')
>>> keywords_found = keyword_processor.extract_keywords('I love Big Apple and Bay Area.')
>>> keywords_found
>>> ['New York', 'Bay Area']
Case Sensitive example
>>> from flashtext.keyword import KeywordProcessor
>>> keyword_processor = KeywordProcessor(case_sensitive=True)
>>> keyword_processor.add_keyword('Big Apple', 'New York')
>>> keyword_processor.add_keyword('Bay Area')
>>> keywords_found = keyword_processor.extract_keywords('I love big Apple and Bay Area.')
>>> keywords_found
>>> ['Bay Area']
No clean name for Keywords
>>> from flashtext.keyword import KeywordProcessor
>>> keyword_processor = KeywordProcessor()
>>> keyword_processor.add_keyword('Big Apple')
>>> keyword_processor.add_keyword('Bay Area')
>>> keywords_found = keyword_processor.extract_keywords('I love big Apple and Bay Area.')
>>> keywords_found
>>> ['Big Apple', 'Bay Area']

API doc

Documentation can be found at FlashText Read the Docs.

Contribute

License

The project is licensed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flashtext-1.2.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file flashtext-1.2.tar.gz.

File metadata

  • Download URL: flashtext-1.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for flashtext-1.2.tar.gz
Algorithm Hash digest
SHA256 7594808c5a1b8f12bbe71788c1dfa39483d0fdd69b707eca94c13f9ae727dce6
MD5 a0d7718b3aa64385694cf0c9c663ef0f
BLAKE2b-256 b3db67d04dd3a096f9eec13812cf71f4bbf3edc2f30e5558cd92f90303202b18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page