Skip to main content

Package that makes chatbots automatically

Project description

AutoChatBot

Authors-

  • Kritik Seth

For documentation- either scroll down or click here

clean

def make_train_dataset(lines, conv_lines):

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_dataset(text):

takes input list of questiond or answers, returns clean list of strings

:type text: text
:param text: list of strings

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_rare_words(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_tags(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_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_length):

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

chat

def make_test_chatbot(dir_path, files_list, 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AutoChatbot-0.1.1.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

AutoChatbot-0.1.1-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page