瀏覽代碼

Fixed - to display the output

It can able to extract the words and make count of it
pull/30/head
THIYAGARAJAN 4 年之前
committed by GitHub
父節點
當前提交
6e04e517a7
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 39 次插入0 次删除
  1. +39
    -0
      text_preprocessing.py

+ 39
- 0
text_preprocessing.py 查看文件

@ -0,0 +1,39 @@
import clean_text
# import all our functions
from clean_text import *
#!pylint cleantext
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
training = [
" I am master of all",
"I am a absolute learner"
]
generalization = [
"I am absolute learner learner"
]
vectorization = CountVectorizer(
stop_words = "english",
preprocessor = process.master_clean_text)
vectorization.fit(training)
build_vocab = {
value:key
for key , value in vectorization.vocabulary_.items()
}
vocab = [build_vocab[i] for i in range(len(build_vocab))]
extracted = pd.DataFrame(
data = vectorization.transform(generalization).toarray(),
index=["generalization"],
columns=vocab
)
print(extracted)

Loading…
取消
儲存