Beispiel #1
0
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)
Beispiel #2
0
from collect import crawler
from analysis import analizer
from visualize import visualizer

pagename = "jtbcnews"
from_date = "2018-05-01"
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:/fb/jtbcnews.json", 'comments_str')
    count_data = analizer.count_wordfreq(dataString)
    print(count_data.most_common(20))  # most_common(20) 상위 20위까지만 표시하게끔 해줌

    # dictWords = dict(count_data.most_common(20))
    # visualizer.show_graph_bar(dictWords, pagename)

    dictWords = dict(count_data.most_common(20))
    visualizer.wordcloud(dictWords, pagename)
Beispiel #3
0
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)