Spaces:
Sleeping
Sleeping
Create pages/1_Data_Overview.py
Browse files- pages/1_Data_Overview.py +50 -0
pages/1_Data_Overview.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.title("π Data Collection & Preprocessing")
|
| 4 |
+
|
| 5 |
+
st.markdown("""
|
| 6 |
+
|
| 7 |
+
π **YouTube Comment Extraction**
|
| 8 |
+
|
| 9 |
+
β
Used **YouTube Data API v3** via the **requests** library and **API Key** authentication
|
| 10 |
+
|
| 11 |
+
πΉ Extracted comments from 150+ video IDs across balanced sentiment categories:
|
| 12 |
+
|
| 13 |
+
π’ **Positive:** "heartwarming reunion", "feel good moments"
|
| 14 |
+
|
| 15 |
+
π΄ **Negative:** "controversial incident", "bad customer experience"
|
| 16 |
+
|
| 17 |
+
βͺ **Neutral:** "tech reviews", "travel vlogs"
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
π Gathered over **15,000** top-level comments using pagination (nextPageToken)
|
| 21 |
+
|
| 22 |
+
πΎ Data saved into a **JSON** format with keys: **video_id** and **comment**
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
π§Ή **Text Preprocessing Steps**
|
| 29 |
+
|
| 30 |
+
β
Removed HTML tags, emojis, special characters, and links
|
| 31 |
+
|
| 32 |
+
π‘ Converted text to lowercase
|
| 33 |
+
|
| 34 |
+
π§½ Removed stopwords and non-alphabetic tokens
|
| 35 |
+
|
| 36 |
+
π§ Applied **tokenization**
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
The cleaned text was used to train our **sentiment classifier** in the next step.
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
""")
|
| 45 |
+
|
| 46 |
+
if st.button("Next"):
|
| 47 |
+
st.switch_page("pages/2_Model_Training.py")
|
| 48 |
+
|
| 49 |
+
if st.button("Go to Home"):
|
| 50 |
+
st.switch_page("app.py")
|