~snowball-yiddish-dev/snowball-yiddish/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Quickstart
==========

This is a very brief introduction to the use of PyStemmer.

First, import the library:

>>> import Stemmer

Just for show, we'll display a list of the available stemming algorithms:

>>> print(Stemmer.algorithms())
['danish', 'dutch', 'english', 'finnish', 'french', 'german', 'hungarian', 'italian', 'norwegian', 'porter', 'portuguese', 'romanian', 'russian', 'spanish', 'swedish', 'turkish']

Now, we'll get an instance of the english stemming algorithm:

>>> stemmer = Stemmer.Stemmer('english')

Stem a single word:

>>> print(stemmer.stemWord('cycling'))
cycl

Stem a list of words:

>>> print(stemmer.stemWords(['cycling', 'cyclist']))
['cycl', 'cyclist']

Strings which are supplied are assumed to be unicode.
We can use UTF-8 encoded input, too:

>>> print(stemmer.stemWords(['cycling', b'cyclist']))
['cycl', b'cyclist']

Each instance of the stemming algorithms uses a cache to speed up processing of
common words.  By default, the cache holds 10000 words, but this may be
modified.  The cache may be disabled entirely by setting the cache size to 0:

>>> print(stemmer.maxCacheSize)
10000

>>> stemmer.maxCacheSize = 1000

>>> print(stemmer.maxCacheSize)
1000