Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
GroupD3/SentenceSplitter.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
47 lines (41 sloc)
1.24 KB
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
#Not used | |
#Made by Andris Jansons | |
def sentenceSplitter(text): | |
text = text.lower().split(" ") | |
temp = "" | |
"""Notice how lists are in plural""" | |
Questions = "who, what, why, when, where, how, can, know".split(", ") | |
Persons = ["i","me","you","i'm","im"] | |
Emotions = "love, hate, like".split(", ") | |
Wants = "want, wanting, need, needing, crave, craving, have, having, tell, telling, show, showing, find, finding".split(", ") | |
Skips = "myself, a, an, some, any".split(", ") | |
Object = "burger, pizza, sushi".split(", ") | |
Question = "" | |
Person = "" | |
Emotion = "" | |
Want = "" | |
Object = "" | |
"""If the word is in the list, we'll return it in a right category""" | |
for word in text: | |
if word in Questions: | |
Question = word | |
elif word in Persons: | |
Person = word | |
elif word in Emotions: | |
Emotion = word | |
if text[text.index(word)+1] in Skips: | |
temp = text[text.index(word)+2] | |
else: | |
temp = text[text.index(word)+1] | |
elif word in Wants: | |
Want = word | |
if text[text.index(word)+1] in Skips: | |
temp = text[text.index(word)+2] | |
else: | |
temp = text[text.index(word)+1] | |
elif word in Object: | |
Object = word | |
if Object == "": | |
Object = temp | |
return Question, Person, Emotion, Want, Object | |
print(sentenceSplitter("you know any good places to eat")) | |