Naming convention for consistency วิธีการตั้งชื่อไฟล์
bact opened this issue · 5 comments
bact commented
ปัจจุบันไฟล์ใน pythainlp/corpus มีรูปแบบการตั้งชื่อที่ไม่สม่ำเสมอ
เสนอให้มีการใช้ชื่อที่สม่ำเสมอครับ เพื่อความสะดวกในการดูแลโค้ด (มีความคาดเดาได้บางอย่าง)
ตัวอย่าง
การใช้ _ หรือ - คั่นคำ
- thaipos.py <- ไม่มีคั่น
- thaipos.json <- ไม่มีคั่น, ชื่อไฟล์ข้อมูลเหมือนไฟล์โค้ด
- thaiword.py <- ไม่มีคั่น
- thaiword.txt <- ไม่มีคั่น, ชื่อไฟล์ข้อมูลเหมือนไฟล์โค้ด
- thaisyllable.py <- ไม่มีคั่น
- thai_syllable.txt <- มี _ คั่น, ชื่อไฟล์ข้อมูลไม่เหมือนไฟล์โค้ด (ต่างตรงการคั่น)
- new-thaidict.txt <- มี - คั่น, ชื่อไฟล์ข้อมูลไม่เหมือนไฟล์โค้ด (ใช้คนละคำไปเลย dict vs word)
- newthaiword.py <- ไม่มีคั่น
เอกพจน์หรือพหูพจน์
- country.py <-- เอกพจน์
- provinces.py <-- พหูพจน์
- stopwords.py <- พหูพจน์
- thaiword.py <- เอกพจน์
suffix/prefix แสดงภาษา
- stopwords.py <- โค้ด ไม่ระบุภาษา
- stopwords-th.txt <- ชุดข้อมูล ระบุภาษาด้วย th
- thaiword.py <- โค้ด ระบุภาษาด้วย thai
- thaiword.txt <- ชุดข้อมูล ระบุภาษาด้วย thai
cstorm125 commented
ผมคิดว่า
- ใช้ _ เพราะมีปัญหาน้อยกว่า ไม่ถูกมองผิดเป็นเครื่องหมายลบ
- ควรเป็นพหูจน์เพราะไฟล์นั้นๆมีสิ่งของมากกว่าหนึ่ง
- suffix เพราะส่วนใหญ่เป็น thai เวลาเรากดหาน่าจะอยากหา functional keyword มากกว่า
3.1 เห็นว่าควรใช้ th เพราะตัวหนังสือน้อยกว่า
bact commented
ผมลองตามที่ @cstorm125 เสนอครับ ใช้ _ (underscore), ใช้พหูพจน์, ใช้ suffix _th ต่อท้ายถ้าเป็นข้อมูลภาษาไทย
cstorm125 commented
Can we move these rules somewhere so we can close this?
p16i commented
maybe wiki?
wannaphong commented
Is it done? @bact