hellopahe commited on
Commit
bbf9596
Β·
1 Parent(s): 58a0894
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -87,8 +87,12 @@ class LexRank(object):
87
  if num < 0 and index == 0:
88
  ptr = index
89
  break
90
-
91
- return list(sentences[index] for index in most_central_sentence_indices[0: ptr + 1])
 
 
 
 
92
 
93
  # ---===--- worker instances ---===---
94
  t_randeng = SummaryExtractor()
@@ -100,9 +104,13 @@ lex = LexRank()
100
 
101
  def randeng_extract(content):
102
  sentences = lex.find_central(content)
103
- return str(list((f"{str(index)}: " + sentence + "\n") for index, sentence in enumerate(sentences))) \
104
- + "\nζ‘˜θ¦\n" \
105
- + str(list(t_randeng.extract(sentence) for sentence in sentences))
 
 
 
 
106
 
107
  # def tuoling_extract(content):
108
  # sentences = lex.find_central(content)
 
87
  if num < 0 and index == 0:
88
  ptr = index
89
  break
90
+ for index in most_central_sentence_indices:
91
+ num -= len(sentences[index])
92
+ if num < 0 and index > 0:
93
+ ptr = index + 1
94
+ break
95
+ return list(sentences[index] for index in most_central_sentence_indices[0: ptr])
96
 
97
  # ---===--- worker instances ---===---
98
  t_randeng = SummaryExtractor()
 
104
 
105
  def randeng_extract(content):
106
  sentences = lex.find_central(content)
107
+ output = "εŽŸζ–‡: \n"
108
+ for index, sentence in enumerate(sentences):
109
+ output += f"{index}: {sentence}\n"
110
+ output += "ζ‘˜θ¦:\n"
111
+ for index, sentence in enumerate(sentences):
112
+ output += f"{index}: {t_randeng.extract(sentence)}\n"
113
+ return output
114
 
115
  # def tuoling_extract(content):
116
  # sentences = lex.find_central(content)