Spaces:
Sleeping
Sleeping
Emily Witko
commited on
Commit
·
45c8733
1
Parent(s):
4e07416
Restored topic modeling, keyword extraction, and summarization
Browse files
app.py
CHANGED
@@ -77,7 +77,19 @@ def analyze_demographics(file):
|
|
77 |
|
78 |
def analyze_why_columns(file):
|
79 |
df = pd.read_excel(file.name)
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
results = {}
|
83 |
|
@@ -110,7 +122,7 @@ def analyze_why_columns(file):
|
|
110 |
|
111 |
# Keyword Extraction
|
112 |
combined_text = " ".join(column_data)
|
113 |
-
word_list = re.findall(r"
|
114 |
bigram_vectorizer = CountVectorizer(ngram_range=(2, 3), stop_words='english')
|
115 |
bigram_counts = bigram_vectorizer.fit_transform([combined_text])
|
116 |
bigram_features = bigram_vectorizer.get_feature_names_out()
|
|
|
77 |
|
78 |
def analyze_why_columns(file):
|
79 |
df = pd.read_excel(file.name)
|
80 |
+
|
81 |
+
# Map column names to new labels
|
82 |
+
column_label_map = {
|
83 |
+
"Why? (optional)": "HF NPS Why?",
|
84 |
+
"Why? (optional.1)": "Support Team NPS Why?",
|
85 |
+
"Why? (optional.2)": "Productivity Why?"
|
86 |
+
}
|
87 |
+
|
88 |
+
# Rename columns in the DataFrame
|
89 |
+
df = df.rename(columns=column_label_map)
|
90 |
+
|
91 |
+
# Get the renamed columns that start with "Why"
|
92 |
+
why_columns = [col for col in df.columns if col in column_label_map.values()]
|
93 |
|
94 |
results = {}
|
95 |
|
|
|
122 |
|
123 |
# Keyword Extraction
|
124 |
combined_text = " ".join(column_data)
|
125 |
+
word_list = re.findall(r"\\b\\w+\\b", combined_text.lower())
|
126 |
bigram_vectorizer = CountVectorizer(ngram_range=(2, 3), stop_words='english')
|
127 |
bigram_counts = bigram_vectorizer.fit_transform([combined_text])
|
128 |
bigram_features = bigram_vectorizer.get_feature_names_out()
|