This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def LemNormalize(text): | |
remove_punct_dict = dict((ord(punct), None) for punct in string.punctuation) | |
#fungsi ini meremove punct yang ada di dict dan menghilangkan huruf kapital | |
return [token for token in nltk.word_tokenize(text.lower().translate(remove_punct_dict))] | |
def response(user_response): | |
ruka_response='' | |
sent_tokens.append(user_response) #Ini ngeappend input user ke list yang dibuat dari chatbot.txt | |
if 'apa itu fasilkom' in user_response or 'fasilkom adalah' in user_response or 'fasilkom' in user_response: | |
ruka_response = ruka_response+sent_tokens[0] |