Skip to content

Conversation

@wannaphong
Copy link
Member

@wannaphong wannaphong commented Dec 12, 2023

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.

  • Passed code styles and structures
  • Passed code linting checks and unit test

Copy link
Member

@bact bact left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should as much as possible trying to avoid Union/multiple types for return.
It made type checking more difficult.

@wannaphong wannaphong requested a review from bact December 12, 2023 11:29
@wannaphong
Copy link
Member Author

@bact Fixed

@bact bact changed the title Add pythainlp.corpus.find_synonym Add pythainlp.corpus.find_synonyms Dec 12, 2023
@coveralls
Copy link

coveralls commented Dec 12, 2023

Coverage Status

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

@bact bact added the enhancement enhance functionalities label Dec 12, 2023
@bact bact added this to the Future milestone Dec 12, 2023
@wannaphong wannaphong requested a review from bact December 12, 2023 12:46
@pep8speaks
Copy link

pep8speaks commented Dec 12, 2023

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! 🍻

Comment last updated at 2023-12-12 13:51:45 UTC

@sonarqubecloud
Copy link

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
Copy link
Member Author

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
Copy link
Member

bact commented Dec 12, 2023

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

@wannaphong
Copy link
Member Author

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

Yes

@bact bact merged commit fcef21c into dev Dec 12, 2023
@bact
Copy link
Member

bact commented Dec 12, 2023

Noted as an expected behavior.

@wannaphong wannaphong deleted the add-find_synonym branch December 12, 2023 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement enhance functionalities

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants