Spaces:
Sleeping
Sleeping
Update extractive_summarization.py
Browse files- extractive_summarization.py +2 -13
extractive_summarization.py
CHANGED
|
@@ -1,14 +1,3 @@
|
|
| 1 |
-
"""from sumy.parsers.plaintext import PlaintextParser
|
| 2 |
-
from sumy.nlp.tokenizers import Tokenizer
|
| 3 |
-
from sumy.summarizers.lsa import LsaSummarizer
|
| 4 |
-
from sumy.summarizers.lex_rank import LexRankSummarizer
|
| 5 |
-
from sumy.summarizers.text_rank import TextRankSummarizer
|
| 6 |
-
from pysummarization.nlpbase.auto_abstractor import AutoAbstractor
|
| 7 |
-
from pysummarization.tokenizabledoc.simple_tokenizer import SimpleTokenizer
|
| 8 |
-
from pysummarization.abstractabledoc.top_n_rank_abstractor import TopNRankAbstractor
|
| 9 |
-
from sumy.nlp.stemmers import Stemmer
|
| 10 |
-
from sumy.utils import get_stop_words"""
|
| 11 |
-
|
| 12 |
from sumy.parsers.plaintext import PlaintextParser
|
| 13 |
from sumy.nlp.tokenizers import Tokenizer
|
| 14 |
from sumy.summarizers.text_rank import TextRankSummarizer
|
|
@@ -17,7 +6,7 @@ from sumy.summarizers.lex_rank import LexRankSummarizer
|
|
| 17 |
import nltk
|
| 18 |
nltk.download('punkt')
|
| 19 |
|
| 20 |
-
def summarize_with_textrank(text, sentences_count=
|
| 21 |
"""
|
| 22 |
Summarizes the provided text using TextRank algorithm.
|
| 23 |
|
|
@@ -47,7 +36,7 @@ def summarize_with_textrank(text, sentences_count=5):
|
|
| 47 |
|
| 48 |
|
| 49 |
# Define LSA summarization function
|
| 50 |
-
def summarize_with_lsa(text, sentences_count=
|
| 51 |
"""
|
| 52 |
Summarizes the provided text using LSA (Latent Semantic Analysis) algorithm.
|
| 53 |
Args:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from sumy.parsers.plaintext import PlaintextParser
|
| 2 |
from sumy.nlp.tokenizers import Tokenizer
|
| 3 |
from sumy.summarizers.text_rank import TextRankSummarizer
|
|
|
|
| 6 |
import nltk
|
| 7 |
nltk.download('punkt')
|
| 8 |
|
| 9 |
+
def summarize_with_textrank(text, sentences_count=10):
|
| 10 |
"""
|
| 11 |
Summarizes the provided text using TextRank algorithm.
|
| 12 |
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
# Define LSA summarization function
|
| 39 |
+
def summarize_with_lsa(text, sentences_count=10):
|
| 40 |
"""
|
| 41 |
Summarizes the provided text using LSA (Latent Semantic Analysis) algorithm.
|
| 42 |
Args:
|