This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data= str('I have made a flight booking on Yatra. My PNR No are S6ZF2Y . I had booked a return flight for both the PNR. The outbound flight i.eรย "BOM -TRV"รย had been cancelled by the airways and the full amount has been credited back to my account.รย Now the Inbound flight i.e."รย TRV -รย BOM " has also been cancelled by the airways and the full amount has been processed to the yatra account on 24th Feb 2020. So I want you to refund me the amount ASAP. When would I get the refund back?Waiting for your reply') | |
data_words= cleaning_new_text(data) | |
data= TreebankWordDetokenizer().detokenize(data_words) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Importing Pickle File(Contains our trained classification model) | |
import pickle | |
with open('classificationModel.pkl', 'rb') as f: | |
clf2 = pickle.load(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Making Predictions | |
prediction_category= {0:'Refunds',1:'Cancellation',2:'Others',3:'Amendment',4:'Website Error'} | |
my_prediction = clf2.predict([data]) | |
my_prediction= my_prediction[0] | |
my_prediction= prediction_category[my_prediction] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tokenize - break down each sentence into a list of words | |
import gensim | |
from gensim.utils import simple_preprocess | |
from gensim.parsing.preprocessing import STOPWORDS | |
stop_words = STOPWORDS | |
import spacy | |
nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner']) | |
from nltk.tokenize.treebank import TreebankWordDetokenizer | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import re | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from nltk.corpus import stopwords | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from sklearn.pipeline import Pipeline | |
from sklearn.metrics import classification_report, confusion_matrix | |
from sklearn.model_selection import train_test_split | |
from sklearn.feature_selection import SelectKBest, chi2 |