MCPcopy
hub / github.com/HIT-SCIR/ltp / main

Function main

python/interface/ltp/legacy.py:113–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111
112
113def main():
114 ltp = LTP.from_pretrained("models/legacy")
115 ltp.add_word("姆去拿", 2)
116 words, pos, ner = ltp.pipeline("他叫汤姆去拿外衣。").to_tuple()
117 print(words, pos, ner)
118 pos, ner = ltp.pipeline(words, tasks=["pos", "ner"]).to_tuple()
119 print(pos, ner)
120 (ner,) = ltp.pipeline(words, pos, tasks=["ner"]).to_tuple()
121 print(ner)
122
123 words, pos, ner = ltp.pipeline(["他叫汤姆去拿外衣。", "台湾是中国领土不可分割的一部分。"]).to_tuple()
124 print(words, pos, ner)
125 pos, ner = ltp.pipeline(words, tasks=["pos", "ner"]).to_tuple()
126 print(pos, ner)
127 (ner,) = ltp.pipeline(words, pos, tasks=["ner"]).to_tuple()
128 print(ner)
129
130
131if __name__ == "__main__":

Callers 1

legacy.pyFile · 0.70

Calls 4

from_pretrainedMethod · 0.80
to_tupleMethod · 0.80
add_wordMethod · 0.45
pipelineMethod · 0.45

Tested by

no test coverage detected