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

[Feature request]: Add Thai synonym corpus to PyThaiNLP #707

Closed
wannaphong opened this issue Sep 16, 2022 · 5 comments
Closed

[Feature request]: Add Thai synonym corpus to PyThaiNLP #707

wannaphong opened this issue Sep 16, 2022 · 5 comments
Labels
corpus corpus/dataset-related issues enhancement enhance functionalities Hacktoberfest for Hacktoberfest event
Milestone

Comments

@wannaphong
Copy link
Member

Detailed description

From https://github.com/PyThaiNLP/thai-synonym, I think we can add Thai synonym corpus to PyThaiNLP with search by word and output the data from the corpus.

Possible implementation

  • Search by word; use dict datatype
  • output all the data; use List[List[str]] for output
@wannaphong wannaphong added this to the Future milestone Sep 17, 2022
@wannaphong wannaphong added the Hacktoberfest for Hacktoberfest event label Sep 28, 2022
@sanittawan
Copy link

สวัสดีค่ะ สนใจอยากช่วยทำฟีเจอร์นี้ค่ะ เห็นคุณ @wannaphong เขียนโค้ดไว้แล้วตามลิงก์ในกระทู้ แต่ยังไม่ค่อยแน่ใจว่าต้องทำอะไรบ้าง เท่าที่เข้าใจคือ

  1. อยากจะให้เพิ่มไฟล์ data.csv ในลิงก์ข้างต้นในโฟลเดอร์นี้
  2. สร้างโฟลเดอร์ใหม่ในโฟลเดอร์นี้ สำหรับ synonym module
  3. แก้ไขโค้ดเบื้องต้นให้ output เป็น List[List[str]] แล้วใส่ไว้ในโฟลเดอร์ตามขั้นตอนที่่ 2
    ณ ตอนนี้โค้ดเบื้องต้น output เป็น list
$ python3 synonym.py
Text : ก๋ง
['ปิตามหะ', 'อัยกะ', 'อัยกา', 'ปู่', 'ขรัวตา', 'มาตามหะ', 'อัยกะ', 'อัยกา', 'ตา']

คุณ @wannaphong อยากให้เป็นแบบนี้หรอคะ

$ python3 synonym.py
Text : ก๋ง
[['ปิตามหะ'], ['อัยกะ'], ['อัยกา'], ['ปู่'], ['ขรัวตา'], ['มาตามหะ'], ['อัยกะ'], ['อัยกา'], ['ตา']]
  1. เขียน tests สำหรับ synonym

พอจะเข้าใจถูกบ้างมั้ยคะ เคยใช้ PyThaiNLP ในโปรเจคที่เคยทำอยู่แล้ว แต่เป็นมือใหม่เพิ่งจะลองหัดช่วยพัฒนาโปรแกรมในโอเพ่นซอร์สค่ะ อาจจะมีคำถามเยอะหน่อยนะคะ

@wannaphong
Copy link
Member Author

wannaphong commented Oct 3, 2022

สวัสดีค่ะ สนใจอยากช่วยทำฟีเจอร์นี้ค่ะ เห็นคุณ @wannaphong เขียนโค้ดไว้แล้วตามลิงก์ในกระทู้ แต่ยังไม่ค่อยแน่ใจว่าต้องทำอะไรบ้าง เท่าที่เข้าใจคือ

1. อยากจะให้เพิ่มไฟล์ `data.csv` ในลิงก์ข้างต้นใน[โฟลเดอร์นี้](https://github.com/PyThaiNLP/pythainlp/tree/dev/pythainlp/corpus)

2. สร้างโฟลเดอร์ใหม่ใน[โฟลเดอร์นี้](https://github.com/PyThaiNLP/pythainlp/tree/dev/pythainlp) สำหรับ synonym module

3. แก้ไขโค้ดเบื้องต้นให้ output เป็น List[List[str]] แล้วใส่ไว้ในโฟลเดอร์ตามขั้นตอนที่่ 2
   ณ ตอนนี้โค้ดเบื้องต้น output เป็น list
$ python3 synonym.py
Text : ก๋ง
['ปิตามหะ', 'อัยกะ', 'อัยกา', 'ปู่', 'ขรัวตา', 'มาตามหะ', 'อัยกะ', 'อัยกา', 'ตา']

คุณ @wannaphong อยากให้เป็นแบบนี้หรอคะ

$ python3 synonym.py
Text : ก๋ง
[['ปิตามหะ'], ['อัยกะ'], ['อัยกา'], ['ปู่'], ['ขรัวตา'], ['มาตามหะ'], ['อัยกะ'], ['อัยกา'], ['ตา']]
4. เขียน tests สำหรับ synonym

พอจะเข้าใจถูกบ้างมั้ยคะ เคยใช้ PyThaiNLP ในโปรเจคที่เคยทำอยู่แล้ว แต่เป็นมือใหม่เพิ่งจะลองหัดช่วยพัฒนาโปรแกรมในโอเพ่นซอร์สค่ะ อาจจะมีคำถามเยอะหน่อยนะคะ

สวัสดีครับ ขอบคุณที่สนใจร่วมพัฒนา PyThaiNLP นะครับ ผมขอตอบคำถามตามนี้นะครับ

  1. ใช่ครับ แต่อาจจะเปลี่ยนชื่อไฟล์ให้เหมะสมกว่า data.csv ครับ
  2. เพิ่มเป็นไฟล์ synonym.py ภายใต้โฟลเดอร์ pythainlp/corpus ครับ
  3. เป็น List[List[str]] ปกติแบบ [['ปิตามหะ', 'อัยกะ', 'อัยกา', 'ปู่', 'ขรัวตา', 'มาตามหะ', 'อัยกะ', 'อัยกา', 'ตา']] ครับ
  4. ใช่ครับ

โดยรวมสร้างเป็นไฟล์ synonym(คำ) ไฟล์ synonym.py ภายใต้โฟลเดอร์ pythainlp/corpus ให้เวลาเรียกเป็น

from pythainlp.corpus.synonym import synonym
synonym("แมว") # output: [...]

@sanittawan
Copy link

ขอบคุณค่ะ เดี๋ยวทำตามนี้แล้วส่ง pull request ไปนะคะ ถ้ามีคำถามเพิ่ม เดี๋ยวแวะกลับมาค่ะ

@bact bact added enhancement enhance functionalities corpus corpus/dataset-related issues labels Oct 11, 2022
@pavaris-pm
Copy link
Contributor

pavaris-pm commented Oct 10, 2023

@sanittawan do you currently working on this? would you mind if we co-authored? if you're ok, i will make a PR within couple days (maybe today or tmrw) and ask for your collaboration to improve it (by mentioning you after i made a PR) in case that there has some part in my PR that you want to improve/contribute. What do you think?

@wannaphong i have another question, it seems like you've added thai_synonym in #825 which is kind of similar corpus. Does this is the same corpus as that closed PR? i'm not sure about it. Could you please clarify?

@wannaphong
Copy link
Member Author

@sanittawan do you currently working on this? would you mind if we co-authored? if you're ok, i will make a PR within couple days (maybe today or tmrw) and ask for your collaboration to improve it (by mentioning you after i made a PR) in case that there has some part in my PR that you want to improve/contribute. What do you think?

@wannaphong i have another question, it seems like you've added thai_synonym in #825 which is kind of similar corpus. Does this is the same corpus as that closed PR? i'm not sure about it. Could you please clarify?

Sorry, my missing. This issue should closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
corpus corpus/dataset-related issues enhancement enhance functionalities Hacktoberfest for Hacktoberfest event
Projects
None yet
Development

No branches or pull requests

4 participants