You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_fastNLP.py 557 B

1234567891011121314151617181920212223
  1. from fastNLP.fastnlp import FastNLP
  2. def word_seg():
  3. nlp = FastNLP("./data_for_tests/")
  4. nlp.load("seq_label_model")
  5. text = "这是最好的基于深度学习的中文分词系统。"
  6. result = nlp.run(text)
  7. print(result)
  8. print("FastNLP finished!")
  9. def text_class():
  10. nlp = FastNLP("./data_for_tests/")
  11. nlp.load("text_class_model")
  12. text = "这是最好的基于深度学习的中文分词系统。"
  13. result = nlp.run(text)
  14. print(result)
  15. print("FastNLP finished!")
  16. if __name__ == "__main__":
  17. text_class()

一款轻量级的自然语言处理(NLP)工具包,目标是减少用户项目中的工程型代码,例如数据处理循环、训练循环、多卡运行等