An open API service indexing awesome lists of open source software.

https://github.com/apertium/wasm


https://github.com/apertium/wasm

Last synced: 17 days ago
JSON representation

Awesome Lists containing this project

README

          

After building CG-3, run a HTTP daemon in its `build/src` folder and load `vislcg3.html` and run the code below in the console.

```javascript
{
let cglb = Module.cwrap('cg3_grammar_load_buffer', 'number', ['string', 'number']);
let cac = Module.cwrap('cg3_applicator_create', 'number', ['number']);
let crgotf = Module.cwrap('cg3_run_grammar_on_text_fns', null, ['number', 'string', 'string']);

let g = cglb('DELIMITERS = "<.>"; SELECT (tag) ;', 'DELIMITERS = "<.>"; SELECT (tag) ;'.length);
let a = cac(g);

FS.writeFile('/tmp/input.txt', '""\n\t"woørd" tag\n\t"woård" nottag\n');
crgotf(a, '/tmp/input.txt', '/tmp/output.txt');

console.log(FS.readFile('/tmp/output.txt', {'encoding': 'utf8'}));
}
```

Yields output:
```
""
"woørd" tag
```

Some CG-3 changes were needed to make it build, add a text I/O function, and export all needed functions:
https://github.com/GrammarSoft/cg3/commit/38b5949d5679ea35b0ed998300d19766e489f7e0

Similar changes are likely needed for all other tools.