Skip to content

Commit 949546b

Browse files
committed
Update summarize test
1 parent a2557f8 commit 949546b

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pip install pythainlp[extra1,extra2,...]
8080

8181
where `extras` can be
8282
- `attacut` (to support attacut, a fast and accurate tokenizer)
83-
- `benchmarks` (for word tokenization benchmarking)
83+
- `benchmarks` (for [word tokenization benchmarking](tokenization-benchmark.md))
8484
- `icu` (for ICU, International Components for Unicode, support in transliteration and tokenization)
8585
- `ipa` (for IPA, International Phonetic Alphabet, support in transliteration)
8686
- `ml` (to support ULMFiT models for classification)
@@ -180,7 +180,7 @@ pip install pythainlp[extra1,extra2,...]
180180

181181
โดยที่ `extras` คือ
182182
- `attacut` (ตัวตัดคำที่แม่นกว่า `newmm` เมื่อเทียบกับชุดข้อมูล BEST)
183-
- `benchmarks` (สำหรับเครื่องมือวัดความแม่นยำของตัวตัดคำ)
183+
- `benchmarks` (สำหรับเครื่องมือ[วัดความแม่นยำของตัวตัดคำ](tokenization-benchmark.md))
184184
- `icu` (สำหรับการถอดตัวสะกดเป็นสัทอักษรและการตัดคำด้วย ICU)
185185
- `ipa` (สำหรับการถอดตัวสะกดเป็นสัทอักษรสากล (IPA))
186186
- `ml` (สำหรับการรองรับโมเดล ULMFiT)

pythainlp/summarize/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"summarize",
88
]
99

10-
DEFAULT_SUMMARIZE_ENGINE = "freq"
10+
DEFAULT_SUMMARIZE_ENGINE = "frequency"
1111

1212
from pythainlp.summarize.core import summarize

tests/test_summarize.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66

77

88
class TestSummarizePackage(unittest.TestCase):
9-
109
def test_summarize(self):
11-
text = "อาหาร หมายถึง ของแข็งหรือของเหลว "
12-
text += "ที่กินหรือดื่มเข้าสู่ร่างกายแล้ว "
13-
text += "จะทำให้เกิดพลังงานและความร้อนแก่ร่างกาย "
14-
text += "ทำให้ร่างกายเจริญเติบโต "
15-
text += "ซ่อมแซมส่วนที่สึกหรอ ควบคุมการเปลี่ยนแปลงต่างๆ ในร่างกาย "
16-
text += "ช่วยทำให้อวัยวะต่างๆ ทำงานได้อย่างปกติ "
17-
text += "อาหารจะต้องไม่มีพิษและไม่เกิดโทษต่อร่างกาย"
10+
text = (
11+
"อาหาร หมายถึง ของแข็งหรือของเหลว "
12+
"ที่กินหรือดื่มเข้าสู่ร่างกายแล้ว "
13+
"จะทำให้เกิดพลังงานและความร้อนแก่ร่างกาย "
14+
"ทำให้ร่างกายเจริญเติบโต "
15+
"ซ่อมแซมส่วนที่สึกหรอ ควบคุมการเปลี่ยนแปลงต่างๆ ในร่างกาย "
16+
"ช่วยทำให้อวัยวะต่างๆ ทำงานได้อย่างปกติ "
17+
"อาหารจะต้องไม่มีพิษและไม่เกิดโทษต่อร่างกาย"
18+
)
1819
self.assertEqual(
19-
summarize(text=text, n=1, engine="frequency"),
20+
summarize(text=text, n=1),
2021
["อาหารจะต้องไม่มีพิษและไม่เกิดโทษต่อร่างกาย"],
2122
)
2223
self.assertIsNotNone(summarize(text, 1, engine="XX"))

0 commit comments

Comments
 (0)