phrase_detective package

Subpackages

Submodules

phrase_detective.constants module

Constants used in package

phrase_detective.constants.PKG_INDICES

Key is language abbreviation, such as en, es. Value is the name of pre-trained package

Type:

dict

phrase_detective.lib module

phrase_detective.lib.merge(ranges)

Merge a list of tuples, which have two elements respectively

Parameters:

ranges (list) – [(start1, end1), (start2, end2), …]

Returns:

merged tuples

Return type:

list

Examples

>>> merge([(1, 4),(3, 6), (4, 7), (9, 12)])
[(1, 7), (9, 12)]
phrase_detective.lib.merge_range(first, second)

Merge two tuples, which have two elements respectively

Parameters:
  • first (tuple) – (start, end)

  • second (tuple) – (start, end)

Returns:

merged tuples

Return type:

list

Examples

>>> merge_range((1, 3), (4, 8))
[(1, 3), (4, 8)]
>>> merge_range((1, 3), (3, 8))
[(1, 3), (3, 8)]
>>> merge_range((1, 3), (2, 8))
[(1, 8)]

phrase_detective.noun_phrases module

class phrase_detective.noun_phrases.NounPhraseRecognizer(nlp: Language)

Bases: object

Customerized component to detect noun phrases in spacy.tokens.Doc object. The NP values are stored in doc._.noun_phrases,

ext_name

customized extension field name

Type:

str

phrase_detective.verb_knowledge module

class phrase_detective.verb_knowledge.VerbKnowledgeRecognizer(nlp: Language)

Bases: object

Customerized component to detect verb knowledge in spacy.tokens.Doc object. The corresponding values are stored in doc._.verbs.

ext_name

customized extension field name

Type:

str

matcher

Rule maker for detecting VERB

Type:

spacy.mathcer.Matcher

Module contents

phrase_detective Package

Components for spacy pipeline, to detect noun phrase, prep phrase, verb related knowledge