Skip to content

Library

esperantilo is a rule-based Natural Language Processing library for Esperanto. This section is its reference manual: what it does, how to install it, and what every public name means.

Reference, not tutorial

These pages document the library as it is. You will find the guide here.

Two features so far

The library is at version 0.1.0 and ships two things: reading Wikipedia articles, and sentence segmentation. Everything else — tokens, lemmas, affix analysis — is still a design target, not shipped code.

Installation

The library depends on requests, which pip pulls in with it. Install it straight from GitHub:

pip install git+https://github.com/jparisu/nlp-esperantilo.git

Step-by-step instructions, including virtual environments and notebooks, are in Guide → Installation and usage.

Quick start

import esperantilo

# Fetch a Wikipedia article in Esperanto.
page = esperantilo.WikiPage.look_up("Esperanto", language="eo")

# Split the text into sentences.
sentences = esperantilo.sentence_tokenizer(page.full_text())

The public API

Everything the library promises to keep stable is importable directly from the top-level esperantilo module:

Name Kind What it is
WikiPage class One Wikipedia article, in one language, as plain text.
sentence_tokenizer function Splits a text into sentences.
__version__ constant The installed version.

Structure

src/esperantilo/
├── __init__.py      # the public API: re-exports and __all__
├── nlp/             # analysing text that is already in hand
│   └── tokenizer.py #   sentence segmentation
└── wiki/            # fetching text from Wikipedia
    ├── wiki.py      #   the WikiPage class
    └── _wiki_api.py #   private: the MediaWiki and Wikidata clients

The API reference is generated from those files every time the site is built, so change a docstring and the page changes with it.