<jupyter_start><jupyter_text>1. Cleaning<jupyter_code>import clean_Text as ct
xclean=[ct.get_cleanedreview(i) for i in x]
xt_clean=[ct.get_cleanedreview(i) for i in x_test]
print(xclean)<jupyter_output>['awesom awesom movi', 'great movi like lot', 'happi end awesom act hero', 'love truli great', 'bad upto mark', 'could better', 'sure disappoint movi', 'total disgrac fuck movi', 'movi good']<jupyter_text>2. vetorisation<jupyter_code>from sklearn.feature_extraction.text import CountVectorizer
cv=CountVectorizer(ngram_range=(1,2))
Xvect=cv.fit_transform(xclean,y).toarray()
print(Xvect)
print(cv.vocabulary_)
Xtvect=cv.transform(xt_clean).toarray()
print(Xtvect)
from sklearn.feature_extraction.text import TfidfVectorizer
tfidf=TfidfVectorizer()
vt=tfidf.fit_transform(x,y).toarray()
print(vt)
test=tfidf.transform(xt_clean).toarray()
print(test)
print(tfidf.vocabulary_)<jupyter_output>[[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
  0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
  0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
  0. 0. 0. 0. 0. 0. 0. 0.]]
{'this': 26, 'was': 31, 'awesome': 2, 'an': 1, 'movie': 22, 'great': 13, 'liked': 18, 'it': 17, 'lot': 19, 'happy': 14, 'ending': 10, 'acting': 0, 'by': 6, 'the': 25, 'hero': 16, 'loved': 20, 'truly': 28, 'bad': 3, 'not': 23, 'upto': 30, 'mark': 21, 'could': 7, 'have': 15, 'been': 4, 'better': 5, 'surely': 24, 'disappointing': 8, 'totally': 27, 'disgrace': 9, 'fucked': 11, 'up': 29, 'good': 12}<jupyter_text>3. prediction<jupyter_code>from sklearn.naive_bayes import MultinomialNB,GaussianNB,BernoulliNB
#objects
mnb=MultinomialNB()
gnb=GaussianNB()
bnb=BernoulliNB()
mnb.fit(Xvect,y)
mnb.predict(Xtvect)
mnb.score(Xvect,y)
mnb.fit(vt,y)
mnb.predict(test)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20658523632501327, 'fraction_numerical': 0.08231545406266595, 'mean_word_length': 4.161643835616438, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 1, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '472916', 'license': 'MIT', 'n_tokens_mistral': 1033, 'n_tokens_neox': 861, 'n_words': 236, 'path': 'MachineLearning/projects/MovieReviewPrediction/Text Classification-NaiveBayes.ipynb', 'repo_name': 'pulkit10251/cbData-Science-Master', 'size': '1883'}