forked from bautzon/NLP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
46 lines (42 loc) · 1.21 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from sympy import source
import spacy
from nltk import Tree
from Scraper import *
from Cleaner import *
from Stemmer import *
from Counter import *
def choose_method():
print("""
Welcome - Choose an option
1) Scrape from link
2) Scrape from subreddit
3) Scrape from twitter hashtag
4) Print data
5) Quit
6) Save to file
7) print tree
""")
quit=False
while quit == False:
userinput=input("Write choice ")
if userinput=="1":
determine_link()
elif userinput=="2":
subredditinput=input("Write a subreddit name ")
scrape_subrreddit("https://www.reddit.com/r/"+subredditinput+".json?limit=10")
elif userinput=="3":
twitterinput=input("Write a topic to search twitter ")
scrape_twitter(twitterinput)
elif userinput=="4":
print_cleaned_data(data)
elif userinput=="5":
quit=True
elif userinput=="6":
save_to_txt()
elif userinput=="7":
make_tree()
else:
print("Unable to understand")
choose_method() #scraper
cleaned_text_list=cleaner(data['title'])[0]
cleaned_text_string=cleaner(data['title'])[1]