Update app.py
Browse files
app.py
CHANGED
|
@@ -68,8 +68,13 @@ def main():
|
|
| 68 |
#doc = stf_nlp(summ)
|
| 69 |
#l=[w.text.capitalize() if w.upos in ["PROPN","NNS"] else w.text for sent in doc.sentences for w in sent.words]
|
| 70 |
#text=" ".join(l)
|
| 71 |
-
summ=truecasing_by_sentence_segmentation(summ)
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
if 'summary' not in st.session_state:
|
| 74 |
st.session_state.summary=True
|
| 75 |
st.session_state.summarization = summ
|
|
|
|
| 68 |
#doc = stf_nlp(summ)
|
| 69 |
#l=[w.text.capitalize() if w.upos in ["PROPN","NNS"] else w.text for sent in doc.sentences for w in sent.words]
|
| 70 |
#text=" ".join(l)
|
| 71 |
+
#summ=truecasing_by_sentence_segmentation(summ)
|
| 72 |
+
sentences = sent_tokenize(summ, language='english')
|
| 73 |
+
# capitalize the sentences
|
| 74 |
+
sentences_capitalized = [s.capitalize() for s in sentences]
|
| 75 |
+
# join the capitalized sentences
|
| 76 |
+
summ = re.sub(" (?=[\.,'!?:;])", "", ' '.join(sentences_capitalized))
|
| 77 |
+
|
| 78 |
if 'summary' not in st.session_state:
|
| 79 |
st.session_state.summary=True
|
| 80 |
st.session_state.summarization = summ
|