xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 2KB
    文件類型: .py
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-01-06
  • 語(yǔ)言: Python
  • 標(biāo)簽: doc2vec??

資源簡(jiǎn)介

主要用于文本的量化處理,非常適合計(jì)算文本的相似度以及文本分類,相比于tf-idf更優(yōu)。

資源截圖

代碼片段和文件信息

import?jieba
import?pandas?as?pd
import?gensim
import?re
jieba.load_userdict(‘d:/data/stocks/數(shù)據(jù)/平安銀行字典.txt‘)#加載結(jié)巴分詞的詞典(還需要把各股票的名字導(dǎo)入進(jìn)去,今天進(jìn)行)
jieba.load_userdict(‘d:/data/stocks/數(shù)據(jù)/股票名稱.txt‘)
def?cut_word(text):
????‘‘‘
????分詞操作,返回一個(gè)文章的所有單詞列表
????‘‘‘
????#text=process_txt(str(text))
????#text=‘?‘.join(text)
????text_list=re.split(u‘[^\u4e00-\u9fa50-9a-zA-Z]+‘?str(text))
????word_list=[]
????for?sent?in?text_list:
????????word_list1=jieba.cut(sent)
????????for?word?in?word_list1:
????????????word_list.append(word)
????return?word_list
#print(df)#打印df
#df[‘index‘]=0:(len(df)-1)#給文章一個(gè)訓(xùn)練id號(hào)
##訓(xùn)練Doc2vec模型
import?gensim
#import?multiprocessing
#import?logging
LabeledSentence?=?gensim.models.doc2vec.LabeledSentence
#先把所有文檔的路徑存進(jìn)一個(gè)?array?中,docLabels:
from?os?import?listdir

評(píng)論

共有 條評(píng)論

相關(guān)資源