text_html_output_1.png
from pandas import DataFrame

from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer

import pandas as pd

import re

data_meta = pd.read_csv('/kaggle/input/content-based/meta_full_csv')
data_meta = data_meta.sample(50000)
data_meta['summaryRev'] = data_meta['summary'] + ' ' + data_meta['reviewText']

data_meta.query("asin == 'B00GIDADP0'")

data_meta.query("asin == 'B002Q46RDW'")

data_meta_1 = data_meta[['asin', 'overall', 'unixReviewTime']]
data_meta_1
data_meta_2 = data_meta[['asin', 'overall', 'summaryRev']]

data_meta_2
regEx = re.compile('[^a-z]+')
def cleanReviews(reviewText):
    reviewText = reviewText.lower()
    reviewText = regEx.sub(' ', reviewText).strip()
    return reviewText
data_meta_2['summaryClean'] = data_meta_2['summaryRev'].apply(cleanReviews)
data_meta_2 = data_meta_2.reset_index()

reviews = data_meta_2['summaryClean']
countVector = CountVectorizer(max_features=300, stop_words='english')
transformedReviews = countVector.fit_transform(reviews)
dfReviews = DataFrame(transformedReviews.A, columns=countVector.get_feature_names())
dfReviews = dfReviews.astype(int)

dfReviews