file0 = open('wiki0.txt','r')
content= file0.readlines()
file1 = open('wiki1.txt','r')
content= file1.readlines()
file2 = open('wiki2.txt','r')
content= file2.readlines()
file3 = open('wiki3.txt','r')
content= file3.readlines()
file4 = open('wiki4.txt','r')
content= file4.readlines()
doc_complete = [file0, file1, file2, file3, file4]
import sklearn
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
tf_vectorizer = CountVectorizer(max_df=0.95, min_df=2,
max_features=no_features, stop_words='english')
tf = tf_vectorizer.fit_transform(doc_complete)
tf_feature_names = tf_vectorizer.get_feature_names()
from sklearn.decomposition import NMF, LatentDirichletAllocation,
TruncatedSVD
from sklearn.feature_extraction.text import CountVectorizer
NUM_TOPICS = 4
vectorizer = CountVectorizer(min_df=5, max_df=0.9,
stop_words='english', lowercase=True,
token_pattern='[a-zA-Z\-][a-zA-Z\-]{2,}')
data_vectorized = vectorizer.fit_transform(doc__complete)
lda_model = LatentDirichletAllocation(n_topics=NUM_TOPICS, max_iter=10,
learning_method='online')
lda_Z = lda_model.fit_transform(data_vectorized)
print(lda_Z.shape)
I am getting the following error.Can you please help me out with this.
ImportError Traceback (most recent call last) in () ----> 1 from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer 2 tf_vectorizer = CountVectorizer(max_df=0.95, min_df=2, max_features=no_features, stop_words='english') 3 tf = tf_vectorizer.fit_transform(doc_complete) 4 tf_feature_names = tf_vectorizer.get_feature_names()
C:\Users\Vinaya annu\AppData\Local\Enthought\Canopy\User\lib\site-packages\sklearn__init__.py in () 131 # process, as it may not be compiled yet 132 else: --> 133 from . import __check_build 134 from .base import clone 135 __check_build # avoid flakes unused variable error
ImportError: cannot import name __check_build