-
Notifications
You must be signed in to change notification settings - Fork 285
Add pythainlp.transliterate.puan #620 #624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add pythainlp.transliterate.puan #620
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 2021-11-05 18:31:07 UTC |
""" | ||
Thai Spoonerism | ||
This function covent Thai word to Thai spoonerism word. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function converts?
Thai Spoonerism | ||
This function covent Thai word to Thai spoonerism word. | ||
This function only supports words with 2 to 3 syllables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It only supports words with 2 to 3 syllables.
This function covent Thai word to Thai spoonerism word. | ||
This function only supports words with 2 to 3 syllables. | ||
:param str word: Thai word to be spoonerism |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thai word to be (spoonerized). This should be V3. spoonerism
sounds like a noun to me.
puan("นาริน", False) | ||
# output: 'นินรา' | ||
""" | ||
_word = pronunciate(word, engine="w2p") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it a convention that we start variable names with _
?
tests/test_transliterate.py
Outdated
self.assertEqual(puan("นาริน", False), "นินรา") | ||
self.assertEqual(puan("สวัสดี"), "สะ-หี-ดวัด") | ||
self.assertEqual(puan("สวัสดี", False), "สะหีดวัด") | ||
self.assertEqual(puan("สวัสดีครับ"), "สวัสดีครับ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good if we have bad input cases (syllable length < 2 or > 3).
We might even raise an exception for this case.
tests/test_transliterate.py
Outdated
def test_puan(self): | ||
self.assertEqual(puan("นาริน"), "นิน-รา") | ||
self.assertEqual(puan("นาริน", False), "นินรา") | ||
self.assertEqual(puan("สวัสดี"), "สะ-หี-ดวัด") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If politeness is a concern, we might change this input to something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed. Sorry, I don't check it.
@heytitle I fixed with all your comment. Sorry, for my mistake. |
@wannaphong thanks for the fix. The code looks good to me. Other than that, I would suggest you briefly write pseudo code on how the algorithm works. This might be helpful later when one comes to improve the algorithm. I think you can just edit the description of this PR content. |
Add pythainlp.transliterate.puan #620
Your checklist for this pull request
🚨Please review the guidelines for contributing to this repository.