小编Yao*_*ian的帖子

Python,sklearn,it-idf 如何按“####”分割,默认空格

使用sklean tf-idf,默认使用空间分割

corpus = [  
'This is the first document.',  
'This is the second second document.',  
'And the third one.',  
'Is this the first document?'
]    

vectorizer = CountVectorizer()   
X = vectorizer.fit_transform(corpus)
Run Code Online (Sandbox Code Playgroud)

但是,我想使用这种形式:

enter code herecorpus = [  
'This####is####the####first####document.',  
'This####is####the####second####second####document.'
]
vectorizer = CountVectorizer()   
X = vectorizer.fit_transform(corpus)
tfidf=transformer.fit_transform(vectorizer.fit_transform(documents))
word=vectorizer.get_feature_names()
weight=tfidf.toarray()
Run Code Online (Sandbox Code Playgroud)

怎么做?

python split tf-idf scikit-learn

2
推荐指数
1
解决办法
1101
查看次数

标签 统计

python ×1

scikit-learn ×1

split ×1

tf-idf ×1