Update app.py
Browse files
app.py
CHANGED
|
@@ -1,52 +1,55 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from textblob import TextBlob
|
| 3 |
-
import spacy
|
| 4 |
-
from collections import Counter
|
| 5 |
-
|
| 6 |
-
# Load Spacy model
|
| 7 |
-
nlp = spacy.load("en_core_web_sm")
|
| 8 |
|
| 9 |
# App title
|
| 10 |
-
st.title("NLP Blog
|
| 11 |
-
|
| 12 |
-
# Sidebar
|
| 13 |
-
st.sidebar.title("
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
# Footer
|
| 50 |
st.sidebar.write("---")
|
| 51 |
st.sidebar.write("Developed with ❤️ using Streamlit.")
|
| 52 |
-
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
# App title
|
| 4 |
+
st.title("NLP Theory Blog")
|
| 5 |
+
|
| 6 |
+
# Sidebar for navigation
|
| 7 |
+
st.sidebar.title("Navigation")
|
| 8 |
+
pages = ["Introduction to NLP", "NLP Techniques"]
|
| 9 |
+
page = st.sidebar.radio("Go to:", pages)
|
| 10 |
+
|
| 11 |
+
# Content for each page
|
| 12 |
+
if page == "Introduction to NLP":
|
| 13 |
+
st.header("What is Natural Language Processing (NLP)?")
|
| 14 |
+
st.write("""
|
| 15 |
+
Natural Language Processing (NLP) is a field of Artificial Intelligence that focuses on the interaction between computers and humans through natural language.
|
| 16 |
+
It enables machines to understand, interpret, and respond to human language in a meaningful way.
|
| 17 |
+
|
| 18 |
+
**Applications of NLP include:**
|
| 19 |
+
- Sentiment Analysis
|
| 20 |
+
- Machine Translation
|
| 21 |
+
- Chatbots
|
| 22 |
+
- Speech Recognition
|
| 23 |
+
|
| 24 |
+
NLP combines computational linguistics with machine learning and deep learning techniques to process language.
|
| 25 |
+
""")
|
| 26 |
+
|
| 27 |
+
elif page == "NLP Techniques":
|
| 28 |
+
st.header("Common NLP Techniques")
|
| 29 |
+
st.write("""
|
| 30 |
+
NLP involves several techniques for processing and analyzing text and speech data. Here are some key techniques:
|
| 31 |
+
|
| 32 |
+
1. **Tokenization:** Breaking text into smaller units like words or sentences.
|
| 33 |
+
2. **Stopword Removal:** Eliminating common words (e.g., 'the', 'is') that may not contribute to meaning.
|
| 34 |
+
3. **Stemming and Lemmatization:** Reducing words to their base or root form.
|
| 35 |
+
4. **Part-of-Speech (POS) Tagging:** Identifying grammatical parts of speech in a text.
|
| 36 |
+
5. **Named Entity Recognition (NER):** Extracting named entities like people, organizations, and locations.
|
| 37 |
+
6. **Sentiment Analysis:** Determining the sentiment (positive, negative, neutral) of a text.
|
| 38 |
+
7. **Text Summarization:** Producing a summary of a longer text.
|
| 39 |
+
8. **Machine Translation:** Translating text from one language to another.
|
| 40 |
+
|
| 41 |
+
These techniques are often used in combination to build sophisticated NLP applications.
|
| 42 |
+
""")
|
| 43 |
+
|
| 44 |
+
# Pagination buttons
|
| 45 |
+
if st.button("Previous Page"):
|
| 46 |
+
if page == "NLP Techniques":
|
| 47 |
+
st.experimental_set_query_params(page=pages[0])
|
| 48 |
+
|
| 49 |
+
if st.button("Next Page"):
|
| 50 |
+
if page == "Introduction to NLP":
|
| 51 |
+
st.experimental_set_query_params(page=pages[1])
|
| 52 |
|
| 53 |
# Footer
|
| 54 |
st.sidebar.write("---")
|
| 55 |
st.sidebar.write("Developed with ❤️ using Streamlit.")
|
|
|