-
Notifications
You must be signed in to change notification settings - Fork 24
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
Where is pure-js libvoikko.js dist file? #31
Comments
The source code releases we ship are relly just for source code. So there will not be any pre-compiled files within them. I have been thinking about publishing libvoikko.js to npm repository but there are things to be done before that is possible. |
+1. Is there way to build version for Node.js? Above mentioned libvoikko.js seems to rely on window, document, XMLHttpRequest etc, which are not available in Node.js. |
@wiikka: your question is really more related to Emscripten than libvoikko. Libvoikko or our build scripts do not assume anything about the environment where the script is run. Emscripten needs to do some environment specific things and thus there are references to window etc. but that does not mean that the script would not run under Node.js. More info here: https://kripken.github.io/emscripten-site/docs/api_reference/module.html#overriding-execution-environment |
@hatapitk thanks for your answer. I actually already digged the Emscripten documents what you also suggested, but still couldn't make it run on Node.js. But nontheless I would like to see voikko as npm package in future. Thanks for great work and excellent library! |
@wiikka I had to try that myself and indeed I forgot that --preload-file used in the build script does not work on Node. I tried with --embed-file and disabled closure compiler; now it works on Node: $ node > const Libvoikko = require('./js/libvoikko.js')() > let v = Libvoikko.init("fi") > v.analyze("alusta") [ { BASEFORM: 'alustaa', CLASS: 'teonsana', FSTOUTPUT: '[Lt][Xp]alustaa[X]alusta[Tk][Ap][P2][Ny][Eb]', MOOD: 'imperative', NEGATIVE: 'both', NUMBER: 'singular', PERSON: '2', STRUCTURE: '=pppppp', TENSE: 'present_simple', WORDBASES: '+alustaa(alustaa)' }, { BASEFORM: 'alku', CLASS: 'nimisana', FSTOUTPUT: '[Ln][Xp]alku[X]alu[Sela][Ny]sta', NUMBER: 'singular', SIJAMUOTO: 'sisaeronto', STRUCTURE: '=pppppp', WORDBASES: '+alku(alku)' }, { BASEFORM: 'alus', CLASS: 'nimisana', FSTOUTPUT: '[Ln][Xp]alus[X]alu[Sp][Ny]sta', NUMBER: 'singular', SIJAMUOTO: 'osanto', STRUCTURE: '=pppppp', WORDBASES: '+alus(alus)' }, { BASEFORM: 'alunen', CLASS: 'nimisana', FSTOUTPUT: '[Ln][Xp]alunen[X]alu[Sp][Ny]sta', NUMBER: 'singular', SIJAMUOTO: 'osanto', STRUCTURE: '=pppppp', WORDBASES: '+alunen(alunen)' }, { BASEFORM: 'alusta', CLASS: 'nimisana', FSTOUTPUT: '[Ln][Xp]alusta[X]alust[Sn][Ny]a', NUMBER: 'singular', SIJAMUOTO: 'nimento', STRUCTURE: '=pppppp', WORDBASES: '+alusta(alusta)' } ] Not the best way to do this on Node (would be even better to load the dictionary from actual file system). But at least we now know that it is possible. The difficulty of building the npm package is related to this issue: what is the best and most developer friendly way of handling the loading of dictionary files. |
Meanwhile I wrote a bit more detailed instructions in our Wiki on how to build the library and optionally embed/preload the dictionaries for different environments: https://github.com/voikko/corevoikko/wiki/JavaScript |
Any developments regarding this? Shouldn't it already be possible to implement an extension to the most popular browsers using Chromium as their base? Personally I think the only way to get Google / Chromium project to get interested about developing proper support for spell checkers such as Voikko, is to make a very popular, but still "bad enough" extension, that more people will become knowledgeable about the downsides in Chrome, and start complaining, or even better, switching browsers :) |
@rkantos I believe it should be possible to combine js-libvoikko and LanguageTool extensions for Chrome or Firefox to create a bad but working spell checker for these browsers: https://languagetool.org/#firefox_chrome |
It was quite journey to get emscripten up and running. So I created docker setup for JS transpilation https://github.com/niilo/libvoikko-js/tree/master/docker. There's also Typescript typings for latest released version: https://github.com/niilo/libvoikko-js/tree/master/lib. If I create pull request for Typescript typings and put those to /corevoikko/libvoikko/typescript? is it ok if I include that docker setup with instructions there also? It would be nice to see this library released in npm. Is there something where community members can help? task list of issues that should be solved? Any restrictions to release with embeded language files? |
Pull request for Typescript typings is Ok and very much appreciated! And any help getting this to npm too. You just need to find out a developer friendly way to handle dictionary loading so that it works in browser and on Node somehow. Now we build two versions for these use cases which may not be the best way to deal with the issue, just the best I could come up with at the time. |
I'm not able to get this working on browser. When I build it with the instructions mentioned above the libvoikko.js looks different than the example libvoikko.js. The example code works. After build everything seems right and it loads |
I will investigate this. You could try dowgrading Emscripten to an earlier
version (late 2019 for example) to see if that helps.
to 7. tammik. 2021 klo 12.50 Veikko Karsikko <notifications@github.com>
kirjoitti:
… I'm not able to get this working on browser. When I build it with the
instructions mentioned above the libvoikko.js looks different than the
example libvoikko.js
<http://www.puimula.org/htp/testing/js-libvoikko/libvoikko.js>. The
example code works.
After build everything seems right and it loads data files, but when I
run libvoikko.init('fi'), it throws error getpwuid_r: TODO
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#31 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAONWOWUNY7EKKLS6C2HLDLSYWGXTANCNFSM4D7FXXYA>
.
|
I'll move this conversation into own issue as this is off topic. |
Hello,
I downloaded the corevoikko release, but it does not seem to contain a file such as this:
http://www.puimula.org/htp/testing/js-libvoikko/libvoikko.js which is pre-compiled.
It would be beneficial to include the pre-compiled libvoikko.js in the release zip.
I would like to create VSCode extension so I can spellcheck markdown right in the editor using this fine library. I've done a one VSCode extension, so it shouldn't be that hard.
Also been thinking about creating a crappy Chrome extension also, (crappy because the damn overlords at Chrome does not think it needs extension API 1, 2) it could work by injecting a script that communicates with extension in all pages instead.
The text was updated successfully, but these errors were encountered: