Skip to content

17zuoye/phrase_recognizer

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

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

Phrase Recognizer

Build Status Coverage Status Health Download License

Example

>>> from phrase_recognizer import PhrasalRecognizer
>>> recognizer = PhrasalRecognizer([ u"a lot of", u"tie...to...", u"or...or...a...a"])
>>> recognizer
[first_strs_dict] {u'a': True, u'tie': True, u'or': True}


[tree] {u'a': {u'lot': {u'of': {u'a lot of': True}}}, u'tie': {u'...': {u'to': {u'...': {u'tie...to...': True}}}}, u'or': {u'...': {u'or': {u'...': {u'a': {u'...': {u'a': {u'or...or...a...a': True}}}}}}}}
>>> recognizer.process(u"There are a lot of signs the grass.", replace=True)
[u'There are signs the grass.', [u'a lot of']]
>>> recognizer.process(u"To fasten or secure with or as if with a cord, rope, or strap: tied the kite to a post; tie up a bundle.")
[u'To fasten or secure with or as if with a cord, rope, or strap: tied the kite to a post; tie up a bundle.', [u'or...or...a...a', u'tie...to...']]

License

MIT. David Chen @ 17zuoye.

About

Phrase Recognizer。英文短语识别。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages