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

Refactor tokenize code #125

Merged
merged 3 commits into from
Oct 13, 2018
Merged

Refactor tokenize code #125

merged 3 commits into from
Oct 13, 2018

Conversation

bact
Copy link
Member

@bact bact commented Oct 13, 2018

  • move common TCC function (tcc_pos) from newmm.py to tcc.py
  • sent_tokenize() and subword_tokenize() must return something
  • replace while loops with for loops in isthai() and syllable_tokenize() (faster)
  • more meaningful exception error message, now report the unknown engine name

- move tcc function (tcc_pos) to tcc.py
- sent_tokenize() and subword_tokenize() must return something
- replace while loops with for loops in isthai() and syllable_tokenize() (faster)
@coveralls
Copy link

coveralls commented Oct 13, 2018

Coverage Status

Coverage decreased (-0.09%) to 53.186% when pulling bc74d15 on bact:dev into 1bfe60a on PyThaiNLP:dev.

@wannaphong
Copy link
Member

ผมคิดว่า .lower() ไม่น่าจะกำหนดเป็นค่าเริ่มต้นนะครับ ควรแยกออกเป็นอีกพารามิเตอร์อันหนึ่งดีกว่าครับ

@bact
Copy link
Member Author

bact commented Oct 13, 2018

ผมคิดว่า .lower() ไม่น่าจะกำหนดเป็นค่าเริ่มต้นนะครับ ควรแยกออกเป็นอีกพารามิเตอร์อันหนึ่งดีกว่าครับ

engine = engine.strip().lower() ในตอนต้นของ dict_word_tokenize() และ sent_tokenize()
มีเพื่อกรณีพารามิเตอร์ engine มีค่าเป็น NEWMM ก็จะยังไปเรียก newmm ให้อยู่ครับ
(ไม่ได้ .lower() ตัว text ที่เป็น input)

ถ้าอยากให้คนเรียก engine เรียกใช้อย่างเคร่งครัด พิมพ์มาตัวเล็กใหญ่ไม่ตรงตามที่เรากำหนดก็จะใช้ไม่ได้ เอาบรรทัดนี้ออกได้ครับ

@wannaphong wannaphong merged commit e551e0c into PyThaiNLP:dev Oct 13, 2018
@wannaphong
Copy link
Member

รวมเรียบร้อยแล้ว ขอบคุณครับ

@bact
Copy link
Member Author

bact commented Oct 13, 2018

ขอบคุณครับ

@wannaphong wannaphong mentioned this pull request Nov 4, 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

3 participants