Spaces:
Sleeping
Sleeping
no message
Browse files
main.py
CHANGED
@@ -103,7 +103,10 @@ def reduce_tokens(text: str) -> str:
|
|
103 |
for sent in doc.sents:
|
104 |
if any(tok.dep_ == 'ROOT' for tok in sent):
|
105 |
important_sentences.append(sent.text)
|
106 |
-
|
|
|
|
|
|
|
107 |
token_count = len(reduced_doc)
|
108 |
return reduced_text, token_count
|
109 |
|
|
|
103 |
for sent in doc.sents:
|
104 |
if any(tok.dep_ == 'ROOT' for tok in sent):
|
105 |
important_sentences.append(sent.text)
|
106 |
+
# Join selected sentences to form the reduced text
|
107 |
+
reduced_text = ' '.join(important_sentences)
|
108 |
+
# Tokenize the reduced text to count the tokens
|
109 |
+
reduced_doc = nlp(reduced_text)
|
110 |
token_count = len(reduced_doc)
|
111 |
return reduced_text, token_count
|
112 |
|