[Xapian-discuss] python how do i stem words in python?

Olly Betts olly at survex.com
Sat Aug 16 02:27:01 BST 2008


On Fri, Aug 15, 2008 at 05:52:40PM -0700, mark wrote:
> there is no stemmer.stem_word method in the latest python library. how
> do i stem words before doing doc.add_posting?

It's operator() in C++ which is wrapped as a __call__ method in Python.
So use it like this:

    stemmer = xapian.Stem("english")
    stem = stemmer("sausages")

> is there any sample hello world code in python that i can use?

There are some examples in the documentation, which you should have got
when you installed the bindings.  If not, complain to whoever built the
packages you're using.  You can browse them online too, linked from
here:

http://xapian.org/docs/bindings/python/

Cheers,
    Olly



More information about the Xapian-discuss mailing list