Platform
Resources
Pricing
Sign in
Get started
Korakot C.
I learn new things everyday. Now focusing on AI and NLP.
Workspace
Fork
Published
By
Korakot C.
Edited
Aug 10, 2022
Importers
1 star
Insert cell
Insert cell
Intl
Insert cell
Intl
.
Collator
// ไว้ sort string
Insert cell
Intl
.
Segmenter
// ยังไม่มีการ implement
Insert cell
Intl
.
v8BreakIterator
// ตัวที่มีแล้ว อยู่ใน v8 engine
Insert cell
Insert cell
iter
=
new
Intl
.
v8BreakIterator
(
[
'th'
]
)
Insert cell
Insert cell
{
iter
.
adoptText
(
text
)
var
pos
=
iter
.
first
(
)
return
iter
.
next
(
)
// สวัสดี
}
Insert cell
Insert cell
Insert cell
Insert cell
function
*
gen_words
(
text
)
{
const
it
=
new
Intl
.
v8BreakIterator
(
[
'th'
]
)
it
.
adoptText
(
text
)
let
start
=
it
.
first
(
)
while
(
true
)
{
let
end
=
it
.
next
(
)
if
(
end
===
-
1
)
break
yield
text
.
slice
(
start
,
end
)
;
start
=
end
}
}
Insert cell
function
segment
(
text
)
{
return
[
...
gen_words
(
text
)
]
}
Insert cell
segment
(
'สวัสดีครับ สบายดีไหมครับ'
)
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
iter
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
text
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
gen_test
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
gen_words
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
segment
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML