czech-stemmer
v0.1.0
Published
Stemmer for Czech language in Javascript
Downloads
13
Readme
Czech stemmer
This is a port of stemmer for Czech language to Javascript, for both node.js and browser.
Original code is a Java program by Jacques Savoy released under BSD license.
To get stemmer for other languages, check out Snowball and its javascript port snowball-js.
Usage
Use it in node:
// using default agressive stemmer
var stem = require('czech-stemmer');
stem('nejneobhospodařovávatelnějšími'); // => 'nejneobhospodařováva'
// using lighter version of stemmer
var stem_light = require('czech-stemmer/light.js');
stem_light('nejneobhospodařovávatelnějšími'); // => 'nejneobhospodařovávatelnějš'
Use it in browser:
<script src="../stringbuffer.js"></script>
<script src="../agressive.js"></script>
<script>
czech_stem('nejneobhospodařovávatelnějšími');
</script>
Technical details
To reuse Java code as much as possible, limited version of StringBuffer was implemented as a shim and only few code replacements were performed:
- class definition -> function constructor
- 'private void' -> 'function'
- 'int ' -> 'var '
- 'StringBuffer ' -> ''