Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Search texts for phrases regardless of their forms and words in-between.

License

Notifications You must be signed in to change notification settings

kirillgashkov/phrase-seeker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phrase Seeker

Search texts for phrases regardless of their forms and words in-between.

Features

  • Search texts for phrases.
  • Search for multiple pharses at once.
  • Find phrases even if they weren't in their normalized forms.
  • Find phrases even if there had extra words in-between (e.g. adjectives).
  • Get sentence where the phrase was found.
  • Get location of the sentence in the text.

Requirements

  • Python 3.7

Installation

$ git clone git@github.com:kirillgashkov/phrase-seeker.git
$ cd phrase-seeker
$ pip install -r requirements.txt

Usage

Note: by default seeking function won't leave cache after itself. You can change this behavior by passing should_delete_cache=False as an additional argument to the function. However, if the phrases are changed, you must delete the cache before using the function again (call phrase_seeker.delete_cache() to do so).

from phrase_seeker import seek_phrases_in_text

text = "Insert your awesome text here"
phrases = ["inserted text"]

matches = seek_phrases_in_text(phrases, text)

for match in matches:
    print(match.phrase.text)
    print(match.sentence.start, match.sentence.end, '-', match.sentence.text)

License

Distributed under the MIT License. See the LICENSE.md for details.

Acknowledgments

About

Search texts for phrases regardless of their forms and words in-between.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages