自动生成聊天机器人程序的包

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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JNI和取消异步任务   java整数n作为List<String>的第二个参数传递。子列表(fromIndex,toIndex),但是stacktrace说toIndex在Kotlin中是n+2   如何在Java中正确嵌套多个ArrayList/Maps?   在嵌套条件语句中比较数组中的值时,java List没有打印正确的值   从CRON作业运行java代码   JRE使用jvisualvm检测到java致命错误   java将字符添加到BufferedReader中   带有枚举的java单例与带有双重检查锁定的单例   Java中的编译器构造基类的更改会影响子类的字节码吗?   Java作为Windows服务用户数据路径   java clone():ArrayList。克隆人()我认为它是一个肤浅的复制品   在jfilechooser多文件选择器启用中打开对话框后,java文件将显示所选文件   java在常用的操作方法中使用反射可以吗?   java ReloadableResourceBundleMessageSource。getMessage()不使用我给它的参数