This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Apache License 2.0 | |
file_name="data" # ชื่อไฟล์คลังข้อมูล | |
import codecs | |
from pythainlp.tokenize import word_tokenize | |
from pythainlp.tag import pos_tag | |
from nltk.tokenize import RegexpTokenizer | |
import glob | |
import nltk | |
import re | |
#จัดการประโยคซ้ำ |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 “ _ PUNCT PUNCT_`` _ 27 punct _ _ | |
2 แม้ _ ADP ADP_IN _ 10 mark _ _ | |
3 ว่า _ ADP ADP_IN _ 2 fixed _ _ | |
4 การเปลี่ยน _ VERB VERB_VV _ 10 csubj _ _ | |
5 ไป _ PART PART_RP _ 4 compound:prt _ _ | |
6 ใช้ _ VERB VERB_VV _ 4 xcomp _ _ | |
7 ระบบ _ NOUN NOUN_NN _ 6 obj _ _ | |
8 ดิจิตัล _ ADJ ADJ_JJ _ 7 amod _ _ | |
9 เป็น _ AUX AUX_VC _ 10 cop _ _ | |
10 สิ่ง _ NOUN NOUN_NN _ 27 advcl _ _ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
สวัสดีชาวโลก | |
ผมเป็นคนไทย | |
สบายดีไหม | |
ทำอะไรอยู่อ่ะ | |
หิวข้าวแล้ว | |
เธอชอบกินข้าวมันไก่ | |
เขาเพิ่งกลับจากโรงเรียน | |
พรุ่งนี้เป็นวันอะไร | |
มือถือของนายรุ่นอะไรอ่ะ | |
เราไปสั่งข้าวที่ร้านอาหารกันไหม |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from subprocess import call | |
def play(name): | |
if sys.platform == 'linux': | |
call(["ffplay",name]) | |
elif sys.platform == 'darwin': | |
call(["afplay",name]) | |
elif sys.platform == 'win32': | |
call(['start',name]) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hi(): | |
print("สวัสดีชาวโลก") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openpyxl import load_workbook | |
wb = load_workbook(filename = 'sample.xlsx') #อ่านไฟล์ sample.xlsx | |
sheet_ranges = wb['hello'] #เรียกใช้ worksheet ที่ชื่อว่า hello | |
print(sheet_ranges['A1'].value) #อ่านค่าจากเซลส์ A1 ใน worksheet ของ hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class MyProgram | |
{ | |
public static void Main(String[] args) | |
{ | |
int n; | |
int[] A = new int[4]; | |
int[] B = new int[4]; | |
int[] C = new int[4]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Hi") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// เดติดต้นฉบับจาก http://vuthi.blogspot.com.au/2004/08/java.html | |
public String icu_word_segmentation(String txt){ | |
Locale thaiLocale = new Locale("th"); | |
BreakIterator boundary = BreakIterator.getWordInstance(thaiLocale); | |
boundary.setText(txt); | |
StringBuffer strout = new StringBuffer(); | |
int start = boundary.first(); | |
for (int end = boundary.next(); | |
end != BreakIterator.DONE; | |
start = end, end = boundary.next()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""Implementation of Rapid Automatic Keyword Extraction algorithm. | |
As described in the paper `Automatic keyword extraction from individual | |
documents` by Stuart Rose, Dave Engel, Nick Cramer and Wendy Cowley. | |
Thai language by Mr.Wannaphong Phatthiyaphaibun <wannaphong@kkumail.com> | |
""" | |
import string |