PyThaiNLP / pythainlp

Thai Natural Language Processing in Python.
https://pythainlp.org/
Apache License 2.0
936 stars 272 forks source link

Add pythainlp.corpus.find_synonyms #890

Closed wannaphong closed 6 months ago

wannaphong commented 6 months ago

Add pythainlp.corpus.find_synonyms for find synonyms.

From Add thai_synonym #825

Example

>>> from pythainlp.corpus import find_synonyms
>>> find_synonyms("หมู")
['จรุก', 'วราห์', 'วราหะ', 'ศูกร', 'สุกร']

Your checklist for this pull request

🚨Please review the guidelines for contributing to this repository.

wannaphong commented 6 months ago

@bact Fixed

coveralls commented 6 months ago

Coverage Status

coverage: 85.503% (+0.03%) from 85.478% when pulling d9aa851968df938a0f41c63b776211d405ce3bcb on add-find_synonym into 3b6daf05d9b9cae7608da1d4073c86817bcfa716 on dev.

pep8speaks commented 6 months ago

Hello @wannaphong! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2023-12-12 13:51:45 UTC
sonarcloud[bot] commented 6 months ago

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

wannaphong commented 6 months ago

Ok. I'm fixed about it will only return the first occurrence set of synonyms.

>>> from pythainlp.corpus import find_synonyms
>>> print(find_synonyms("ลูกสาว"))
['ดนยา', 'ธิดา', 'บุตรี', 'สุดา']
>>> print(find_synonyms("สุดา"))
['กระลาพิม', 'กระลาศรี', 'กัญญา', 'กันยา', 'กันย์', 'กัลยา', 'กัลยาณี', 'กานดา', 'กามินี', 'จอมขวัญ', 'จอมใจ', 'ฉัยยา', 'ชารี', 'ดนยา', 'ดรุณี', 'ดวงสมร', 'ถี', 'ทรามวัย', 'ทรามสงวน', 'ทรามสวาท', 'ทรามเชย', 'ธิดา', 'นงคราญ', 'นงพะงา', 'นงพาล', 'นงพุธ', 'นงราม', 'นงลักษณ์', 'นงเยาว์', 'นงโพธ', 'นรี', 'นารี', 'นาเรศ', 'นิรมล', 'บังอร', 'บุตรี', 'ผู้หญิง', 'พธู', 'พนิดา', 'พุ่มพวง', 'ภีรุ', 'มาณวิกา', 'มาตุคาม', 'มารศรี', 'ยุพดี', 'ยุพยง', 'ยุพา', 'ยุพาน', 'ยุพาพาล', 'ยุพาพิน', 'ยุพิน', 'ยุพเยาว์', 'ยุพเรศ', 'ยุวดี', 'รมณี', 'ร้อยชั่ง', 'ลลนา', 'ลูกสาว', 'วธู', 'วนิดา', 'วรดนู', 'สตรี', 'สมร', 'สะคราญ', 'สายสมร', 'สุดา', 'อนงค์', 'อร', 'อรทัย', 'อรนุช', 'อังคณา', 'อิตถี', 'อิสตรี', 'อิสัตรี', 'เยาวพา', 'เยาวมาลย์', 'เยาวลักษณ์', 'เยาวเรศ', 'แก้วตา', 'โฉมตรู', 'ไฉยา']
bact commented 6 months ago

So it will return synonyms of synonyms of the input word?

wannaphong commented 6 months ago

So it will return synonyms of synonyms of the input word?

Yes

bact commented 6 months ago

Noted as an expected behavior.