Stemmer for Czech language in Javascript

npm install czech-stemmer
2 downloads in the last week
4 downloads in the last month

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.


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>

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 ' -> ''
npm loves you