Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,22 +10,22 @@ import nltk
|
|
10 |
nltk.download('punkt')
|
11 |
|
12 |
|
13 |
-
def summarize(
|
14 |
-
if
|
15 |
from sumy.summarizers.lsa import LsaSummarizer as Summarizer
|
16 |
-
if
|
17 |
from sumy.summarizers.text_rank import TextRankSummarizer as Summarizer
|
18 |
-
if
|
19 |
from sumy.summarizers.lex_rank import LexRankSummarizer as Summarizer
|
20 |
-
if
|
21 |
from sumy.summarizers.edmundson import EdmundsonSummarizer as Summarizer
|
22 |
-
if
|
23 |
from sumy.summarizers.luhn import LuhnSummarizer as Summarizer
|
24 |
-
if
|
25 |
from sumy.summarizers.kl import KLSummarizer as Summarizer
|
26 |
-
if
|
27 |
from sumy.summarizers.random import RandomSummarizer as Summarizer
|
28 |
-
if
|
29 |
from sumy.summarizers.reduction import ReductionSummarizer as Summarizer
|
30 |
|
31 |
if input_type=="URL":
|
@@ -37,7 +37,7 @@ def summarize(algorithm, language, sentence_count, input_type, input_):
|
|
37 |
summarizer = Summarizer(stemmer)
|
38 |
stop_words = get_stop_words(language)
|
39 |
|
40 |
-
if
|
41 |
summarizer.null_words = stop_words
|
42 |
summarizer.bonus_words = parser.significant_words
|
43 |
summarizer.stigma_words = parser.stigma_words
|
|
|
10 |
nltk.download('punkt')
|
11 |
|
12 |
|
13 |
+
def summarize(method, language, sentence_count, input_type, input_):
|
14 |
+
if method== 'LSA':
|
15 |
from sumy.summarizers.lsa import LsaSummarizer as Summarizer
|
16 |
+
if method=='text-rank':
|
17 |
from sumy.summarizers.text_rank import TextRankSummarizer as Summarizer
|
18 |
+
if method=='lex-rank':
|
19 |
from sumy.summarizers.lex_rank import LexRankSummarizer as Summarizer
|
20 |
+
if method=='edmundson':
|
21 |
from sumy.summarizers.edmundson import EdmundsonSummarizer as Summarizer
|
22 |
+
if method=='luhn':
|
23 |
from sumy.summarizers.luhn import LuhnSummarizer as Summarizer
|
24 |
+
if method=='kl-sum':
|
25 |
from sumy.summarizers.kl import KLSummarizer as Summarizer
|
26 |
+
if method=='random':
|
27 |
from sumy.summarizers.random import RandomSummarizer as Summarizer
|
28 |
+
if method=='reduction':
|
29 |
from sumy.summarizers.reduction import ReductionSummarizer as Summarizer
|
30 |
|
31 |
if input_type=="URL":
|
|
|
37 |
summarizer = Summarizer(stemmer)
|
38 |
stop_words = get_stop_words(language)
|
39 |
|
40 |
+
if method=='edmundson':
|
41 |
summarizer.null_words = stop_words
|
42 |
summarizer.bonus_words = parser.significant_words
|
43 |
summarizer.stigma_words = parser.stigma_words
|