Ejemplo n.º 1
0
    def getdataready(self,filename):
        service = self.service
        this = self.entity
        data = service.openfile_as_soup(filename)

        prepro_file = 'word2vec.prepro'
        this = Service.savefile(Service.append_words(service.read_data(data,filename)),prepro_file)
        print('컨트롤러에서도' + prepro_file + '생성됌표시')
        return this
Ejemplo n.º 2
0
 def loop2():
     txt='tojiText.txt'
     context = './data/'
     stopwordTxt= 'stopword.txt'
     wordlist=Service.make_wordlist(context,txt,stopwordTxt)
     fontpath = 'malgun.ttf'
     filename = 'tojiWordCloud.png'
     imageFile ='alice_color.png'
     wordDict = dict(wordlist)
     Service.makeWordCloud(context,wordDict,imageFile,fontpath,filename)
     filename = 'tojiBarChart.png'
     Service.makeBarChart(context,wordlist,filename)
Ejemplo n.º 3
0
    def loop3():
        context = './data/'
        prepro_file = 'word2vec.prepro'
        filename = '문재인대통령신년사.txt'
        model_filename = 'word2vec.model'
        Service.create_word2vec(context,filename,prepro_file,model_filename)
        model = word2vec.Word2Vec.load(model_filename)
        print(type(model))

        # most_similar : positive에 명시된 단어에 대하여 유사도가 높은 항목을
        # topn 개만 보여 주세요.
        bargraph = model.wv.most_similar(positive=['국민'], topn=10)
        print(bargraph)

        piegraph = model.wv.most_similar(positive=['남북'], topn=5)
        print(piegraph)

        Service.showGraph(bargraph)

        Service.makePie(piegraph)
Ejemplo n.º 4
0
 def __init__(self):
     self.service =Service()
     self.entity = Entity()
Ejemplo n.º 5
0
 def data_analysis(self):
     entity = Entity()
     service = Service()
     entity.fname = 'kr-Report_2018.txt'
     entity.context = './data/'
     service.extract_token(entity)
     service.extract_hanguel()
     service.conversion_token()
     service.compound_noun()
     entity.fname = 'stopwords.txt'
     service.extract_stoword(entity)
     service.filtering_text_with_stopword()
     service.frequent_text()
     entity.fname = 'D2Coding.ttf'
     service.draw_wordcloud(entity)
Ejemplo n.º 6
0
 def loop1():
     sentence = '세일즈 우먼인 아름다운 그녀가 아버지 가방에 들어 가시나 ㅎㅎ'
     Service.sentence_pos(sentence)
     Service.pos_to_noun(sentence)
Ejemplo n.º 7
0
 def loop1():
     sentence = '일등급 품질인 맛있는 딸기가 비닐 하우스에 들어가시나 ㅎㅎ'
     Service.sentence_pos(sentence)
     Service.pos_to_noun(sentence)