-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added JavaScript/wasm target via emscripten #171
Conversation
Is this change correct? RicBent@3f0eb0c Passing 0 for |
Attempted to implement the release workflow. Not sure how to test it properly without triggering a release. I guess a workflow that triggers on new pull requests still needs to be added. |
@RicBent |
Great! The latest commit adds a wrapper package that could be directly imported in any npm project. Along with proper types for the entirety of the so far exposed API (https://github.com/bab2min/Kiwi/blob/2161cf137b996471383e7c7b65370e9f28981f14/bindings/wasm/package/src/kiwi.ts). I'd be happy to implement the remaining API functionality to bring it to the same level as the Python library once you had a look at the PR. |
@RicBent |
I had a look at the Java bindings and it seems like the only missing API is the following: KiwiBuilder:
Kiwi:
I would also like to add documentation to the bindings. However I am not able to make them in Korean, only in English. Is that a problem @bab2min ? Oh and we would also need an npm package name as 'kiwi' is already taken. I chose 'kiwi-nlp' for now, but I can change it if you have a better suggestion. |
@RicBent |
Alright, I am almost there then. I already wrote pretty much all the required documentation and just the 4 points from I also amended the release workflow to automatically build and publish the resulting package to npm: Kiwi/.github/workflows/release.yml Lines 330 to 346 in c77e15f
The workflow requires To generate an npm token you need to do the following:
To add it to the repo's secrets you can follow this: |
@bab2min everything on my end should be done now:
Let me know if anything needs to be improved/changed! |
@RicBent |
This pull requests adds a build target for a JavaScript library, usable in any modern Browser.
For this the emscripten toolchain is utilized.
Solves #169
You can check out a running demo here: https://ricbent.github.io/Kiwi/demo/
Things that can be improved:
More of the base API functionality (multiple results, custom builder arguments, etc)Addition of GitHub actions to build this new targetCreating a proper npm package (package.json, helpers like the WebWorker wrapper from the demo, TypeScript types, etc), deployed via GitHub actionsAdd DocumentationBecause I haven't set up GitHub actions for this target yet, you need to manually build. This requires the emscripten toolchain to be installed:
mkdir build cd build emcmake cmake -DCMAKE_BUILD_TYPE=Release -DKIWI_USE_CPUINFO=OFF -DKIWI_BUILD_TEST=OFF -DKIWI_USE_MIMALLOC=OFF -DKIWI_BUILD_CLI=OFF -DKIWI_BUILD_EVALUATOR=OFF -DKIWI_BUILD_MODEL_BUILDER=OFF ../ make
This will generate
kiwi-wasm.js
andkiwi-wasm.wasm
. The former can be directly used in any modern browser.Sorry if I didn't follow some contribution guidelines correctly as I don't speak much Korean (yet).
Things changed since the creation of the PR: