sencore package
Submodules
sencore.deeplapi module
sencore.entry module
sencore.kg_parser module
- class sencore.kg_parser.KGParser(lang: str, labels: list = [], rules: list = [])
Bases:
ParserKGParseris 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
KGinto 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_model_parser module
- class sencore.phrase_model_parser.PhraseModelParser(lang)
Bases:
ParserPhraseModelParseris to detect phrases from sentence. InheritParser, implementsdigest.- align_to_spacy(sentence, tags, tokens)
- digest(sentence)
Parse sentence into phrases with linguistic meta info
- Parameters:
sentence (str) – sentence to be parsed
- Returns:
keys are
textandstartandend.- Return type:
list(dict)
- merge_to_phrases(tags, sentence)
- predict_sentence(sentence)
- sencore.phrase_model_parser.align_back_to_tokens(word_ids, subtokens)
- sencore.phrase_model_parser.align_back_to_words(word_ids, labels)
sencore.phrase_parser module
- class sencore.phrase_parser.PhraseParser(lang)
Bases:
ParserPhraseParseris 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_phrasesandbuildin_np, which are of typelist[dict].- Return type:
dict
- sencore.phrase_parser.create_np_parser(nlp: Language, name: str)
Register
NounPhraseRecognizerinto pipeline with component namenprecog
sencore.structure_parser module
- class sencore.structure_parser.StructureParser(lang)
Bases:
ParserStructureParseris 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
start,end,text,element,is_root,semantic_depandexplanation.- Return type:
list[dict]
- sencore.structure_parser.create_structure_parser(nlp: Language, name: str)
Register
Structureinto pipeline with component namestructure
sencore.train module
sencore.vocab_parser module
- class sencore.vocab_parser.VocabParser(lang: str, poses: list = [])
Bases:
ParserVocabParseris 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:
keys are
word,pos, “lemma”, “start” and “end”.- Return type:
list[dict]
Module contents
sencore Package