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
fs.writeFileSync(targetPath, | |
new Buffer(JSON.stringify(fs.readFileSync(sourcePath) | |
.toString("UTF-8") | |
.split("\n") | |
.map(function (line) { | |
return line.split(",") | |
.map(function(tok) { | |
return tok | |
.split(/\s+/) | |
.filter(function(ch) { |
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
var mongo = require('mongoskin'), | |
db = mongo.db("localhost:27017/v2?auto_reconnect", {safe: false}), | |
v1_coll = db.collection("v1"); | |
var i = 0; | |
function readIt(c) { | |
c.nextObject(function (err, doc) { | |
if(err) { | |
console.log("ERR: " + err); | |
} 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
#lang racket | |
(printf "Length = ~a\n" | |
(string-length "กลม")) |
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
(define (แสดงผล x) | |
(display x)) | |
(แสดงผล "ถถถ") |
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
# encoding: UTF-8 | |
require 'thailang4r/word_breaker' | |
word_breaker = ThaiLang::WordBreaker.new | |
File.open("data1.txt", "r:UTF-8") do |file| | |
txt = file.read | |
puts word_breaker.break_into_words(txt) | |
end |
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
อ a | |
อิ i | |
อุ u | |
อา ā | |
อี ī | |
อู ū | |
เอ e | |
โอ o |
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
var getBody = require('raw-body'); | |
// ... | |
app.post("/do_sth_with_json", function(req, res) { | |
getBody(req, { | |
limit: '1mb', | |
length: req.headers['content-length'], | |
encoding: 'utf8' | |
}, function (err, buf) { |
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
require "nokogiri" | |
require "pp" | |
class EngDix | |
def initialize(monodix_path) | |
@word_hash = {} | |
File.open(monodix_path) do |file| | |
while file.gets | |
line = $_.chomp | |
if line =~ /^\s+<e/ |
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
package main | |
// Based on https://github.com/dps/go-xml-parse/blob/master/go-xml-parse.go | |
import ( | |
"fmt" | |
"os" | |
"flag" | |
"encoding/xml" | |
"strings" |
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
{"Li":"mathematics","Gloss":["คณิตศาสตร์"]} | |
{"Li":"calculus","Gloss":["แคลคูลัส","กรวด","หิน"]} | |
{"Li":"a","Gloss":["สัทอักษรสากล"]} | |
{"Li":"car","Gloss":["รถราง"]} | |
{"Li":"nose","Gloss":["จมูก"]} | |
{"Li":"I love you","Gloss":["ฉันรักคุณ"]} | |
{"Li":"poet","Gloss":["กวี"]} | |
{"Li":"eat","Gloss":["กิน","รับประทาน"]} | |
{"Li":"consume","Gloss":["ใช้","กิน","เผลาผลาญ"]} | |
{"Li":"sweet","Gloss":["หวาน","น่ารัก","ยอดเยี่ยม","ขั้นเทพ"]} |