root/pyndexter/trunk/pyndexter/stemmers/_snowball.py

Revision 452, 1.0 kB (checked in by athomas, 1 year ago)

pyndexter: All modules are now prefixed with _ to avoid import collisions. Updated unit tests.

  • Property svn:eol-style set to native
Line 
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2006 Alec Thomas <alec@swapoff.org>
4 #
5 # This software is licensed as described in the file COPYING, which
6 # you should have received as part of this distribution.
7 #
8
9 """
10 Snowball
11 --------
12
13 `Snowball <http://snowball.tartarus.org/>`_ is a multi-language stemming
14 library with `Python bindings <http://snowball.tartarus.org/wrappers/PyStemmer-1.0.1.tar.gz>`_.
15
16 Usage
17 ~~~~~
18
19 ::
20
21     snowball://<language>
22
23 ``<language>``
24     Any of the languages supported by Snowball.
25
26
27 Installation
28 ~~~~~~~~~~~~
29
30 The Python bindings ship with the Snowball source, so it's an easy (and
31 recommended) install.
32
33 ::
34
35     easy_install http://snowball.tartarus.org/wrappers/PyStemmer-1.0.1.tar.gz
36
37 """
38
39 import Stemmer
40 from pyndexter import PluginFactory
41
42 class SnowballStemmer(object):
43     def __init__(self, language):
44         self.stemmer = Stemmer.Stemmer(language)
45
46     def __call__(self, word):
47         return self.stemmer.stemWord(word)
48
49 stemmer_factory = PluginFactory(SnowballStemmer, host="language")
Note: See TracBrowser for help on using the browser.