Skip to content

Instantly share code, notes, and snippets.

View vivek1240's full-sized avatar

Vivek Singh vivek1240

View GitHub Profile
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)
#Importing Pickle File(Contains our trained classification model)
import pickle
with open('classificationModel.pkl', 'rb') as f:
clf2 = pickle.load(f)
#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]
# 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
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