自动生成聊天机器人程序的包
AutoChatbot的Python项目详细描述
汽车机器人
作者-
- 克里蒂克·赛斯
对于文档-向下滚动或click here
干净
def make_train_数据集(行、转换行):
takes input of lines and conversations, returns a list of questions and answers
:type lines: string
:param lines: path were text file of lines is present
:type conv_lines: string
:param conv_lines: path were text file of conversations is present
def clean_train_数据集(文本):
^{pr2}$def make_count_dict(q,a):
makes a dictionary of words
:type q: list
:param q: list of questions
:type a: list
:param a: list of answers
def count个稀有单词(cd,mincount):
counts the number of rare words
:type cd: dictionary
:param cd: count dictionary {word:key}
:type mincount: int
:param mincount: minimum length of a question
def make_word_dict(cd,mincount,tokens={''':0,':1,':2,':3}):
makes dictionary, returns mapping of word to key and key to word
:type cd: dictionary
:param cd: count dictionary {word:key}
:type mincount: int
:param mincount: min frequency of word such that it makes it into the word_dict
:type tokens: dictionary
:param tokens: default - {'<PAD>':0, '<SOS>':1, '<EOS>':2, '<UNK>':3}
def add_word_标记(q,a,wd):
takes input of {word:key} and adds tags to those words
:type q: list
:param q: list of questions
:type a: list
:param a: list of answers
:type wd: dict
:param wd: mapping of word to key
def make\u line_id(q,a,wd):
takes input list of questions or answers and word_dict and returns text converted to id
:type q: list
:param q: list of questions
:type a: list
:param a: list of answers
:type wd: dict
:param wd: mapping of word to key
def sort_line_pad(q,a,max_line_长度):
sorts questions and answers based on their length, returns sorted list of question or answer
:type q: list
:param q: list of questions
:type a: list
:param a: list of answers
:type max_line_length: int
:param max_line_length: maximum length of question or answer
聊天
def make_test_chatbot(目录路径,文件列表,ntest):
takes input of direcotory of file, list, and number of test cases
:type lines: string
:param lines: path were text file of lines is present
:type conv_lines: string
:param conv_lines: path were text file of lines is present
:type conv_lines: string
:param conv_lines: base path were text file of lines is present
- 项目
标签: