sencore package
Submodules
sencore.entry module
sencore.kg_parser module
- class sencore.kg_parser.KGParser(lang: str, labels: list = [], rules: list = [])
Bases:
Parser
KGParser
is to detect knowledge graph from sentence. InheritParser
, implementsdigest
.- digest(sentence)
Parse sentence into kg with linguistic meta info
- Parameters:
sentence (str) – sentence to be parsed
- Returns:
Keys are keys of
kg
- Return type:
dict
- get_translator(to_lang)
- sencore.kg_parser.create_kg_parser(nlp: Language, name: str, labels: list, rules: list)
Register
KG
into pipeline with component namekg
sencore.lib module
- sencore.lib.explain(kg, translator)
- sencore.lib.extend_ranges(ranges, maxlen)
- sencore.lib.merge_ranges(ranges)
sencore.parser module
sencore.phrase_parser module
- class sencore.phrase_parser.PhraseParser(lang)
Bases:
Parser
PhraseParser
is to detect phrases from sentence. InheritParser
, implementsdigest
.- digest(sentence)
Parse sentence into phrases with linguistic meta info
- Parameters:
sentence (str) – sentence to be parsed
- Returns:
Keys are
noun_phrases
,verbs
, markers`- Return type:
dict
- sencore.phrase_parser.create_np_parser(nlp: Language, name: str)
Register
NounPhraseRecognizer
into pipeline with component namenprecog
- sencore.phrase_parser.create_vkb_parser(nlp: Language, name: str)
Register
VerbKnowledgeRecognizer
into pipeline with component namevkbrecog
sencore.structure_parser module
- class sencore.structure_parser.StructureParser(lang)
Bases:
Parser
StructureParser
is to detect structure from sentence. InheritParser
, implementsdigest
.- digest(sentence)
Parse sentence into structure with linguistic meta info
- Parameters:
sentence (str) – sentence to be parsed
- Returns:
Keys are in
start
,end
,text
,element
,is_root
,explanation
- Return type:
list[dict]
- sencore.structure_parser.create_structure_parser(nlp: Language, name: str)
Register
Structure
into pipeline with component namestructure
sencore.train module
sencore.vocab_parser module
- class sencore.vocab_parser.VocabParser(lang)
Bases:
Parser
VocabParser
is to detect vocabularies from sentence. InheritParser
, implementsdigest
.- digest(sentence)
Parse sentence into vocabularies with linguistic meta info
- Parameters:
sentence (str) – sentence to be parsed
- Returns:
element is a dict, with keys
word
andpos
- Return type:
list
Module contents
sencore
Package