Skip to content

kirillgashkov/phrase-seeker

main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

Phrase Seeker

Searches for phrases in texts regardless of their form and words between.

Features

  • Search for phrases in texts;
  • Set multiple phrases to search for;
  • Find phrases even if they aren't in normalized form;
  • Find phrases even if there are words between (e.g. adjectives);
  • Get the sentence where the phrase was found;
  • Get the location of the sentence in the text.

Requirements

  • Python 3.7.1

Installation

Manual

  1. Clone this repository

    $ git clone git@github.com:kirillgashkov/phrase-seeker.git
  2. Install required packages (see the requirements.txt)

    $ pip install -r phrase-seeker/requirements.txt
  3. Done.

Usage

Warning: 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).

# import `seek_phrases_in_text` function
from phrase_seeker import seek_phrases_in_text

# get the text to search in and the phrases to search for
text = 'Insert your awesome text here'
phrases = ['inserted text']

# pass them as arguments to the imported function
matches = seek_phrases_in_text(phrases, text)

# operate on the matches
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

Searches for phrases in texts regardless of their form and words between.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages