Update app.py
Browse files
app.py
CHANGED
|
@@ -1,138 +1,304 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
|
| 4 |
-
st.
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
st.
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
st.
|
| 18 |
-
st.
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
st.
|
| 22 |
-
|
| 23 |
-
st.
|
| 24 |
-
st.
|
| 25 |
-
|
| 26 |
-
st.
|
| 27 |
-
st.
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
st.
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
st.write(
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
-
|
| 88 |
-
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
**
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
-
|
| 126 |
-
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
+
# Sidebar for navigation
|
| 4 |
+
sidebar = st.sidebar
|
| 5 |
+
|
| 6 |
+
# Sidebar header
|
| 7 |
+
sidebar.header('🌐 NLP Navigation')
|
| 8 |
+
|
| 9 |
+
# Sidebar options for NLP Overview, Lifecycle, and Techniques
|
| 10 |
+
sidebar_option = sidebar.radio('Choose a section to explore:', ['What is NLP?', 'NLP Lifecycle', 'NLP Techniques'])
|
| 11 |
+
|
| 12 |
+
# Store the selected page in session state
|
| 13 |
+
if 'selected_page' not in st.session_state:
|
| 14 |
+
st.session_state.selected_page = sidebar_option
|
| 15 |
+
|
| 16 |
+
# Update the selected page if the user selects a different option
|
| 17 |
+
if sidebar_option != st.session_state.selected_page:
|
| 18 |
+
st.session_state.selected_page = sidebar_option
|
| 19 |
+
|
| 20 |
+
# Dynamically update the title based on the selected option
|
| 21 |
+
if st.session_state.selected_page == 'What is NLP?':
|
| 22 |
+
st.title('🤖 What is Natural Language Processing (NLP)?')
|
| 23 |
+
elif st.session_state.selected_page == 'NLP Lifecycle':
|
| 24 |
+
st.title('🔄 Natural Language Processing (NLP) Lifecycle')
|
| 25 |
+
if sidebar_option == 'Problem Definition':
|
| 26 |
+
st.title('🔧 Steps in the Natural Language Processing (NLP) lifecycle:')
|
| 27 |
+
elif st.session_state.selected_page == 'NLP Techniques':
|
| 28 |
+
st.title('⚙️ Techniques in Natural Language Processing (NLP)')
|
| 29 |
+
|
| 30 |
+
# Content for "What is NLP?"
|
| 31 |
+
if st.session_state.selected_page == 'What is NLP?':
|
| 32 |
+
st.write("""
|
| 33 |
+
### 🤖 What is NLP?
|
| 34 |
+
Natural Language Processing (NLP) is a subfield of artificial intelligence (AI) that focuses on the interaction between computers and human (natural) languages. The goal of NLP is to enable machines to understand, interpret, and generate human language in a way that is meaningful.
|
| 35 |
+
|
| 36 |
+
NLP is essential for enabling computers to process and analyze large amounts of natural language data, such as:
|
| 37 |
+
- 📜 Text from documents
|
| 38 |
+
- 🗣️ Speech from conversations
|
| 39 |
+
- 🖼️ Images with textual descriptions
|
| 40 |
+
#### Key Components of NLP:
|
| 41 |
+
- **Syntax**: Refers to the arrangement of words in a sentence.
|
| 42 |
+
- **Semantics**: Focuses on the meaning of the words and sentences.
|
| 43 |
+
- **Pragmatics**: Involves the context and intent behind language.
|
| 44 |
+
- **Discourse**: Studies how previous sentences and context influence meaning.
|
| 45 |
+
#### Example Applications of NLP:
|
| 46 |
+
- **Machine Translation**: Automatic translation of text from one language to another (e.g., Google Translate).
|
| 47 |
+
- **Speech Recognition**: Converting spoken language into text (e.g., Siri, Alexa).
|
| 48 |
+
- **Sentiment Analysis**: Analyzing text to determine the sentiment (positive, negative, neutral) (e.g., analyzing customer reviews).
|
| 49 |
+
- **Text Summarization**: Creating a short summary of a long text (e.g., summarizing articles).
|
| 50 |
+
NLP is used across multiple domains like healthcare, finance, and customer service to automate and improve various tasks.
|
| 51 |
+
""")
|
| 52 |
+
|
| 53 |
+
# Content for NLP Lifecycle
|
| 54 |
+
elif st.session_state.selected_page == "NLP Lifecycle":
|
| 55 |
+
lifecycle_option = sidebar.radio("Select NLP Lifecycle Step:", [
|
| 56 |
+
"Overview of the NLP Life Cycle",
|
| 57 |
+
"Problem Definition",
|
| 58 |
+
"Data Collection",
|
| 59 |
+
"Text Preprocessing",
|
| 60 |
+
"Text Representation",
|
| 61 |
+
"Model Training",
|
| 62 |
+
"Evaluation",
|
| 63 |
+
"Deployment"
|
| 64 |
+
])
|
| 65 |
+
|
| 66 |
+
if lifecycle_option == "Overview of the NLP Life Cycle":
|
| 67 |
+
st.write("""
|
| 68 |
+
#### 🔄 Overview of the NLP Life Cycle
|
| 69 |
+
The NLP life cycle is a structured process for building, using, and maintaining systems that work with human language. It turns unstructured text into meaningful insights or automated actions. This process ensures continuous improvement and adapts to real-world needs.
|
| 70 |
+
|
| 71 |
+
- **How It Flows**:
|
| 72 |
+
- The process starts with identifying the problem and collecting the required text data.
|
| 73 |
+
- Then, the data is cleaned and prepared for analysis.
|
| 74 |
+
- Models are built and tested before being deployed for use.
|
| 75 |
+
- Regular checks and updates ensure the solution keeps working well.
|
| 76 |
+
|
| 77 |
+
- **Flexible and Adaptive**:
|
| 78 |
+
- Since languages and data change (e.g., new words, trends), the process is repeated as needed.
|
| 79 |
+
- Models may need updates or retraining to stay accurate.
|
| 80 |
+
|
| 81 |
+
- **Combines Different Fields**:
|
| 82 |
+
- The process involves skills from language studies, programming, and data analysis to make sure language is understood effectively.
|
| 83 |
+
|
| 84 |
+
- **Designed for Practical Use**:
|
| 85 |
+
- The goal is to create solutions that can handle tasks like analyzing text, identifying emotions, powering chatbots, or translating languages accurately and efficiently.
|
| 86 |
+
|
| 87 |
+
- **Key Challenges Solved**:
|
| 88 |
+
- Managing the complexity of language (e.g., meaning, structure).
|
| 89 |
+
- Working with large and messy datasets.
|
| 90 |
+
- Handling multiple languages and specific industries.
|
| 91 |
+
- Ensuring solutions are fast and efficient.
|
| 92 |
+
|
| 93 |
+
#### Steps in the NLP Life Cycle:
|
| 94 |
+
1. Problem Definition
|
| 95 |
+
2. Data Collection
|
| 96 |
+
3. Data Preprocessing
|
| 97 |
+
4. Feature Engineering
|
| 98 |
+
5. Model Selection and Training
|
| 99 |
+
6. Model Evaluation
|
| 100 |
+
7. Model Tuning
|
| 101 |
+
8. Deployment
|
| 102 |
+
9. Monitoring and Maintenance
|
| 103 |
+
""")
|
| 104 |
+
|
| 105 |
+
elif lifecycle_option == "Problem Definition":
|
| 106 |
+
st.write("""
|
| 107 |
+
#### 🔧 1. Problem Definition
|
| 108 |
+
- The first step in the NLP lifecycle is defining the problem. This means understanding the goal and figuring out how NLP can help solve the problem.
|
| 109 |
+
- Based on the problem, you will need to gather the data.
|
| 110 |
+
- **To better understand the problem, consider asking questions such as**:
|
| 111 |
+
- 🎯 What is the main goal of this analysis?
|
| 112 |
+
- 📝 What kind of text data are we working with (e.g., reviews, social media posts, documents)?
|
| 113 |
+
- 📊 What do we want the output to be (e.g., sentiment score, summary, or classification)?
|
| 114 |
+
|
| 115 |
+
**Example of a problem statement**: The goal could be to classify customer reviews as either positive or negative, or to find the main topics in product reviews.
|
| 116 |
+
""")
|
| 117 |
+
|
| 118 |
+
elif lifecycle_option == "Data Collection":
|
| 119 |
+
st.write("""
|
| 120 |
+
#### 2. Data Collection
|
| 121 |
+
Data collection is the second step in the NLP lifecycle. It involves gathering data from various sources based on the problem statement, so it can be analyzed and processed.
|
| 122 |
+
- **Sources for data collection**:
|
| 123 |
+
- 📚 The data should be collected based on a clear understanding of the problem statement.
|
| 124 |
+
- 🌐 From datasets available on websites like Kaggle.
|
| 125 |
+
- 🔌 Through APIs.
|
| 126 |
+
- 🕸️ Web scraping can also be used to gather data from websites using tools like Selenium or BeautifulSoup.
|
| 127 |
+
- ✋ Manually, when needed.
|
| 128 |
+
- In most cases, data is collected from websites, APIs, or through web scraping. However, manual collection may be necessary in rare cases.
|
| 129 |
+
**Example**: Scraping customer reviews from Amazon to analyze sentiment and feedback about a product.
|
| 130 |
+
""")
|
| 131 |
+
|
| 132 |
+
elif lifecycle_option == "Text Preprocessing":
|
| 133 |
+
st.write("""
|
| 134 |
+
#### 🧹 3. Text Preprocessing
|
| 135 |
+
Text preprocessing prepares raw text for further analysis. This stage involves cleaning and transforming the data into a structured format that machine learning models can understand.
|
| 136 |
+
- **Tokenization**: Splitting text into smaller units (e.g., words, phrases).
|
| 137 |
+
- **Stop Words Removal**: Removing common words that don’t contribute much information.
|
| 138 |
+
- **Lemmatization**: Converting words into their base or dictionary form.
|
| 139 |
+
- **Stemming**: Cutting off prefixes or suffixes from words.
|
| 140 |
+
- **Lowercasing**: Converting all characters in the text to lowercase.
|
| 141 |
+
**Example**: For the sentence "The quick brown fox is running fast", after preprocessing:
|
| 142 |
+
- Tokenization: ["The", "quick", "brown", "fox", "is", "running", "fast"]
|
| 143 |
+
- Stop Words Removal: ["quick", "brown", "fox", "running", "fast"]
|
| 144 |
+
- Lemmatization: ["quick", "brown", "fox", "run", "fast"]
|
| 145 |
+
""")
|
| 146 |
+
|
| 147 |
+
elif lifecycle_option == "Text Representation":
|
| 148 |
+
st.write("""
|
| 149 |
+
#### 📝 4. Text Representation
|
| 150 |
+
After preprocessing, the text data needs to be converted into a numerical format for use in machine learning models. There are several methods for text representation:
|
| 151 |
+
- **Bag of Words (BoW)**: Converts text into a matrix of word frequencies.
|
| 152 |
+
- **TF-IDF**: Weighs words based on their frequency in a specific document relative to their frequency across the entire dataset.
|
| 153 |
+
- **Word Embeddings**: Transforms words into dense vectors that capture semantic meaning.
|
| 154 |
+
**Example**: Using BoW to convert the sentence "I love NLP" into a vector representation:
|
| 155 |
+
- Vocabulary: ["I", "love", "NLP"]
|
| 156 |
+
- Vector: [1, 1, 1] (word frequency representation)
|
| 157 |
+
""")
|
| 158 |
+
|
| 159 |
+
elif lifecycle_option == "Model Training":
|
| 160 |
+
st.write("""
|
| 161 |
+
#### 🏋️♂️ 5. Model Training
|
| 162 |
+
In the model training stage, machine learning algorithms are trained on the preprocessed and represented text data. The choice of model depends on the task:
|
| 163 |
+
- **Text Classification**: Naive Bayes, Support Vector Machines (SVM), or neural networks.
|
| 164 |
+
- **Named Entity Recognition (NER)**: Conditional Random Fields (CRF), LSTMs, or transformers.
|
| 165 |
+
- **Sentiment Analysis**: Logistic regression, Naive Bayes, or transformer-based models like BERT.
|
| 166 |
+
**Example**: Training a Naive Bayes classifier to categorize news articles into topics such as "Sports", "Politics", etc.
|
| 167 |
+
""")
|
| 168 |
+
|
| 169 |
+
elif lifecycle_option == "Evaluation":
|
| 170 |
+
st.write("""
|
| 171 |
+
#### 🏅 6. Evaluation
|
| 172 |
+
After training the model, it's important to evaluate its performance using metrics such as accuracy, precision, recall, and F1-score.
|
| 173 |
+
- **Accuracy**: The percentage of correct predictions.
|
| 174 |
+
- **Precision**: The percentage of relevant instances among the retrieved instances.
|
| 175 |
+
- **Recall**: The percentage of relevant instances that were retrieved.
|
| 176 |
+
- **F1-score**: The harmonic mean of precision and recall.
|
| 177 |
+
|
| 178 |
+
**Example**: If a sentiment analysis model predicts positive sentiment in 80 out of 100 reviews, its accuracy is 80%.
|
| 179 |
+
""")
|
| 180 |
+
|
| 181 |
+
elif lifecycle_option == "Deployment":
|
| 182 |
+
st.write("""
|
| 183 |
+
#### 🚀 7. Deployment
|
| 184 |
+
The final step is deploying the model for real-time use. This involves integrating it into a system or application where it can process live data.
|
| 185 |
+
- **Real-time Applications**: Chatbots, sentiment analysis for social media monitoring, text summarization for news.
|
| 186 |
+
- **Maintenance**: Continuously monitor the model to ensure its performance remains high. Updates might be necessary if the language evolves or new data emerges.
|
| 187 |
+
|
| 188 |
+
**Example**: Deploying a chatbot to answer customer inquiries based on historical support tickets.
|
| 189 |
+
""")
|
| 190 |
+
|
| 191 |
+
# Content for NLP Techniques
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
# Content for "NLP Techniques"
|
| 196 |
+
elif st.session_state.selected_page == "NLP Techniques":
|
| 197 |
+
technique_option = sidebar.radio("Select NLP Technique:", [
|
| 198 |
+
"NLP Techniques",
|
| 199 |
+
"Tokenization",
|
| 200 |
+
"Stop Words Removal",
|
| 201 |
+
"Lemmatization",
|
| 202 |
+
"Stemming",
|
| 203 |
+
"Bag of Words (BoW)",
|
| 204 |
+
"TF-IDF",
|
| 205 |
+
"Word Embeddings",
|
| 206 |
+
"Named Entity Recognition (NER)",
|
| 207 |
+
"Part-of-Speech (POS) Tagging",
|
| 208 |
+
"Sentiment Analysis"
|
| 209 |
+
])
|
| 210 |
+
if technique_option == "NLP Techniques":
|
| 211 |
+
st.write("""
|
| 212 |
+
### ⚙️ Techniques in NLP
|
| 213 |
+
NLP uses a variety of techniques to process and analyze text data. Some of the most common techniques include:
|
| 214 |
+
|
| 215 |
+
1. **Tokenization**: Breaking down text into smaller units (e.g., words, sentences).
|
| 216 |
+
2. **Part-of-Speech (POS) Tagging**: Identifying the grammatical roles of words in a sentence (e.g., noun, verb, adjective).
|
| 217 |
+
3. **Named Entity Recognition (NER)**: Identifying entities such as names, dates, locations, etc.
|
| 218 |
+
4. **Dependency Parsing**: Analyzing the syntactic structure of sentences.
|
| 219 |
+
5. **Sentiment Analysis**: Analyzing the sentiment of text (positive, negative, neutral).
|
| 220 |
+
6. **Word Embeddings**: Representing words as vectors in a continuous space (e.g., Word2Vec, GloVe).
|
| 221 |
+
|
| 222 |
+
**Example**: Sentiment analysis can be used to identify whether customer reviews are positive, negative, or neutral based on the words used in the text.
|
| 223 |
+
""")
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
elif technique_option == "Tokenization":
|
| 227 |
+
st.write("""
|
| 228 |
+
#### 1. Tokenization
|
| 229 |
+
Tokenization is the process of splitting text into smaller units, such as words, sentences, or subwords. This is a key preprocessing step for many NLP tasks.
|
| 230 |
+
- **Example**:
|
| 231 |
+
- Sentence: "Natural Language Processing is awesome!"
|
| 232 |
+
- Tokenized words: ["Natural", "Language", "Processing", "is", "awesome"]
|
| 233 |
+
""")
|
| 234 |
+
|
| 235 |
+
elif technique_option == "Stop Words Removal":
|
| 236 |
+
st.write("""
|
| 237 |
+
#### 2. Stop Words Removal
|
| 238 |
+
Stop words are commonly used words like "the", "is", "at", etc., that do not carry much information in many NLP tasks. Removing stop words helps reduce the dimensionality and noise in the data.
|
| 239 |
+
- **Example**: Removing "is" from the sentence "NLP is amazing!"
|
| 240 |
+
""")
|
| 241 |
+
|
| 242 |
+
elif technique_option == "Lemmatization":
|
| 243 |
+
st.write("""
|
| 244 |
+
#### 3. Lemmatization
|
| 245 |
+
Lemmatization is the process of converting words into their root or base form based on context. It is more sophisticated than stemming, as it considers the meaning of words.
|
| 246 |
+
- **Example**: "better" → "good", "running" → "run".
|
| 247 |
+
""")
|
| 248 |
+
|
| 249 |
+
elif technique_option == "Stemming":
|
| 250 |
+
st.write("""
|
| 251 |
+
#### 4. Stemming
|
| 252 |
+
Stemming is the process of reducing words to their root form by removing prefixes or suffixes. This technique may result in non-dictionary words.
|
| 253 |
+
- **Example**: "running" → "run", "happiness" → "happi".
|
| 254 |
+
""")
|
| 255 |
+
|
| 256 |
+
elif technique_option == "Bag of Words (BoW)":
|
| 257 |
+
st.write("""
|
| 258 |
+
#### 5. Bag of Words (BoW)
|
| 259 |
+
The Bag of Words model represents text as a set of individual words, disregarding grammar and word order but keeping multiplicity. It is a simple and widely used method for text representation.
|
| 260 |
+
- **Example**:
|
| 261 |
+
- Text: "I love NLP"
|
| 262 |
+
- BoW: {"I": 1, "love": 1, "NLP": 1}
|
| 263 |
+
""")
|
| 264 |
+
|
| 265 |
+
elif technique_option == "TF-IDF":
|
| 266 |
+
st.write("""
|
| 267 |
+
#### 6. TF-IDF (Term Frequency-Inverse Document Frequency)
|
| 268 |
+
TF-IDF helps determine the importance of a word in a document relative to the entire dataset. It reduces the weight of common words and increases the weight of rare but important words.
|
| 269 |
+
- **Example**: The word "data" might have a high TF-IDF score in a document about data analysis but a low score in a document about cooking.
|
| 270 |
+
""")
|
| 271 |
+
|
| 272 |
+
elif technique_option == "Word Embeddings":
|
| 273 |
+
st.write("""
|
| 274 |
+
#### 7. Word Embeddings
|
| 275 |
+
Word embeddings are vector representations of words that capture semantic relationships. Words with similar meanings have similar vectors. Common word embedding models include:
|
| 276 |
+
- **Word2Vec**
|
| 277 |
+
- **GloVe**
|
| 278 |
+
- **FastText**
|
| 279 |
+
**Example**: The words "king" and "queen" would have similar vector representations because they share semantic relationships.
|
| 280 |
+
""")
|
| 281 |
+
|
| 282 |
+
elif technique_option == "Named Entity Recognition (NER)":
|
| 283 |
+
st.write("""
|
| 284 |
+
#### 8. Named Entity Recognition (NER)
|
| 285 |
+
NER is the task of identifying named entities such as persons, organizations, locations, and dates in text. This technique is commonly used for information extraction.
|
| 286 |
+
- **Example**: "Barack Obama was born in Hawaii."
|
| 287 |
+
- Entities: ["Barack Obama" (Person), "Hawaii" (Location)]
|
| 288 |
+
""")
|
| 289 |
+
|
| 290 |
+
elif technique_option == "Part-of-Speech (POS) Tagging":
|
| 291 |
+
st.write("""
|
| 292 |
+
#### 9. Part-of-Speech (POS) Tagging
|
| 293 |
+
POS tagging involves assigning grammatical labels (such as noun, verb, adjective) to each word in a sentence.
|
| 294 |
+
- **Example**: "The cat sat on the mat."
|
| 295 |
+
- POS Tags: [("The", "DT"), ("cat", "NN"), ("sat", "VBD"), ("on", "IN"), ("the", "DT"), ("mat", "NN")]
|
| 296 |
+
""")
|
| 297 |
+
|
| 298 |
+
elif technique_option == "Sentiment Analysis":
|
| 299 |
+
st.write("""
|
| 300 |
+
#### 10. Sentiment Analysis
|
| 301 |
+
Sentiment analysis involves determining the sentiment of a piece of text, typically categorizing it as positive, negative, or neutral. This is commonly used for customer feedback and social media monitoring.
|
| 302 |
+
- **Example**: "I love this product!" → Positive Sentiment
|
| 303 |
+
""")
|
| 304 |
+
|