How to paraphrase text in Python using the PARROT library (Ft. @KenJee_ds)

Data Professor · Beginner ·🛠️ AI Tools & Apps ·5y ago

Key Takeaways

The video demonstrates how to use the PARROT library in Python to paraphrase text, utilizing a pre-trained model based on the T5 architecture. The tutorial covers installation, importing the library, and generating paraphrases for various input phrases.

Full Transcript

in this video i'm going to show you how you could paraphrase text in python using the parrot library and so we're starting right now and so the jupiter notebook used in this tutorial will be provided in the video description and it's going to be on the github of the data professor and so the first thing that you need to do here is to install the parrot library and it's developed by pre tv rod dowmo darin all right and now it's installed and we're going to import the parrot function from parrot and here we're going to use pytorch let's run the first cell here and then for reproducibility we're going to fix the random state number here but you could feel free to try out a different random seed number and then we're gonna initialize the model here and it's downloading the model and this one is based on the t5 and let me check out the runtime is it gpu no i haven't selected the gpu let's see if this works one moment as this being installed or downloaded so the pre-trained model here is being downloaded and the great thing is that you don't have to train the model you're just downloading the model and then you're using it and so the phrase here that we're gonna use today i've arbitrarily created this and so let's check out whether this particular parrot model will perform good or not let's have a look alright it's finished and let's read in the phrase here and actually here you can put in several sentences if you want let me add another one so i'm gonna use two phrases what is the best way to learn data science and how can i become a data scientist let's see if the model will generate some interesting results for us and the original one was what is the best way to learn data science and the output here is how do i learn data science how can i learn data science where should i learn data science where should i start learning data science show the best ways to learn data science tell me the best way to learn data science okay so i'm not sure why it's not displaying the result for the second one so let me just delete the first one then let's do it again so here the input is how can i become a data scientist and the output is tell me the best way to become a data scientist how do you become a data scientist can someone become a data scientist how do i become a data scientist how can one become a data scientist how can i become a data scientist okay so it's reasonably okay for the paraphrasing and so let's make it a bit more general where can i buy the best the most delicious pizzas let's try that all right and so the output is where can i get all the best pizza where can i buy good quality pizzas where can i get the best quality pizza where can i buy the best pizzas where can i get delicious pizza where can i get some delicious pizza where can i find the most delicious pizza and where can i buy most delicious pizza okay so it's reasonably good for paraphrasing less technical sentences how about this question and so let's get some possible spin to the question here so the input is what's the most delicious papayas and so here it is giving us four results what's the best papaya to eat which are the best papayas what is your most delicious papaya lists the most delicious papayas and so if you would like to find the answer to this one it has to come from kanji there's a lot of different types of papaya so right i i actually only like the whole hawaii gold papaya i don't like the mexican red papaya very much it tastes kind of funky to me but for anyone that's a papaya daughter you have to try the hawaii gold very all right all right yes and so if you're finding value in this video please smash the like button to support the channel subscribe if you haven't already and also hit on the notification bell so that you will be notified of the next video and as always the best way to learn data science is to do data science and please enjoy the journey

Original Description

In this video, I will show you how to use the PARROT library to paraphrase text in Python. Essentially PARROT is a pre-trained paraphrase based utterance augmentation framework. In just a few lines of code, you will be able to automatically perform text paraphrasing with ease. 🌟 Download Kite for FREE https://www.kite.com/get-kite/?utm_medium=referral&utm_source=youtube&utm_campaign=dataprofessor&utm_content=description-only 🌟 Subscribe to Ken Jee https://www.youtube.com/channel/UCiT9RITQ9PW6BhXK0y2jaeg ⭕ Links for this video - Code https://github.com/dataprofessor/parrot - Parrot GitHub https://github.com/PrithivirajDamodaran/Parrot - Install pip install git+https://github.com/PrithivirajDamodaran/Parrot.git Note: Code used in this video was adapted from Parrot creator Prithiviraj Damodaran ⭕ Support my work: 🌟 Subscribe to the Coding Professor channel https://www.youtube.com/channel/UCJzlfIoF8nmWqJIv_iWQVRw?sub_confirmation=1 🌟 Subscribe to the Data Professor https://www.youtube.com/dataprofessor?sub_confirmation=1 🌟 Join the Newsletter of Data Professor http://newsletter.dataprofessor.org 🌟 Buy me a coffee https://www.buymeacoffee.com/dataprofessor ⭕ Recommended Books: 🌟https://kit.co/dataprofessor ✅ Python Basics: A Practical Introduction to Python 3 https://amzn.to/3awdWgm ✅ Learn Python Programming (The no-nonsense, beginner's guide) https://amzn.to/2RFpSpn ✅ Learn to Program with Minecraft https://amzn.to/3x2MujZ ✅ Automate the Boring Stuff with Python, 2nd Edition: Practical Programming for Total Beginners https://amzn.to/2QzkyDs ⭕ Disclaimer: Recommended books and tools are affiliate links that gives me a portion of sales at no cost to you, which will contribute to the improvement of this channel's contents. ⭕ Stock photos, graphics and videos used on this channel: ✅ https://1.envato.market/c/2346717/628379/4662 #python #parrot #paraphrase #paraphrasing #pythontutorial #dataprofessor
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Data Professor · Data Professor · 0 of 60

← Previous Next →
1 How a Biologist became a Data Scientist
How a Biologist became a Data Scientist
Data Professor
2 WEKA Tutorial #1.1 - How to Build a Data Mining Model from Scratch
WEKA Tutorial #1.1 - How to Build a Data Mining Model from Scratch
Data Professor
3 WEKA Tutorial #1.2 - How to Build a Data Mining Model from Scratch
WEKA Tutorial #1.2 - How to Build a Data Mining Model from Scratch
Data Professor
4 WEKA Tutorial #1.3 - How to Build a Data Mining Model from Scratch
WEKA Tutorial #1.3 - How to Build a Data Mining Model from Scratch
Data Professor
5 Computational Drug Discovery: Machine Learning for Making Sense of Big Data in Drug Discovery
Computational Drug Discovery: Machine Learning for Making Sense of Big Data in Drug Discovery
Data Professor
6 Quotes #1 on Big Data and Data Science
Quotes #1 on Big Data and Data Science
Data Professor
7 Quotes #2 on Big Data and Data Science
Quotes #2 on Big Data and Data Science
Data Professor
8 Quotes #3 on Big Data and Data Science
Quotes #3 on Big Data and Data Science
Data Professor
9 Quotes #4 on Big Data and Data Science
Quotes #4 on Big Data and Data Science
Data Professor
10 Quotes #5 on Big Data and Data Science
Quotes #5 on Big Data and Data Science
Data Professor
11 Data Science 101: Starting a Data Science / Data Mining Project
Data Science 101: Starting a Data Science / Data Mining Project
Data Professor
12 Data Science 101: CRISP-DM - Data Mining / Data Science in 6 Steps
Data Science 101: CRISP-DM - Data Mining / Data Science in 6 Steps
Data Professor
13 R Programming 101: How to Define Variables
R Programming 101: How to Define Variables
Data Professor
14 R Programming 101: Read and Write CSV files
R Programming 101: Read and Write CSV files
Data Professor
15 Data Science 101: Basic Command-Line for Data Science
Data Science 101: Basic Command-Line for Data Science
Data Professor
16 Strategies for Learning Data Science in 2020 (Data Science 101)
Strategies for Learning Data Science in 2020 (Data Science 101)
Data Professor
17 Building your Data Science Portfolio with GitHub (Data Science 101)
Building your Data Science Portfolio with GitHub (Data Science 101)
Data Professor
18 R Programming 101: Setting up R programming environment (R, RStudio and RStudio.cloud)
R Programming 101: Setting up R programming environment (R, RStudio and RStudio.cloud)
Data Professor
19 Exploratory Data Analysis in R: Towards Data Understanding
Exploratory Data Analysis in R: Towards Data Understanding
Data Professor
20 Exploratory Data Analysis in R: Quick Dive into Data Visualization
Exploratory Data Analysis in R: Quick Dive into Data Visualization
Data Professor
21 Machine Learning in R: Building a Classification Model
Machine Learning in R: Building a Classification Model
Data Professor
22 Machine Learning in R: Repurpose Machine Learning Code for New Data
Machine Learning in R: Repurpose Machine Learning Code for New Data
Data Professor
23 Data Science 101: Deploying your Machine Learning Model
Data Science 101: Deploying your Machine Learning Model
Data Professor
24 Machine Learning in R: Deploy Machine Learning Model using RDS
Machine Learning in R: Deploy Machine Learning Model using RDS
Data Professor
25 Data Pre-processing in R: Handling Missing Data
Data Pre-processing in R: Handling Missing Data
Data Professor
26 Machine Learning in R: Speed up Model Building with Parallel Computing
Machine Learning in R: Speed up Model Building with Parallel Computing
Data Professor
27 Data Science 101: Overview of Machine Learning Model Building Process
Data Science 101: Overview of Machine Learning Model Building Process
Data Professor
28 Web Apps in R: Building your First Web Application in R | Shiny Tutorial Ep 1
Web Apps in R: Building your First Web Application in R | Shiny Tutorial Ep 1
Data Professor
29 Web Apps in R: Build Interactive Histogram Web Application in R | Shiny Tutorial Ep 2
Web Apps in R: Build Interactive Histogram Web Application in R | Shiny Tutorial Ep 2
Data Professor
30 Web Apps in R: Building Data-Driven Web Application in R | Shiny Tutorial Ep 3
Web Apps in R: Building Data-Driven Web Application in R | Shiny Tutorial Ep 3
Data Professor
31 Web Apps in R: Building the Machine Learning Web Application in R | Shiny Tutorial Ep 4
Web Apps in R: Building the Machine Learning Web Application in R | Shiny Tutorial Ep 4
Data Professor
32 Web Apps in R: Build BMI Calculator web application in R for health monitoring | Shiny Tutorial Ep 5
Web Apps in R: Build BMI Calculator web application in R for health monitoring | Shiny Tutorial Ep 5
Data Professor
33 Machine Learning in R: Building a Linear Regression Model
Machine Learning in R: Building a Linear Regression Model
Data Professor
34 What programming language to learn for Data Science? R versus Python
What programming language to learn for Data Science? R versus Python
Data Professor
35 How to Become a Data Scientist (Learning Path and Skill Sets Needed)
How to Become a Data Scientist (Learning Path and Skill Sets Needed)
Data Professor
36 Using Python in R
Using Python in R
Data Professor
37 Interpretable Machine Learning Models
Interpretable Machine Learning Models
Data Professor
38 Making Scatter Plots in R [Data Visualisation in R series]
Making Scatter Plots in R [Data Visualisation in R series]
Data Professor
39 Machine Learning in Python: Building a Classification Model
Machine Learning in Python: Building a Classification Model
Data Professor
40 Compare Machine Learning Classifiers in Python
Compare Machine Learning Classifiers in Python
Data Professor
41 Hyperparameter Tuning of Machine Learning Model in Python
Hyperparameter Tuning of Machine Learning Model in Python
Data Professor
42 Practical Introduction to Google Colab for Data Science
Practical Introduction to Google Colab for Data Science
Data Professor
43 File Handling in Google Colab for Data Science
File Handling in Google Colab for Data Science
Data Professor
44 Pandas for Data Science: Create and Combine DataFrames / Rename Columns
Pandas for Data Science: Create and Combine DataFrames / Rename Columns
Data Professor
45 Machine Learning in Python: Building a Linear Regression Model
Machine Learning in Python: Building a Linear Regression Model
Data Professor
46 Machine Learning in Python: Principal Component Analysis (PCA) for Handling High-Dimensional Data
Machine Learning in Python: Principal Component Analysis (PCA) for Handling High-Dimensional Data
Data Professor
47 How to Plot an ROC Curve in Python | Machine Learning in Python
How to Plot an ROC Curve in Python | Machine Learning in Python
Data Professor
48 Installing conda on Google Colab for Data Science
Installing conda on Google Colab for Data Science
Data Professor
49 Use native R on Google Colab for Data Science
Use native R on Google Colab for Data Science
Data Professor
50 How to Save and Download files from Google Colab
How to Save and Download files from Google Colab
Data Professor
51 Easy Web Scraping in Python using Pandas for Data Science
Easy Web Scraping in Python using Pandas for Data Science
Data Professor
52 Data Science for Computational Drug Discovery using Python (Part 1)
Data Science for Computational Drug Discovery using Python (Part 1)
Data Professor
53 Pandas Profiling for Data Science (Quick and Easy Exploratory Data Analysis)
Pandas Profiling for Data Science (Quick and Easy Exploratory Data Analysis)
Data Professor
54 Exploratory Data Analysis in Python using pandas
Exploratory Data Analysis in Python using pandas
Data Professor
55 Quick tour of PyCaret (a low-code machine learning library in Python)
Quick tour of PyCaret (a low-code machine learning library in Python)
Data Professor
56 How to Upload Files to Google Colab
How to Upload Files to Google Colab
Data Professor
57 How to Install and Use Pandas Profiling on Google Colab
How to Install and Use Pandas Profiling on Google Colab
Data Professor
58 How to Adjust the Style of Pandas DataFrame
How to Adjust the Style of Pandas DataFrame
Data Professor
59 How to use Bamboolib for Data Wrangling in Data Science
How to use Bamboolib for Data Wrangling in Data Science
Data Professor
60 How to use Pandas Profiling on Kaggle
How to use Pandas Profiling on Kaggle
Data Professor

This video teaches how to use the PARROT library in Python to paraphrase text, covering installation, importing, and generating paraphrases. The tutorial provides a hands-on example of using a pre-trained model for text generation.

Key Takeaways
  1. Install the PARROT library using pip
  2. Import the PARROT function from the library
  3. Initialize the pre-trained model
  4. Input a phrase to paraphrase
  5. Generate and display the paraphrased text
  6. Experiment with different input phrases and evaluate the results
💡 The PARROT library provides a simple and efficient way to paraphrase text using a pre-trained model, eliminating the need for extensive training or expertise in natural language processing.

Related Reads

Up next
The Official Shopify Sidekick Tutorial (Part 2)
Learn With Shopify
Watch →