lac_demo.py 463 字节
Newer Older
Z
Zeyu Chen 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import os
import paddlehub as hub

if __name__ == "__main__":
    # Load LAC Module
    lac = hub.Module(name="lac")
    test_text = ["今天是个好日子", "天气预报说今天要下雨", "下一班地铁马上就要到了"]

    # Set input dict
    inputs = {"text": test_text}

    # execute predict and print the result
    results = lac.lexical_analysis(data=inputs)
    for result in results:
        print(result['word'])
        print(result['tag'])