Skip to content

Commit

Permalink
intents working
Browse files Browse the repository at this point in the history
  • Loading branch information
Kraus Julia 8SP3 committed Feb 26, 2018
1 parent 03ab0de commit 0ab5285
Show file tree
Hide file tree
Showing 16 changed files with 363 additions and 424 deletions.
47 changes: 47 additions & 0 deletions .ipynb_checkpoints/bag_of_words-checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import intents

def create_training_data(intents):

training_features = build_bag_of_word(intents)
training_labels = get_labels(intents)

training_data = list(zip(training_features, training_labels))

random.shuffle(training)

training_x, training_y = zip(*training_data)

return train_x, train_y


def bag_of_words(intents):
"""return a bag of words for each sentence"""
for doc in intents.documents:
bag = []
words = get_words_from_document(doc)
words = stem_words(words)

# create our bag of words array
for w in intents.lexicon:
bag.append(1) if w in words else bag.append(0)

output_row[classes.index(doc[1])] = 1
training_data.append([bag, output_row])

def get_labels(intents):
for doc in intents.documents:
label = [classes.index(doc[1])] = 1


def get_words_from_document(doc):
return doc[0]

def stem_words(words):
return [stemmer.stem(word.lower()) for word in words]

def create_training_feature():
pass

def create_training_label():
pass

49 changes: 0 additions & 49 deletions .ipynb_checkpoints/chatbot-checkpoint.py

This file was deleted.

Loading

0 comments on commit 0ab5285

Please sign in to comment.