예제 #1
0
    #postags = nlp.postag(words)
    #print('postags', postags)
    #ners = nlp.ner(text)
    #print('ners', ners)
    deps = nlp.dep(words, tags)
    print("=" * 100)
    for x in deps:
        print(x)
    #print('deps', deps)
    return deps


#string1 =  "锁定期大于3天、收益率大于5%的产品"
string2 = "锁定期和理财期限小于30天"
r = getParse2(string2)
parser = nn_parser.load_model(name='zh')
#r1 = getParse(string,parser)
#r2 = getParse(string1,parser)
r3 = getParse(string2, parser)

#支持的类型
#万份收益大于1.3或锁定期大于3天的产品
#万份收益大于1.3和锁定期大于3天的产品
#锁定期大于1.3 收益率大于3天的产品
#锁定期大于1.3,收益率大于3天的产品

#不支持的类型(分析错误)
#万份收益大于1.3、锁定期大于3天的产品
#万份收益大于1.3,锁定期大于3天的产品
#万份收益大于1.3 锁定期大于3天的产品
#锁定期大于1.3、收益率大于3天的产品
예제 #2
0
try:
    pos_tagger.load_model("zh_finance")
except Exception as e:
    print (e)

from deepnlp import ner_tagger
try:
    deepnlp.download("ner", "zh_finance")
except Exception as e:
    print (e)

deepnlp.register_model("ner", "zh_finance")
deepnlp.download("ner", "zh_finance")
try:
    ner_tagger.load_model("zh_finance")
except Exception as e:
    print (e)

from deepnlp import nn_parser
try:
    deepnlp.download("parse", "zh_finance")
except Exception as e:
    print (e)

deepnlp.register_model("parse", "zh_finance")
deepnlp.download("parse", "zh_finance")
try:
    nn_parser.load_model("zh_finance")
except Exception as e:
    print (e)