Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A Snowball-to-Python compiler

Project Description

sbl2py translates code written in the Snowball string processing language into Python:

import sbl2py
import sbl2py.utils

sbl_code = """
externals ( stem )
define stem as (
    backwards ( ['ly'] delete )
py_code = sbl2py.translate_string(sbl_code)
module = sbl2py.utils.module_from_code('demo_module', py_code)
print module.stem('fabulously')




sbl2py should support all of the Snowball features that are commonly used. In particular, all features used by the stemming algorithms from the Snowball stemmer package are supported.


Installing sbl2py is easy using pip:

pip install sbl2py


The easiest way to translate a Snowball file into a Python module is using the sbl2py script which is automatically installed with sbl2py:


See sbl2py --help for the available options.

You can also use sbl2py from within Python. The sbl2py module offers two functions that translate Snowball code from a string (translate_string) or a file (translate_file) and return the corresponding Python source as a string. If you want to execute the code, simply use the module_from_code function of the sbl2py.utils module.

The generated Python modules export all routines from the original Snowball code that are listed in the externals section. That is, if you have externals ( stem ) in your Snowball code and store the generated Python module in a file called then you can call the stem routine as follows:

import mystemmer
print mystemmer.stem('foobar')


sbl2py is covered by the MIT License. The Snowball source code and the word lists in the test directory are covered by the BSD-3 License. Please see the LICENSE file for details.

Release History

This version
History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(17.2 kB) Copy SHA256 Hash SHA256
Source Aug 5, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting