Public
Edited
Jan 28, 2023
Insert cell
Insert cell
Insert cell
corrections0 // ของเดิมที่มีอยู่แล้ว
Insert cell
// เพิ่มคำตรงนี้
more_correct = `
โลกุตตระ
ปฏิจจสมุปบาท
`.trim().split(/\s+/)
Insert cell
corrections = corrections0.concat(more_correct)
Insert cell
// import มา แต่ใช้ corrections อันใหม่ที่เพิ่มแล้ว
import {segment, segment0} with {corrections} from "@kora/icut"
Insert cell
segment0('ธรรมะอันเป็นโลกุตตระ') // ICU ธรรมดา
Insert cell
segment('ธรรมะอันเป็นโลกุตตระ') // iCut ที่เพิ่ม rule ได้เอง
Insert cell
segment0('ปฏิจจสมุปบาท')
Insert cell
Insert cell
data = {
let url = 'https://raw.githubusercontent.com/PyThaiNLP/pythainlp/dev/pythainlp/corpus/ttc_freq.txt'
let text = await d3.text(url)
return d3.tsvParseRows(text)
}
Insert cell
to_add = {
let res = []
for (let [w, fq] of data) {
let ww = segment(w)
if (ww.length==1) { continue }
res.push(w)
}
return res.slice(15) // [res.length, data.length]
}
Insert cell
more_words = `
ต่อไป ความหมาย ทั้งหลาย ดังนั้น เดินทาง ต่อมา ทีเดียว หมายถึง ตัวเอง ผู้หญิง ถูกต้อง ชาวบ้าน
`.trim().split(/\s+/)
Insert cell
segment('การเดินทางอันแสนนาน')
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more