Natural_Language_Processing / pages /6_Feature_Engineering.py
Harika22's picture
Update pages/6_Feature_Engineering.py
183160b verified
import streamlit as st
st.markdown("""
<style>
/* Set a soft background color */
body {
background-color: #eef2f7;
}
/* Style for main title */
h1 {
color: black;
font-family: 'Roboto', sans-serif;
font-weight: 700;
text-align: center;
margin-bottom: 25px;
}
/* Style for headers */
h2 {
color: black;
font-family: 'Roboto', sans-serif;
font-weight: 600;
margin-top: 30px;
}
/* Style for subheaders */
h3 {
color: red;
font-family: 'Roboto', sans-serif;
font-weight: 500;
margin-top: 20px;
}
.custom-subheader {
color: black;
font-family: 'Roboto', sans-serif;
font-weight: 600;
margin-bottom: 15px;
}
/* Paragraph styling */
p {
font-family: 'Georgia', serif;
line-height: 1.8;
color: black;
margin-bottom: 20px;
}
/* List styling with checkmark bullets */
.icon-bullet {
list-style-type: none;
padding-left: 20px;
}
.icon-bullet li {
font-family: 'Georgia', serif;
font-size: 1.1em;
margin-bottom: 10px;
color: black;
}
.icon-bullet li::before {
content: "◆";
padding-right: 10px;
color: black;
}
/* Sidebar styling */
.sidebar .sidebar-content {
background-color: #ffffff;
border-radius: 10px;
padding: 15px;
}
.sidebar h2 {
color: #495057;
}
.step-box {
font-size: 18px;
background-color: #F0F8FF;
padding: 15px;
border-radius: 10px;
box-shadow: 2px 2px 8px #D3D3D3;
line-height: 1.6;
}
.box {
font-size: 18px;
background-color: #F0F8FF;
padding: 15px;
border-radius: 10px;
box-shadow: 2px 2px 8px #D3D3D3;
line-height: 1.6;
}
.title {
font-size: 26px;
font-weight: bold;
color: #E63946;
text-align: center;
margin-bottom: 15px;
}
.formula {
font-size: 20px;
font-weight: bold;
color: #2A9D8F;
background-color: #F7F7F7;
padding: 10px;
border-radius: 5px;
text-align: center;
margin-top: 10px;
}
/* Custom button style */
.streamlit-button {
background-color: #00FFFF;
color: #000000;
font-weight: bold;
}
</style>
""", unsafe_allow_html=True)
st.markdown("<h1 class='header-title'>🛠️ Feature Engineering 📌</h1>", unsafe_allow_html=True)
st.markdown(
"""
<div class='info-box'>
<p>🔹 When we take existing features from collected data and create new useful features, where this is automatically engineered made from existing features and the technique of creating the features is known as <span class='highlight'>Feature Engineering</span>.</p>
<p> These engineered features enhance machine learning models.</p>
<p> A subpart of feature engineering is Feature Extraction.</p>
</div>
""",
unsafe_allow_html=True
)
st.subheader(":violet[Feature Extraxtion]")
st.markdown(
"""
<div class='info-box'>
<p>📝 Feature Extraction is the process where text data which is natural language is given to machine to understand the natural language.</p>
<ul>
<li>Text is converted into vectors using specific algorithms.</li>
<li>Preserving meaningful information is key.</li>
<li>Helps in better text analysis & machine learning</li>
</ul>
</div>
""",
unsafe_allow_html=True
)
st.header("Vectorization🧭")
st.markdown(
"""
<div class='info-box'>
<p>Vectorization is the process of converting text into vector.</p>
<p>This allows ML models to process text data effectively.</p>
</div>
""",
unsafe_allow_html=True
)
st.subheader(":violet[Vectorization techniques]")
st.markdown("""
There a different techniques to convert text into vector format.They are :
<ul class="icon-bullet">
<li>One-Hot Vectorization </li>
<li>Bag of Words(BOW) </li>
<li>Term Frequency - Inverse Document Frequency(TF-IDF)</li>
</ul>
""", unsafe_allow_html=True)
st.markdown("""
There are advance vectorization techniques.They are :
<ul class="icon-bullet">
<li>Word Embedding </li>
<li>Word2Vec </li>
<li>Fasttext</li>
</ul>
""", unsafe_allow_html=True)
st.sidebar.title("Navigation 🧭")
file_type = st.sidebar.radio(
"Choose a Vectorization technique :",
("One-Hot Vectorization", "Bag of Words(BOW)", "Term Frequency - Inverse Document Frequency(TF-IDF)"))
if file_type == "One-Hot Vectorization":
st.title(":red[One-Hot Vectorization]")
st.markdown("""
### 📌 What is One-Hot Vectorization?
- It is a type of vectorization technique where text is converted into a numerical vector.
- This technique helps in representing words as unique vectors for machine learning models.
""")
st.markdown("""
### 🛠️ Steps in One-Hot Vectorization:
- Create a Vocabulary ➡️ (A set of all unique words in the collected corpus).
- Find the Length of Vocabulary ➡️ (Total number of unique words = d-dimensions).
- Convert Each Word into a Vector:
- Every unique word is transformed into a vector.
- Each vector has d-dimensions, where each dimension corresponds to a unique word.
- Words are converted individually, and then combined to form a vector.
This technique ensures that each word is treated uniquely and efficiently in NLP tasks.
""")
st.markdown("""
- Each word gets a unique vector representation.
- The number of dimensions = total vocabulary size.
- Words are vectorized separately, then combined into document vectors.
""")
st.markdown("""
| **Word** | **Vector Representation** |
|----------|--------------------------|
| **toy** | [1,0,0,0,0] |
| **is** | [0,1,0,0,0] |
| **good** | [0,0,1,0,0] |
| **not** | [0,0,0,1,0] |
| **bad** | [0,0,0,0,1] |
""", unsafe_allow_html=True)
st.markdown("""
- d₁ → v₁ → `[[1,0,0,0,0] , [0,1,0,0,0] , [0,0,1,0,0]]`
- d₂ → v₂ → `[[1,0,0,0,0] , [0,1,0,0,0] , [0,0,0,1,0] , [0,0,1,0,0]]`
- d₃ → v₃ → `[[0,0,0,0,1], [1,0,0,0,0]]`
This One-Hot Vectorization technique converts words into numerical vectors while preserving their uniqueness.
""")
st.markdown("""
### Key Takeaways:
- Each word is represented as a 5-dimensional vector.
- Every dimension corresponds to a unique word in the vocabulary.
- This method is useful for transforming text into a numerical format for Machine Learning tasks.
""")
st.subheader(":red[Advantages]")
st.markdown('''
- One-Hot Vectorization is easy to implement
''')
st.subheader(":red[Disadvantages]")
st.subheader(":blue[Different Document Length]")
st.markdown('''
- 1.Every document have different no.of words (here we're not converting document to vector , we're converting word to vector)
- We can't convert into tabular data
- It would be possible to convert into tabular data when we're converting document into vector(this is solved by Bag of Words(BOW))
''')
st.subheader(":blue[Sparsity]")
st.markdown('''
- The vector which is created using one-hot vectorization gives sparse vector
- Entire data is given to any alogorithm and machine is going to learn fom data and algorithm it is baised towards zero values as the data is sparse data
- This issue in ML is known as overfitting
- It is solved in Deep learning
''')
st.subheader(":blue[Curse of Dimensionality]")
st.markdown('''
- Document increases ↑ Vocabulary ↑ and vector increases ↑ dimensionality also increases ↑
- Ml performance decreases ↓ - as the dimensionality totally depends on vocabulary and it shootup as the document increases and different
''')
st.subheader(":blue[Out of Vocabulary Issue]")
st.markdown('''
- Document only converted during training time and we're giving our own dataset
- If the word is not present in our dataset while training it can't convert into vector format results in key error
- This is solved by Fasttext
''')
st.subheader(":blue[Inability to Preserve Semantic Meaning]")
st.markdown('''
- While converting text → vector format (same relationship should be preserved)
- We need to convert document into vector in such a way that semantic relationship should be preserved
- Similarity ⬆️ and Distance ⬇️
- Similarity ∝ 1 / Distance
- Distance between vectors should be very small
- If this is satisfied then the technique has good semantic meaning
''')
st.subheader(":blue[Lack of Sequential Information]")
st.markdown('''
- Sequential information is not preserved
''')
elif file_type == "Bag of Words(BOW)":
st.title(":red[Bag of Words(BOW)]")
st.markdown("""
### 📌 What is Bag of Words(BOW)?
- It is a type of vectorization technique where text is converted into a numerical vector.
- To overcome the problem of different document length(can't convert into tabular data) BOW is implemented.
""")
st.markdown("""
### 🛠️ Steps in Bag of Words(BOW):
- Create a Vocabulary ➡️ (A set of all unique words in the collected corpus).
- Find the Length of Vocabulary ➡️ (Total number of unique words = d-dimensions).
- Each document is converted into vector which is in d- dimension
- Every dimeension belongs to a unique word
- Bag of Words is actually interested in how many times the word is occuring
- If the two documents are same they will find out a similarity based on same words repeating in 2 different documents
- By converting into documents into vectors we can concatenate all vectors to form tabular data
- where roes are documents and columns represent features which are unique words
- Every dimension value will be count
- how many times the word is occuring in document
""")
st.markdown(
"<div class='corpus-box'>"
"<strong>Document 1:</strong> I love cricket I <br>"
"<strong>Document 2:</strong> I hate cricket <br>"
"<strong>Document 3:</strong> I like cricket"
"</div>",
unsafe_allow_html=True,
)
st.subheader(":green[Unique Words (Vocabulary)]")
st.markdown(
"<p class='content'>The set of unique words in our corpus is: <strong>{I, love, cricket, hate, like}</strong>. "
"This set forms the vocabulary, and the number of unique words determines the vector dimensions.</p>",
unsafe_allow_html=True,
)
st.subheader(":green[Word Count Representation]")
st.markdown(
"<p class='content'>Each document is converted into a numerical vector by counting the occurrences of words "
"from the vocabulary within each document.</p>",
unsafe_allow_html=True,
)
st.markdown(
"<div class='vector-box'><strong>Vector Representation:</strong><br>"
"Document 1 ➝ [2,1,1,0,0] (I = 2, love = 1, cricket = 1, hate = 0, like = 0)<br>"
"Document 2 ➝ [1,0,1,1,0] (I = 1, love = 0, cricket = 1, hate = 1, like = 0)<br>"
"Document 3 ➝ [1,0,1,0,1] (I = 1, love = 0, cricket = 1, hate = 0, like = 1)"
"</div>",
unsafe_allow_html=True,
)
st.subheader(":green[Tabular Representation]")
st.markdown(
"<p class='content'>Since all three vectors have the same number of dimensions, we can merge them into a tabular format:</p>",
unsafe_allow_html=True,
)
st.subheader(":red[Advantages]")
st.markdown('''
- Bag of Words(BOW) is easy to implement
- Here we can convert the data into tabular data
''')
st.subheader(":red[Disadvantages]")
st.subheader(":blue[Curse of Dimensionality]")
st.markdown('''
- Document increases ↑ Vocabulary ↑ and vector increases ↑ dimensionality also increases ↑
- Ml performance decreases ↓ - as the dimensionality totally depends on vocabulary and it shootup as the document increases and different
- As the corpus increases , vocabulary increases -- dimensionality increses
''')
st.subheader(":blue[Sparsity]")
st.markdown('''
- The vector which is created using BOW gives sparse vector
- Entire data is given to any alogorithm and machine is going to learn fom data and algorithm it is baised towards zero values as the data is sparse data
- This issue in ML is known as overfitting
- It is solved in Deep learning
''')
st.subheader(":blue[Out of Vocabulary Issue]")
st.markdown('''
- Document only converted during training time and we're giving our own dataset
- If the word is not present in our dataset while training it can't convert into vector format results in key error
- This is solved by Fasttext
''')
st.subheader(":blue[Inability to Preserve Semantic Meaning]")
st.markdown('''
- It can't completely preserve semantic meaning (slightly preserves it)
- Here based on count(no.of times the particular word is occuring) it can sometimes preserve semantic meaning
- Based on uniqueness of the words the semantic meaning is preserved
- More the uniqueness , more the documents will be far away
- Less no.of unique words , it'll be close to each other
''')
st.subheader(":blue[Lack of Sequential Information]")
st.markdown('''
- Sequential information is not preserved
''')
st.code('''
from sklearn.feature_extraction.text import CountVectorizer
corpus = pd.DataFrame({"Review":["biryani is is is good","biryani is not good","biryani is too costly"]})
## object of the CountVectorizer class
cv = CountVectorizer(lowercase=True,strip_accents="unicode",analyzer="word",stop_words=stp,token_pattern=r"((?u)\b\w\w+\b))")
cv.fit(corpus["Review"]) ### learning vocabulary
vector = cv.transform(corpus["Review"]) ### it converts into vector form based on cv and vocabulary learned
cv.get_feature_names_out()
cv.vocabulary_
vector.toarray()
''')
st.header("Binary Bag of Words(BBOW)")
st.markdown('''
- Extension of Bag of Words(BOW) is Binary Bag of Words(BBOW)
''')
st.markdown("""
### 🛠️ Steps in Binary Bag of Words(BBOW):
- Create a vocabulary (set of unique words)
- Each document is converted into vector form(d-dimension)
- In bag of words the value is count , but in binary bag of words it tells whether the word is preseent or not
- So, that it is way more easier to find the distance between vectors (here distance is nothing but no.of unique words)
- If the unique words are more --> distance is high
- Calculation of distance will be way more faster than bag of words
- distance is total no.of unique words between two documents
""")
elif file_type == "Term Frequency - Inverse Document Frequency(TF-IDF)":
st.title(":red[Term Frequency - Inverse Document Frequency(TF-IDF)]")
st.markdown("""
### 📌 What is TF-IDF ?
- It is a type of vectorization technique where text is converted into a numerical vector.
""")
st.subheader(":violet[🛠️ Steps in TF-IDF]")
st.markdown(
"""
<ul>
<li><strong>Create a vocabulary:</strong> A set of unique words from the corpus.</li>
<li><strong>Convert each document into a vector:</strong> A d-dimensional representation.</li>
<li><strong>Calculate Term Frequency (TF):</strong> Measures the importance of a word within a document.</li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown("<div class='formula'>TF(wᵢ, dᵢ) = (Occurrences of wᵢ in dᵢ) / (Total words in dᵢ)</div>", unsafe_allow_html=True)
st.markdown(
"""
<ul>
<li><strong>Compute Inverse Document Frequency (IDF):</strong> Measures how important a word is across all documents.</li>
<li><strong>For every word in the vocabulary, apply IDF:</strong></li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown("<div class='formula'>IDF(wᵢ, C) = log(N/n)</div>", unsafe_allow_html=True)
st.markdown(
"""
- <strong>N:</strong> Total number of documents in the corpus.<br>
- <strong>n:</strong> Number of documents containing the word wᵢ.<br>
- TF-IDF helps in understanding word significance while reducing the impact of commonly used words.
""",
unsafe_allow_html=True,
)
st.markdown("<h1 class='title'>📌 Example of TF-IDF</h1>", unsafe_allow_html=True)
st.markdown(
"""
<div class='box'>
<strong>Given a corpus with 3 documents:</strong><br><br>
<strong>d1:</strong> w1, w2, w3, w1 → v1 <br>
<strong>d2:</strong> w1, w2, w2, w3, w4, w2, w3 → v2 <br>
<strong>d3:</strong> w1, w5 → v3 <br><br>
<strong>Vocabulary:</strong> {w1, w2, w3, w4, w5} <br>
<strong>Vocabulary Size:</strong> 5 (d-dimension)
</div>
""",
unsafe_allow_html=True,
)
st.markdown("<h2 style='color: #6A0572;'>📊 Term Frequency (TF) Calculation</h2>", unsafe_allow_html=True)
st.markdown(
"""
<ul>
<li>TF measures how often a word appears in a document.</li>
<li>Formula: <span class='highlight'>TF(wᵢ, dᵢ) = (Occurrences of wᵢ in dᵢ) / (Total words in dᵢ)</span></li>
<li>TF values change based on the document.</li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<div class='formula'>
TF(w1, d1) = 2/4 = 0.5 <br>
TF(w2, d1) = 1/4 = 0.25 <br>
TF(w3, d1) = 1/4 = 0.25 <br>
TF(w4, d1) = 0/4 = 0 <br>
TF(w5, d1) = 0/4 = 0 <br>
</div>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<ul>
<li>TF values always range from <strong>0 to 1</strong>.</li>
<li>Case-1: <span class='highlight'>TF = 0</span> → Word is not present in the document.</li>
<li>Case-2: <span class='highlight'>TF = 1</span> → Word is the only word in the document.</li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown("<h2 style='color: #6A0572;'>📉 Inverse Document Frequency (IDF) Calculation</h2>", unsafe_allow_html=True)
st.markdown(
"""
<ul>
<li>IDF measures how important a word is across the entire corpus.</li>
<li>Formula: <span class='highlight'>IDF(wᵢ, C) = log(N/n)</span></li>
<li>N = Total number of documents.</li>
<li>n = Number of documents containing wᵢ.</li>
<li>IDF values range from <strong>0 to ∞</strong>.</li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown("<h2 style='color: #6A0572;'>📌 TF-IDF Calculation</h2>", unsafe_allow_html=True)
st.markdown(
"""
<ul>
<li>We calculate TF-IDF by multiplying TF and IDF values.</li>
<li>Formula: <span class='highlight'>TF-IDF = TF * IDF</span></li>
<li>TF-IDF helps reduce the impact of frequent words while keeping rare words important.</li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<div class='formula'>
d1 → v1 = [0, 0.04, 0.04, 0, 0] (TF * IDF values)
</div>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
- The final TF-IDF values may be low, high, or even zero depending on term frequency and document frequency.
""",
unsafe_allow_html=True,
)
st.markdown("<h1 class='title'>📌 TF-IDF Key Insights</h1>", unsafe_allow_html=True)
st.markdown(
"""
<h3 style='color: #6A0572;'>📈 Case 1: High TF-IDF Values</h3>
<ul>
<li>If the word appears <strong>frequently</strong> in a document → <span class='highlight'>High TF-IDF</span></li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<h3 style='color: #6A0572;'>📉 Case 2: Low TF-IDF Values</h3>
<ul>
<li>If the word appears <strong>rarely</strong> in a document → <span class='highlight'>Low TF-IDF</span></li>
<li>TF is always in the range: <strong>[0 - 1]</strong></li>
<li>IDF is in the range: <strong>[0 - ∞)</strong></li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<h3 style='color: #6A0572;'>📊 Understanding TF (Term Frequency)</h3>
<ul>
<li>TF gives <strong>more importance</strong> to words that occur <strong>frequently</strong> in a document.</li>
<li>As the word frequency <span class='highlight'>increases</span> → TF <span class='highlight'>increases</span>.</li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<h3 style='color: #6A0572;'>📉 Understanding IDF (Inverse Document Frequency)</h3>
<ul>
<li>IDF Formula: <span class='highlight'>IDF(wᵢ, C) = log(N/n)</span></li>
<li><strong>N:</strong> Total number of documents</li>
<li><strong>n:</strong> Number of documents containing the word</li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<div class='formula'>
<strong>When n is small:</strong> <br>
- N/n increases → log(N/n) increases ⬆️ <br>
- Word is rare in the corpus → Higher importance in IDF <br><br>
<strong>When n is large:</strong> <br>
- N/n decreases → log(N/n) decreases ⬇️ <br>
- Word is common → Lower importance in IDF <br><br>
<strong>When N = n:</strong> log(N/n) = 0 (word appears in every document)
</div>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<h3 style='color: #6A0572;'>📌 TF-IDF Calculation</h3>
<ul>
<li><strong>TF</strong> focuses on words <strong>frequent</strong> in a document.</li>
<li><strong>IDF</strong> focuses on words <strong>rare</strong> in the corpus.</li>
<li><span class='highlight'>TF-IDF is high</span> for words that appear <strong>often in a document</strong> but <strong>rarely in the corpus</strong>.</li>
</ul>
""",
unsafe_allow_html=True,
)
st.subheader(":red[Why log is used]")
st.markdown("<h1 class='title'>📌 Understanding TF-IDF Scaling</h1>", unsafe_allow_html=True)
st.markdown(
"""
<h3 style='color: #6A0572;'> Minimum and Maximum Values of N/n</h3>
<ul>
<li>When <strong>n is maximum</strong> → <span class='highlight'>N/n = 1</span></li>
<li>At <strong>training time</strong>: <span class='highlight'>1 ≤ n ≤ N</span></li>
<li>At <strong>test time</strong>: <span class='highlight'>0 ≤ n ≤ N</span> (due to Out-of-Vocabulary words)</li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<h3 style='color: #6A0572;'> IDF Dominance Over TF</h3>
<ul>
<li>If <strong>n decreases</strong> → <span class='highlight'>N/n increases (max)</span></li>
<li>TF scale is very <span class='highlight'>small</span>, but IDF scale is very <span class='highlight'>high</span></li>
<li>IDF can <span class='highlight'>dominate</span> TF, favoring rare words over frequent ones</li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<h3 style='color: #6A0572;'>How Log Solves IDF Dominance?</h3>
<ul>
<li>Applying <span class='highlight'>log</span> reduces the dominance of IDF</li>
<li>Logarithm <span class='highlight'>rounds off</span> values to a balanced scale</li>
<li>It prevents bias towards rare words and maintains proportionality</li>
</ul>
""",
unsafe_allow_html=True,
)
st.markdown(
"""
<div class='formula'>
<strong>TF balances frequent words, while log(IDF) prevents rare-word dominance! 🚀</strong>
</div>
""",
unsafe_allow_html=True,
)
st.subheader(":red[Advantages]")
st.markdown('''
- Easy to implement
- Can convert into tabular format
- It gives importance to both frequently occuring word and rarely occuring in corpus
''')
st.subheader(":red[Disadvantages]")
st.subheader(":blue[Curse of Dimensionality]")
st.markdown('''
- Document increases ↑ Vocabulary ↑ and vector increases ↑ dimensionality also increases ↑
- Ml performance decreases ↓ - as the dimensionality totally depends on vocabulary and it shootup as the document increases and different
- As the corpus increases , vocabulary increases -- dimensionality increses
''')
st.subheader(":blue[Sparsity]")
st.markdown('''
- The vector which is created using BOW gives sparse vector
- Entire data is given to any alogorithm and machine is going to learn fom data and algorithm it is baised towards zero values as the data is sparse data
- This issue in ML is known as overfitting
- It is solved in Deep learning
''')
st.subheader(":blue[Out of Vocabulary Issue]")
st.markdown('''
- Document only converted during training time and we're giving our own dataset
- If the word is not present in our dataset while training it can't convert into vector format results in key error
- This is solved by Fasttext
''')
st.subheader(":blue[Inability to Preserve Semantic Meaning]")
st.markdown('''
- It slightly preserves semantic meaning
''')
st.subheader(":blue[Lack of Sequential Information]")
st.markdown('''
- Sequential information is not preserved
- Because in TF-IDF we're giving importance to words as we're doing word tokenization
- In ML no algorithm is capable of preserving sequential information
- This is only solved by Deep-learning concept
- But by applying a trick to BOW/BBOW/TF-IDF we can slightly preserve sequential information
- That technique is known as n-gram
''')
st.header(":red[n-gram]")
st.markdown('''
- n-gram default will always be 1-gram in BOW/BBOW/TF-IDF
- Based on n-gram onlt it can create a vocabulary
- n- gram is mostly used upto 1,2,3 gram only because as dimension increases ML performance decreases
- n-gram is used to slightly preserve sequential information
''')
st.code('''
from sklearn.feature_extraction.text import TfidfVectorizer\
corpus = pd.DataFrame({"Review":["biryani is is is is résume is good","biryani biryani biryani is not good","biryani is too costly"]})
tf = TfidfVectorizer()
vector = tf.fit_transform(corpus["Review"])
vector.toarray()
tf.vocabulary_
''')