Menu

Predicting a Single Review

Predicting a Single Review

One of the main goals of this project is to classify new reviews that were not part of the training dataset.

We first preprocess the review, convert it into TF-IDF features, and then use the trained model to predict whether it is fake or genuine.

Example Review

sample_review = "This product is amazing and worth every penny."

Clean the Review

sample_review = clean_text(sample_review)
sample_review = remove_stopwords(sample_review)
sample_review = lemmatize_text(sample_review)

Convert to TF-IDF

sample_vector = tfidf.transform([sample_review])

Predict the Review

prediction = model.predict(sample_vector)
prediction

Display the Result

if prediction[0] == 1:
print("Prediction: Fake Review")
else:
print("Prediction: Genuine Review")