manager.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # coding:utf-8
  2. def answers_writing(question: str) -> str:
  3. """
  4. 问答
  5. :param question: 输入文本
  6. :return:
  7. """
  8. input_text = f"问答:\n问题:{question}\n答案:"
  9. return input_text
  10. def dialogue(context: str, question: str) -> str:
  11. """
  12. 对话
  13. :param context:
  14. :param question:
  15. :return:
  16. """
  17. input_text = context + "\n用户:" + question + "\n剑鱼:"
  18. return input_text
  19. def create_context(context: str, question: str, answer: str) -> str:
  20. """
  21. 生成上下文
  22. :param context: 上文
  23. :param question: 问题
  24. :param answer: 回答
  25. :return:
  26. """
  27. context = context + "\n用户:" + question + "\n剑鱼:" + answer
  28. return context
  29. def title_words_article(title: str, words: str) -> str:
  30. """
  31. 标题、关键词生文章
  32. :param title:
  33. :param words:
  34. :return:
  35. """
  36. input_text = f"根据标题和关键词生成文章:\n标题:{title};关键词:{words}\n答案:"
  37. return input_text
  38. def title_article(title: str) -> str:
  39. """
  40. 标题生文章
  41. :param title:
  42. :return:
  43. """
  44. input_text = f"根据标题生成文章:\n标题:{title}\n答案:"
  45. return input_text
  46. def copy_writing(title: str, question: str) -> str:
  47. """
  48. 营销文案生成
  49. :param title:
  50. :param question:
  51. :return:
  52. """
  53. input_text = f"营销文案生成:\n标题:{title}\n{question}\n答案:"
  54. return input_text
  55. def info_extract(title: str, question: str) -> str:
  56. """
  57. 通用信息抽取
  58. :param title:
  59. :param question:
  60. :return:
  61. """
  62. input_text = f"信息抽取:\n{title}\n问题:{question}\n答案:"
  63. return input_text
  64. def extract_words(title: str) -> str:
  65. """
  66. 关键词抽取
  67. :param title: 文章
  68. :return:
  69. """
  70. input_text = f"抽取关键词:\n{title}\n关键词:"
  71. return input_text
  72. def reading(title: str, question: str) -> str:
  73. """
  74. 阅读理解
  75. :param title:
  76. :param question:
  77. :return:
  78. """
  79. input_text = f"阅读理解:\n段落:{title}\n问题:{question}\n答案:"
  80. return input_text
  81. def classify(title: str, question: str) -> str:
  82. """
  83. 文本分类
  84. :param title:
  85. :param question:
  86. :return:
  87. """
  88. input_text = f"文本分类:\n{title}\n选项:{question}\n答案:"
  89. return input_text