Package Exports
- oktjs
- oktjs/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (oktjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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
.