diff --git a/parse.py b/parse.py new file mode 100644 index 0000000..d44eb98 --- /dev/null +++ b/parse.py @@ -0,0 +1,15 @@ +import nltk + +def get_parts(text): + text = nltk.word_tokenize(text) + parts = nltk.pos_tag(text) + dic = {} + for work, part in parts: + if part in dic: + dic[part].append(work) + else: + dic[part] = [work] + return dic + +get_parts("hi how are you") +