Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ from sklearn.metrics.pairwise import cosine_similarity
|
|
29 |
# nombre de mots et de mots uniques
|
30 |
def number_words(text):
|
31 |
word = text.split()
|
32 |
-
return 'Nombre de mots : {}
|
33 |
|
34 |
# polarité
|
35 |
def polarity(text):
|
@@ -64,7 +64,7 @@ def keywords(text):
|
|
64 |
for i in range(len(most_freq_words)):
|
65 |
mfwp = most_freq_words[i][0]
|
66 |
most_freq_words_p.append(mfwp)
|
67 |
-
return
|
68 |
|
69 |
|
70 |
# summary1
|
@@ -109,7 +109,7 @@ def summary_1(text):
|
|
109 |
summary_sentences.append(sentences[sentence_scores[1][0]])
|
110 |
|
111 |
summary = ' '.join(summary_sentences)
|
112 |
-
return
|
113 |
|
114 |
|
115 |
# summary2
|
@@ -133,7 +133,7 @@ def summary_2(text):
|
|
133 |
if word in most_freq_words_p and sent not in summary:
|
134 |
summary.append(sent)
|
135 |
|
136 |
-
return
|
137 |
|
138 |
|
139 |
def analyze_text(text):
|
@@ -157,11 +157,12 @@ if st.button("Analyze"):
|
|
157 |
st.write(nb_mots)
|
158 |
st.write(polarite)
|
159 |
st.write(subjectivite)
|
160 |
-
st.write(
|
161 |
-
st.write(
|
162 |
-
st.write(
|
|
|
163 |
|
164 |
-
if st.button("Clear"):
|
165 |
text = ""
|
166 |
|
167 |
|
|
|
29 |
# nombre de mots et de mots uniques
|
30 |
def number_words(text):
|
31 |
word = text.split()
|
32 |
+
return 'Nombre de mots : {} / Nombre de mots uniques : {}'.format(len(word), len(Counter(word)))
|
33 |
|
34 |
# polarité
|
35 |
def polarity(text):
|
|
|
64 |
for i in range(len(most_freq_words)):
|
65 |
mfwp = most_freq_words[i][0]
|
66 |
most_freq_words_p.append(mfwp)
|
67 |
+
return most_freq_words_p
|
68 |
|
69 |
|
70 |
# summary1
|
|
|
109 |
summary_sentences.append(sentences[sentence_scores[1][0]])
|
110 |
|
111 |
summary = ' '.join(summary_sentences)
|
112 |
+
return summary
|
113 |
|
114 |
|
115 |
# summary2
|
|
|
133 |
if word in most_freq_words_p and sent not in summary:
|
134 |
summary.append(sent)
|
135 |
|
136 |
+
return summary
|
137 |
|
138 |
|
139 |
def analyze_text(text):
|
|
|
157 |
st.write(nb_mots)
|
158 |
st.write(polarite)
|
159 |
st.write(subjectivite)
|
160 |
+
st.write("List without square brackets and single quotes:")
|
161 |
+
st.write(f'Mots clés : {mots_cles}')
|
162 |
+
st.write(f'Résumé 1 : {resume1}')
|
163 |
+
st.write(f'Résumé 2 : {resume2}')
|
164 |
|
165 |
+
if st.button("Clear Text Area"):
|
166 |
text = ""
|
167 |
|
168 |
|