British Airways Customer Review Web Scraping, Text Classification, Sentiment Analysis, and Customer Satisfaction

British Airways Customer Review Web Scraping, Text Classification, Sentiment Analysis, and Customer Satisfaction
Web Scraping, Text Classification, Sentiment Analysis, and Customer Satisfaction

Web Scraping, Text Classification, Sentiment Analysis, and Customer Satisfaction

This project combines web scraping, text classification, and sentiment analysis to evaluate customer satisfaction based on reviews or other text data. The project is built around extracting relevant data from airline websites and analyzing customer sentiments to classify whether the sentiment is positive, neutral, or negative.

Key Features:

  • Web Scraping: Using BeautifulSoup and Requests, I scraped customer reviews and other relevant data from various airline websites (such as British Airways, Air India, Emirates, and more) to gather a rich dataset for analysis.
  • Sentiment Analysis: With sentiment analysis techniques, the project identifies and classifies customer sentiments from the scraped text. This can be used to analyze feedback, detect issues, and measure customer satisfaction.
  • Text Classification: The project also focuses on binary classification, where the system identifies positive and negative customer feedback based on review content.
  • Model Development: I used TensorFlow and other tools like Pandas, NumPy, and Regex to preprocess the data, train models, and evaluate the performance of the sentiment classifier.

Technologies Used:

  • Python: Core language for web scraping, data analysis, and machine learning tasks.
  • BeautifulSoup & Requests: For scraping data from web pages.
  • TensorFlow: For creating and training machine learning models to perform sentiment analysis and classification.
  • Pandas & NumPy: For handling and manipulating datasets.
  • Regex: For text pattern matching and cleaning the scraped data.

Business Impact:

This project offers a practical solution for businesses, especially in the airline industry, to better understand customer sentiment and improve their service offerings. By analyzing customer feedback, businesses can:

  • Quickly identify areas for improvement.
  • Measure the success of new services or features.
  • Enhance customer satisfaction and loyalty by responding to customer concerns and recognizing positive feedback.

The ability to analyze customer sentiment on a large scale, across multiple platforms, can provide actionable insights that help businesses make data-driven decisions to enhance the customer experience.

💼 Business Impact

This project offers a practical solution for businesses, especially in the airline industry, to better understand customer sentiment and improve their service offerings. By analyzing customer feedback, businesses can: Quickly identify areas for improvement. Measure the success of new services or features. Enhance customer satisfaction and loyalty by responding to customer concerns and recognizing positive feedback. The ability to analyze customer sentiment on a large scale, across multiple platforms, can provide actionable insights that help businesses make data-driven decisions to enhance the customer experience.

Code Snippet

import requests
from bs4 import BeautifulSoup as bs
import re
from IPython.display import display
import tensorflow as tf
from tensorflow import  keras
from tensorflow.keras import layers
import os
import numpy as np
import pandas as pd
import shutil
import matplotlib.pyplot as plt
import seaborn as sns

# Load Data/webscraping

def text_scapping(start_page,end_page,recommended_or_not_recommended,airline):
  recommended=[]
  not_recommended=[]
  for i in range(start_page,end_page):
    url=f'https://www.airlinequality.com/airline-reviews/{airline}/page/{i}/'
    re=requests.get(url).content
    result=bs(re,'lxml')

    for i in range(len(result.find_all('div',class_='text_content'))):
      import re
      if result.find_all('td',class_=re.compile('^review-value rating-'))[i].string=='no':
        not_recommended.append(re.split(r'[|]',result.find_all('div',class_='text_content')[i].text,maxsplit=2)[-1])
      elif result.find_all('td',class_=re.compile('^review-value rating-'))[i].string=='yes':
        recommended.append(re.split(r'[|]',result.find_all('div',class_='text_content')[i].text,maxsplit=2)[-1])
      else:
        pass

  if 'recommended'==recommended_or_not_recommended:
    recom_or_not_recom=recommended
  else:
    recom_or_not_recom=not_recommended
  return recom_or_not_recom


def download_text(train_or_test,recommended_or_not_recommended,good_or_bad):
  z=[0]
  for d in (os.listdir(f'/content/drive/MyDrive/Colab_Notebooks/airline/{train_or_test}/{good_or_bad}')):
      z.append(int(d.split('.')[0]))
  if 'not_recommended'==recommended_or_not_recommended:
    for k in range(len(not_recommended)):
        with open(f'/content/drive/MyDrive/Colab_Notebooks/airline/{train_or_test}/{good_or_bad}/{k+np.max(z)}.txt', 'w') as f:
          f.write(not_recommended[k])
  if 'recommended'==recommended_or_not_recommended:
    for k in range(len(recommended)):
        with open(f'/content/drive/MyDrive/Colab_Notebooks/airline/{train_or_test}/{good_or_bad}/{k+np.max(z)}.txt', 'w') as f:
          f.write(recommended[k])
  return



# TensorFlow
  def plot_text(train_or_test,good_or_bad,text_number):
  c=[]
  with open(f'/content/drive/MyDrive/Colab_Notebooks/airline/{train_or_test}/{good_or_bad}/{text_number}.txt') as r:
    c.append(r.read())

  text_len=[]
  for k in c:
    text=k.split()
  for d in text:
    text_len.append(len(d))

  letter=[]
  letter_count=[]
  for c,d in sorted(zip(text_len,text),reverse=True):
    letter_count.append(c)
    letter.append(d)


  plt.figure(figsize=(20,10))
  sns.barplot(x=letter,y=letter_count)
  plt.xticks(ticks=range(len(letter_count)),labels=letter,rotation=90)
  plt.title('distribution of n-grams')
  plt.xlabel('n-grams')
  plt.ylabel('n-grams length')



  unique_text,unique_count=np.unique(text,return_counts=True)

  unique_text_=[]
  unique_text_count=[]
  for k,i in sorted(zip(unique_count,unique_text)):
    unique_text_.append(i)
    unique_text_count.append(k)

  plt.figure(figsize=(20,10))
  sns.barplot(x=unique_text_,y=unique_text_count)
  plt.xticks(ticks=range(len(unique_text_count)),labels=unique_text_,rotation=90)
  plt.title('Frequency distribution of n-grams')
  plt.xlabel('n-grams')
  plt.ylabel('Frequencies')

  return plt.show()

  #Model Training
  model.compile(optimizer='adam',metrics=tf.metrics.BinaryAccuracy(threshold=0.0),loss=tf.keras.losses.BinaryCrossentropy(from_logits=True))

Other Projects

Telco Churn
Telco Churn
Telco churn refers to the rate at which customers discontinue their services with a telecommunications company-whether it's mobile, internet, cable TV, or bundled services. It's a critical KPI in the telecom industry because high churn rates = revenue leakage + brand instability.
Data-Science
Python
Scikit-learn
Pandas
Numpy
Tensorflow
Keras
Pytorch
View Project
supply chain spend analytics dashboard overview
supply chain spend analytics dashboard overview
This project involved building an interactive Spend Analytics Dashboard to help logistics, procurement and finance teams gain real-time visibility into organizational spending. The dashboard consolidated multi-year spend data across vendors, product categories, and logistics channels - providing a centralized decision-support system for cost control and strategic sourcing.
Visualization
PowerBI
View Project
Scraping Airbnb
Scraping Airbnb
This project demonstrates my ability to combine web scraping techniques with machine learning to classify images. The goal was to build a pipeline that scrapes images of shoes from a website and uses them for training a machine learning model.
WebScraping
BeautifulSoup
Selenium
Scrapy
View Project
Customers Transaction Analysis
Customers Transaction Analysis
A comprehensive database management system for a small business.
Database
SQL
MySQL
PostgreSQL
MongoDB
Pyspark
View Project
Bulldozer Sale Price Prediction
Bulldozer Sale Price Prediction
This project tackled a real-world business problem sourced from a Kaggle competition hosted by Caterpillar Inc. Using structured data containing product specifications, usage history, and transactional attributes, I built a machine learning pipeline capable of forecasting future equipment prices a key tool for optimizing resale strategy in capital-intensive industries.
Data-Science
Python
Scikit-learn
Pandas
Numpy
Tensorflow
Keras
Pytorch
View Project
Credit Score Prediction
Credit Score Prediction
This project focuses on building a predictive model to estimate an individual's credit score category-poor, Standard, or Good-based on financial and behavioral attributes. The goal is to assist financial institutions in automating credit risk assessment, improving loan approval decisions, and reducing default rates.
Data-Science
Python
Scikit-learn
Pandas
Numpy
Tensorflow
Keras
Pytorch
View Project
Customer Booking Prediction
Customer Booking Prediction
This Customer Booking Prediction project uses historical transaction data, customer behavior patterns, and contextual variables to forecast the likelihood and timing of future bookings. By applying machine learning models such as Logistic Regression, XGBoost, or Neural Networks, organizations can identify which customers are most likely to make a booking, when they are likely to do so, and what factors influence their decision
Data-Science
Python
Scikit-learn
Pandas
Numpy
Tensorflow
Keras
Pytorch
View Project
Bike Sharing Prediction
Bike Sharing Prediction
This project Bike Sharing Prediction leverages historical rental data, weather patterns, seasonal trends, and time-based variables to forecast future demand for shared bicycles. This predictive modeling process typically involves data preprocessing, feature engineering, and the application of machine learning algorithms such as Random Forest and Gradient Boosting
Data-Science
Python
Scikit-learn
Pandas
Numpy
Tensorflow
Keras
Pytorch
View Project
Customer Segmentation
Customer Segmentation
Developed a predictive classification model to determine the likelihood of a customer completing a booking. The project enables businesses to reduce cart abandonment, optimize marketing strategies, and increase conversion rates.
Data-Science
Python
Scikit-learn
Pandas
Numpy
Tensorflow
Keras
Pytorch
View Project
Sales Dashboard using Power BI
Sales Dashboard using Power BI
This Sales Performance Dashboard provides actionable insights into product sales, customer segmentation, and regional performance. Built with Power BI, this dashboard supports strategic decision-making by consolidating large volumes of transactional data into an interactive and visually intuitive interface.
Visualization
PowerBI
View Project
Vehicle Repair Dashboard
Vehicle Repair Dashboard
This Vehicle Repair Dashboard provides a strategic lens into fleet maintenance activities across suppliers, vehicle brands, and service types. It enables data-driven decision-making by highlighting repair patterns, supplier performance, and maintenance trends.
Visualization
PowerBI
View Project
Web Scraping and Image Classification with TensorFlow
Web Scraping and Image Classification with TensorFlow
This project demonstrates my ability to combine web scraping techniques with machine learning to classify images. The goal was to build a pipeline that scrapes images of shoes from a website and uses them for training a machine learning model.
WebScraping
BeautifulSoup
Selenium
Scrapy
View Project
British Airway Webscraping with Beautifulsoup
British Airway Webscraping with Beautifulsoup
This project demonstrates how web scraping can be used to extract valuable data from airline websites, specifically British Airways, using Python's BeautifulSoup library. The goal was to scrape flight-related data, such as flight details, prices, and other useful information, from the British Airways website for analysis.
WebScraping
BeautifulSoup
Selenium
Scrapy
View Project
Ecommerce Website Webscraping
Ecommerce Website Webscraping
This project uses requests and BeautifulSoup to scrape product listings from StockX’s e-commerce platform. The scraper extracts product name, description, price, and image link across multiple paginated results, storing them in a structured dataset for analysis or integration into business workflows.
WebScraping
BeautifulSoup
Selenium
Scrapy
View Project
Jumia Website Scraping
Jumia Website Scraping
This project uses requests and BeautifulSoup to scrape product listings and prices from Jumia Nigeria. The scraper works across multiple pages and categories, returning structured datasets ready for analysis.
WebScraping
BeautifulSoup
Selenium
Scrapy
View Project
Stack Overflow Text Classification
Stack Overflow Text Classification
This project involves building a multi-class classification model to predict the tag of a Stack Overflow question based on its content. The goal is to classify programming questions into specific tags such as Python, CSharp, JavaScript, and Java using Natural Language Processing (NLP) techniques.
Data-Science
Deep-Learning
Python
Numpy
Tensorflow
Keras
Pytorch
View Project
Fruits Image Classification
Fruits Image Classification
This project leverages image classification techniques to classify fruit images into their respective categories using Convolutional Neural Networks (CNN). The dataset used is the Fruits 360 dataset, which includes a wide variety of fruits and vegetables, and the goal was to build a model capable of predicting the type of fruit based on the image.
Data-Science
Deep-Learning
Python
Numpy
Tensorflow
Keras
Pytorch
View Project
Purchase Prediction
Purchase Prediction
Purchase Prediction with Logistic Regression.This project focuses on using logistic regression to predict customer purchases based on various demographic and behavioral features. The goal was to predict whether a customer will make a purchase (binary classification) using factors such as age, gender, marital status, income, occupation, and more.
Data-Science
Scikit-learn
Python
Numpy
K-Means
PCA
Logistic Regression
View Project
Ebay Sneakers WebScraping Using Selenium
Ebay Sneakers WebScraping Using Selenium
This project demonstrates the use of Python-based web scraping to extract product information from eBay. The focus was on collecting structured data such as item titles, prices, and condition from search result pages, enabling price analysis and market research.
WebScraping
BeautifulSoup
Selenium
Scrapy
View Project
Uber Ride Analytics Dashboard Overview
Uber Ride Analytics Dashboard Overview
This project involved building an interactive Uber Analytics Dashboard to provide insights into ride bookings, payment methods, vehicle usage, and location-based demand. The dashboard enabled stakeholders to monitor trends in customer behavior, evaluate revenue drivers, and optimize fleet allocation for operational efficiency and strategic planning.
Visualization
PowerBI
View Project
HR Analytics Dashboard Employee & Attrition Insights
HR Analytics Dashboard Employee & Attrition Insights
This project involved building an Interactive HR analytics dashboard covering employee attrition, hiring, salaries and departmental performance. Includes data visualizations and KPIs for strategic HR decision-making.
Visualization
PowerBI
View Project