0.1.3 • Published 2 years ago
oktjs v0.1.3
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 buildDetails
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.scalais replaced by a shim.- The shim uses
resources.jsinstead of embedded resources to load dictionaries. resources.jsembedsresources.json.gzusingesbuild.resources.json.gzis generated byresources.json.gz.build.js, which reads resources inopen-korean-text/src/main/resources/org/openkoreantext/processor/utiland 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
CharArraySetis provided. - A Scala.js wrapper for the Open Korean Text API is written in
Okt.scalaand then re-exported with types byindex.ts.