demo.py 1.1 KB

123456789101112131415161718192021222324252627
  1. # -*- coding: utf-8 -*-
  2. """
  3. @author:XuMing(xuming624@qq.com)
  4. @description:
  5. """
  6. import sys
  7. sys.path.append("../..")
  8. from pycorrector.gpt.gpt_corrector import GptCorrector
  9. if __name__ == '__main__':
  10. error_sentences = [
  11. '少先队员因该为老人让坐',
  12. '真麻烦你了。希望你们好好的跳无',
  13. '机七学习是人工智能领遇最能体现智能的一个分知',
  14. '一只小鱼船浮在平净的河面上',
  15. '我的家乡是有明的渔米之乡',
  16. '目击者称,以军已把封锁路障除去,不过备关卡检查站仍有坦克派驻,车辆已能来往通过,只是流量很漫。',
  17. '行政相对人对行政机关作出的行政处罚决定不服,不能申请行政服役的是何种行政行为?',
  18. '“明德慎罚”是殷商初期“天命”、“天罚”思想的继承和发扬',
  19. ]
  20. m = GptCorrector("shibing624/chinese-text-correction-1.5b")
  21. batch_res = m.correct_batch(error_sentences, system_prompt="你是一个中文文本纠错助手。请根据用户提供的原始文本,生成纠正后的文本。")
  22. for i in batch_res:
  23. print(i)
  24. print()