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 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.