from collect import crawler as cr from analysis import analizer as an from visualize import visualizer as vi import simplejson pagename = "TheHeraldBusiness" from_date = "2018-04-01" to_date = "2018-05-29" if __name__ == "__main__": #수집 postList = cr.fb_get_post_list(pagename, from_date, to_date) print(postList) #분석 dataString = an.json_to_str( "/Users/WOOSEUNGMI/Desktop/2018/javaStudy/facebook/TheHeraldBusiness.json", "message_str") # 파일경로+경로명, key값(dic의) count_data = an.count_wordfreq(dataString) print(count_data) #어떤 단어를 몇번 이용했는지 출력 #리스트를 딕셔너리 형태로 변경 dictWord = dict(count_data.most_common(20)) #단어 상위 몇개만 지정 #그래프 vi.show_graph_bar(dictWord, pagename) #폰트네임알아내기 # 워드크라우드 vi.wordcloud(dictWord, pagename)
from collect import crawler from analysis import analizer from visualize import visualizer pagename = "chosun" from_date = "2018-05-22" to_date = "2018-05-24" if __name__ == "__main__": # #수집 # postList = crawler.fb_get_post_list(pagename,from_date,to_date) # print(postList) #분석 dataString = analizer.json_to_str("D:/JavaStudy/imformation/chosun.json", "message_str") count_data = analizer.count_wordfreq(dataString) print(count_data) dictword = dict(count_data.most_common(20)) # 그래프 visualizer.show_graph_bar(dictword, pagename) # 워드클라우드 visualizer.wordcloud(dictword, pagename)
from visualize import visualizer pagename = "chosun" from_date = "2017-01-01" to_date = "2018-05-23" path = "D:/javaStudy/" f_ex = ".json" filename = path + pagename + f_ex if __name__ == "__main__": # 수집 # postList = crawler.fb_get_post_list(pagename, from_date, to_date) # print(postList) # 분석 dataString = analizer.json_to_str(filename, "message_str") count_data = analizer.count_wordfreq(dataString) # with open("d:/javaStudy/analysis_" + f_name + ".json", 'w', encoding='utf-8') as outfile: # json_string = json.dumps(count_data, indent=4, sort_keys=True, ensure_ascii=False) # outfile.write(json_string) print("카운트데이터 : ", count_data) dictWord1 = dict(count_data.most_common(20)) dictWord2 = dict(count_data.most_common(50)) # 그래프 visualizer.show_graph_bar(dictWord1, pagename) visualizer.wordcloud(dictWord2, pagename)