Spaces:
Build error
Build error
hellopahe
commited on
Commit
•
4d46ad9
1
Parent(s):
19d5657
return 10 results
Browse files- app.py +3 -3
- lex_rank.py +2 -2
- lex_rank_L12.py +2 -2
- lex_rank_distiluse_v1.py +2 -2
app.py
CHANGED
@@ -16,7 +16,7 @@ lex_l12 = LexRankL12()
|
|
16 |
# 摘要方法1
|
17 |
def extract_handler(content):
|
18 |
summary_length = math.ceil(len(content) / 10)
|
19 |
-
sentences = lex.find_central(content
|
20 |
output = ""
|
21 |
for index, sentence in enumerate(sentences):
|
22 |
output += f"{index}: {sentence}\n"
|
@@ -26,7 +26,7 @@ def extract_handler(content):
|
|
26 |
# 摘要方法2
|
27 |
def extract_handler_distiluse_v1(content):
|
28 |
summary_length = math.ceil(len(content) / 10)
|
29 |
-
sentences = lex_distiluse_v1.find_central(content
|
30 |
output = ""
|
31 |
for index, sentence in enumerate(sentences):
|
32 |
output += f"{index}: {sentence}\n"
|
@@ -36,7 +36,7 @@ def extract_handler_distiluse_v1(content):
|
|
36 |
# 摘要方法3
|
37 |
def extract_handler_l12(content):
|
38 |
summary_length = math.ceil(len(content) / 10)
|
39 |
-
sentences = lex_l12.find_central(content
|
40 |
output = ""
|
41 |
for index, sentence in enumerate(sentences):
|
42 |
output += f"{index}: {sentence}\n"
|
|
|
16 |
# 摘要方法1
|
17 |
def extract_handler(content):
|
18 |
summary_length = math.ceil(len(content) / 10)
|
19 |
+
sentences = lex.find_central(content)
|
20 |
output = ""
|
21 |
for index, sentence in enumerate(sentences):
|
22 |
output += f"{index}: {sentence}\n"
|
|
|
26 |
# 摘要方法2
|
27 |
def extract_handler_distiluse_v1(content):
|
28 |
summary_length = math.ceil(len(content) / 10)
|
29 |
+
sentences = lex_distiluse_v1.find_central(content)
|
30 |
output = ""
|
31 |
for index, sentence in enumerate(sentences):
|
32 |
output += f"{index}: {sentence}\n"
|
|
|
36 |
# 摘要方法3
|
37 |
def extract_handler_l12(content):
|
38 |
summary_length = math.ceil(len(content) / 10)
|
39 |
+
sentences = lex_l12.find_central(content)
|
40 |
output = ""
|
41 |
for index, sentence in enumerate(sentences):
|
42 |
output += f"{index}: {sentence}\n"
|
lex_rank.py
CHANGED
@@ -12,7 +12,7 @@ class LexRank(object):
|
|
12 |
self.model = SentenceTransformer('paraphrase-multilingual-mpnet-base-v2')
|
13 |
self.ht = HarvestText()
|
14 |
|
15 |
-
def find_central(self, content: str, num=
|
16 |
if self.contains_chinese(content):
|
17 |
sentences = self.ht.cut_sentences(content)
|
18 |
else:
|
@@ -34,7 +34,7 @@ class LexRank(object):
|
|
34 |
if num < 0:
|
35 |
break
|
36 |
res.append(sentences[index])
|
37 |
-
num -=
|
38 |
return res
|
39 |
|
40 |
def contains_chinese(self, content: str):
|
|
|
12 |
self.model = SentenceTransformer('paraphrase-multilingual-mpnet-base-v2')
|
13 |
self.ht = HarvestText()
|
14 |
|
15 |
+
def find_central(self, content: str, num=10):
|
16 |
if self.contains_chinese(content):
|
17 |
sentences = self.ht.cut_sentences(content)
|
18 |
else:
|
|
|
34 |
if num < 0:
|
35 |
break
|
36 |
res.append(sentences[index])
|
37 |
+
num -= 1
|
38 |
return res
|
39 |
|
40 |
def contains_chinese(self, content: str):
|
lex_rank_L12.py
CHANGED
@@ -12,7 +12,7 @@ class LexRankL12(object):
|
|
12 |
self.model = SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2')
|
13 |
self.ht = HarvestText()
|
14 |
|
15 |
-
def find_central(self, content: str, num=
|
16 |
if self.contains_chinese(content):
|
17 |
sentences = self.ht.cut_sentences(content)
|
18 |
else:
|
@@ -34,7 +34,7 @@ class LexRankL12(object):
|
|
34 |
if num < 0:
|
35 |
break
|
36 |
res.append(sentences[index])
|
37 |
-
num -=
|
38 |
return res
|
39 |
|
40 |
def contains_chinese(self, content: str):
|
|
|
12 |
self.model = SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2')
|
13 |
self.ht = HarvestText()
|
14 |
|
15 |
+
def find_central(self, content: str, num=10):
|
16 |
if self.contains_chinese(content):
|
17 |
sentences = self.ht.cut_sentences(content)
|
18 |
else:
|
|
|
34 |
if num < 0:
|
35 |
break
|
36 |
res.append(sentences[index])
|
37 |
+
num -= 1
|
38 |
return res
|
39 |
|
40 |
def contains_chinese(self, content: str):
|
lex_rank_distiluse_v1.py
CHANGED
@@ -12,7 +12,7 @@ class LexRankDistiluseV1(object):
|
|
12 |
self.model = SentenceTransformer('distiluse-base-multilingual-cased-v1')
|
13 |
self.ht = HarvestText()
|
14 |
|
15 |
-
def find_central(self, content: str, num=
|
16 |
if self.contains_chinese(content):
|
17 |
sentences = self.ht.cut_sentences(content)
|
18 |
else:
|
@@ -34,7 +34,7 @@ class LexRankDistiluseV1(object):
|
|
34 |
if num < 0:
|
35 |
break
|
36 |
res.append(sentences[index])
|
37 |
-
num -=
|
38 |
return res
|
39 |
|
40 |
def contains_chinese(self, content: str):
|
|
|
12 |
self.model = SentenceTransformer('distiluse-base-multilingual-cased-v1')
|
13 |
self.ht = HarvestText()
|
14 |
|
15 |
+
def find_central(self, content: str, num=10):
|
16 |
if self.contains_chinese(content):
|
17 |
sentences = self.ht.cut_sentences(content)
|
18 |
else:
|
|
|
34 |
if num < 0:
|
35 |
break
|
36 |
res.append(sentences[index])
|
37 |
+
num -= 1
|
38 |
return res
|
39 |
|
40 |
def contains_chinese(self, content: str):
|