本文整理汇总了Python中sumy.summarizers.edmundson.EdmundsonSummarizer.cue_method方法的典型用法代码示例。如果您正苦于以下问题:Python EdmundsonSummarizer.cue_method方法的具体用法?Python EdmundsonSummarizer.cue_method怎么用?Python EdmundsonSummarizer.cue_method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sumy.summarizers.edmundson.EdmundsonSummarizer
的用法示例。
在下文中一共展示了EdmundsonSummarizer.cue_method方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cue_3
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_3(self):
document = build_document(
(
"ba "*10,
"bb "*10,
" sa"*8 + " bb"*10,
"bb bc ba",
),
(),
(
"babbbc "*10,
"na nb nc nd sa" + " bc"*10,
" ba n"*10,
)
)
summarizer = EdmundsonSummarizer()
summarizer.bonus_words = ("ba", "bb", "bc",)
summarizer.stigma_words = ("sa", "sb", "sc",)
sentences = summarizer.cue_method(document, 5)
self.assertEqual(len(sentences), 5)
self.assertEqual(to_unicode(sentences[0]), ("ba "*10).strip())
self.assertEqual(to_unicode(sentences[1]), ("bb "*10).strip())
self.assertEqual(to_unicode(sentences[2]), "bb bc ba")
self.assertEqual(to_unicode(sentences[3]),
"na nb nc nd sa bc bc bc bc bc bc bc bc bc bc")
self.assertEqual(to_unicode(sentences[4]), ("ba n "*10).strip())
示例2: test_cue_empty
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_empty(self):
summarizer = EdmundsonSummarizer()
summarizer.bonus_words = ("ba", "bb", "bc",)
summarizer.stigma_words = ("sa", "sb", "sc",)
sentences = summarizer.cue_method(build_document(), 10)
self.assertEqual(len(sentences), 0)
示例3: test_cue_3
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_3():
document = build_document(
(
"ba "*10,
"bb "*10,
" sa"*8 + " bb"*10,
"bb bc ba",
),
(),
(
"babbbc "*10,
"na nb nc nd sa" + " bc"*10,
" ba n"*10,
)
)
summarizer = EdmundsonSummarizer()
summarizer.bonus_words = ("ba", "bb", "bc",)
summarizer.stigma_words = ("sa", "sb", "sc",)
sentences = summarizer.cue_method(document, 5)
assert list(map(to_unicode, sentences)) == [
("ba "*10).strip(),
("bb "*10).strip(),
"bb bc ba",
"na nb nc nd sa bc bc bc bc bc bc bc bc bc bc",
("ba n "*10).strip(),
]
示例4: test_cue_empty
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_empty():
summarizer = EdmundsonSummarizer()
summarizer.bonus_words = ("ba", "bb", "bc",)
summarizer.stigma_words = ("sa", "sb", "sc",)
sentences = summarizer.cue_method(build_document(), 10)
assert list(map(to_unicode, sentences)) == []
示例5: test_cue_2
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_2(self):
document = build_document(
("ba bb bc bb unknown ľščťžýáíé sb sc sb",),
("Pepek likes spinach",)
)
summarizer = EdmundsonSummarizer()
summarizer.bonus_words = ("ba", "bb", "bc",)
summarizer.stigma_words = ("sa", "sb", "sc",)
sentences = summarizer.cue_method(document, 10)
self.assertEqual(len(sentences), 2)
self.assertEqual(to_unicode(sentences[0]),
"ba bb bc bb unknown ľščťžýáíé sb sc sb")
self.assertEqual(to_unicode(sentences[1]), "Pepek likes spinach")
sentences = summarizer.cue_method(document, 1)
self.assertEqual(len(sentences), 1)
self.assertEqual(to_unicode(sentences[0]),
"ba bb bc bb unknown ľščťžýáíé sb sc sb")
示例6: test_cue_1
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_1(self):
document = build_document(
("ba bb bc bb unknown ľščťžýáíé sb sc sb",)
)
summarizer = EdmundsonSummarizer()
summarizer.bonus_words = ("ba", "bb", "bc",)
summarizer.stigma_words = ("sa", "sb", "sc",)
sentences = summarizer.cue_method(document, 10)
self.assertEqual(len(sentences), 1)
示例7: test_cue_2
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_2():
document = build_document(
("ba bb bc bb unknown ľščťžýáíé sb sc sb",),
("Pepek likes spinach",)
)
summarizer = EdmundsonSummarizer()
summarizer.bonus_words = ("ba", "bb", "bc",)
summarizer.stigma_words = ("sa", "sb", "sc",)
sentences = summarizer.cue_method(document, 10)
assert list(map(to_unicode, sentences)) == [
"ba bb bc bb unknown ľščťžýáíé sb sc sb",
"Pepek likes spinach",
]
sentences = summarizer.cue_method(document, 1)
assert list(map(to_unicode, sentences)) == [
"ba bb bc bb unknown ľščťžýáíé sb sc sb",
]
示例8: test_cue_letters_case
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_letters_case(self):
document = build_document(
("X X X", "x x x x",),
("w w w", "W W W W",)
)
summarizer = EdmundsonSummarizer()
summarizer.bonus_words = ("X", "w",)
summarizer.stigma_words = ("stigma",)
sentences = summarizer.cue_method(document, 2)
self.assertEqual(len(sentences), 2)
self.assertEqual(to_unicode(sentences[0]), "x x x x")
self.assertEqual(to_unicode(sentences[1]), "W W W W")
示例9: test_cue_letters_case
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_letters_case():
document = build_document(
("X X X", "x x x x",),
("w w w", "W W W W",)
)
summarizer = EdmundsonSummarizer()
summarizer.bonus_words = ("X", "w",)
summarizer.stigma_words = ("stigma",)
sentences = summarizer.cue_method(document, 2)
assert list(map(to_unicode, sentences)) == [
"x x x x",
"W W W W",
]
示例10: test_cue_with_no_bonus_words
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_with_no_bonus_words():
summarizer = EdmundsonSummarizer()
summarizer.stigma_words = ("useless", "bad", "spinach",)
with pytest.raises(ValueError):
summarizer.cue_method(build_document(), 10)
示例11: test_cue_with_no_stigma_words
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_with_no_stigma_words():
summarizer = EdmundsonSummarizer()
summarizer.bonus_words = ("great", "very", "beautiful",)
with pytest.raises(ValueError):
summarizer.cue_method(build_document(), 10)
示例12: test_cue_with_no_words
# 需要导入模块: from sumy.summarizers.edmundson import EdmundsonSummarizer [as 别名]
# 或者: from sumy.summarizers.edmundson.EdmundsonSummarizer import cue_method [as 别名]
def test_cue_with_no_words():
summarizer = EdmundsonSummarizer()
with pytest.raises(ValueError):
summarizer.cue_method(build_document(), 10)