oktjs
v0.1.3
Published
Open Korean Text ported to JavaScript.
Downloads
1
Readme
oktjs
Port of Open Korean Text to JavaScript; it has no external dependencies, and runs in the browser.
Note that a modern browser with support for ES2018 RegExp unicode escapes is necessary.
Building
To build Oktjs, the following must be installed:
Then, yarn
can be used:
$ yarn build
Details
Oktjs uses Scala.js to compile Open Korean Text to JavaScript, so it is cloned as a submodule to use its sources. A few changes are required to make it work with JavaScript:
open-korean-text/src/main/scala/org/openkoreantext/processor/util/KoreanDictionaryProvider.scala
is replaced by a shim.- The shim uses
resources.js
instead of embedded resources to load dictionaries. resources.js
embedsresources.json.gz
usingesbuild
.resources.json.gz
is generated byresources.json.gz.build.js
, which reads resources inopen-korean-text/src/main/resources/org/openkoreantext/processor/util
and writes them to a JSON file, which is then gzipped.
- The shim uses
- A minimal shim of Twitter Text is provided.
- A minimal shim
of
CharArraySet
is provided. - A Scala.js wrapper for the Open Korean Text API is written in
Okt.scala
and then re-exported with types byindex.ts
.