Skip to content
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

Utility functions: rearrange package locations + add thai_strftime() date and time formatter #160

Merged
merged 16 commits into from
Nov 21, 2018

Conversation

bact
Copy link
Member

@bact bact commented Nov 18, 2018

  • Add Thai date and time formatter thai_strftime in pythainlp.util
  • Move small utility functions to pythainlp.util
  • Move ner to pythainlp.tag

- Add thai_strftime in pythainlp.util
- Move small utility functions to pythainlp.util
- Move ner to pythainlp.tag
tests/__init__.py Outdated Show resolved Hide resolved
@wannaphong wannaphong mentioned this pull request Nov 19, 2018
@bact
Copy link
Member Author

bact commented Nov 20, 2018

Python strftime() depends on system's libc. GNU and BSD systems may different.
The test cases should be updated to be platform-agnostic.

@bact bact changed the title Rearrange package locations + Add thai_strftime Rearrange package locations for utility functions + Add thai_strftime Nov 20, 2018
ner = ThaiNameTagger()
self.assertEqual(ner.get_ner(""), [])
self.assertIsNotNone(ner.get_ner("แมวทำอะไรตอนห้าโมงเช้า"))
# self.assertEqual(
Copy link
Member

Choose a reason for hiding this comment

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

ผมสงสัยทำไมผลลัพธ์ test ตรง ner ออกมาแปลก ๆ ก่อนหน้านี้ครับ

Copy link
Member Author

Choose a reason for hiding this comment

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

ไม่แน่ใจเลยครับ โค้ดเหมือนเดิมทุกอย่างนะครับ

Copy link
Member Author

Choose a reason for hiding this comment

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

ตอนนี้ได้แบบนี้ครับ

ner.get_ner("แมวทำอะไรตอนห้าโมงเช้า")

[('แมว', 'PROPN', 'O'), ('ทำ', 'VERB', 'O'), ('อะไร', 'PRON', 'O'), ('ตอน', 'NOUN', 'O'), ('ห้า', 'NOUN', 'B-TIME'), ('โมง', 'PROPN', 'I-TIME'), ('เช้า', 'NOUN', 'I-TIME')]

Copy link
Member Author

Choose a reason for hiding this comment

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

แต่จริงๆ โดยไอเดีย unit test ตรงนี้ควรจะเป็นการทดสอบว่า ทำงานได้ตาม logic ของโปรแกรม ในแง่ flow
ส่วน accuracy ของผลลัพธ์อาจจะต้อง test กันอีกแบบ โดยเฉพาะกับงานที่ใช้ความน่าจะเป็นมาเกี่ยวข้องในการหาผลลัพธ์ครับ (การอัปเดตโมเดล อาจทำให้ผลลัพธ์เปลี่ยนได้)

@bact bact changed the title Rearrange package locations for utility functions + Add thai_strftime Utility functions: rearrange package locations + add thai_strftime() date and time formatter Nov 21, 2018
@bact bact merged commit f9888bd into PyThaiNLP:dev Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants