Skip to main content

Opinionated Czech Language Processing

Project description

Vltava

PyPI Test Publish

Opinionated Czech language processing.

The processor takes in raw documents and applies basic preprocessing (such as tags and accent striping) and lemmatization using either Majka or MorphoDiTa.

from vltava import DocumentProcessor

doc = "v televizi říkali, že zítra pršet nebude"
document_processor = DocumentProcessor()
result = document_processor.process(doc)
# result is ['televize', 'rikat', 'zitra', 'prset', 'byt']

DocumentProcessor supports multiprocessing when dealing with large collections of documents.

from vltava import DocumentProcessor

docs = ["Ahoj, jak se máš?"] * 100

result = DocumentProcessor().process_from_iterable(docs, n_jobs=2)

Installation

pip install vltava

Backend

The package is using two different backends for finding Czech lemmas: Majka, MorphoDiTa. Check out the links for more information. The required binary files are contained directly in the package.

Public API

vltava.DocumentProcessor

vltava.DocumentProcessor(backend: str = "majka")

Initializes DocumentProcessor with the selected backend.

Methods:

DocumentProcessor.process(
    self, doc: str, tokenize: bool = True
) -> Union[str, List[str]]

Processes the input doc and returns it as a processed string or a list of processed tokens, if tokenize is True.

DocumentProcessor.process_from_iterable(
    self, docs: Iterable[str], tokenize: bool = True, n_jobs: int = 1
) -> Union[Iterable[str], Iterable[List[str]]]:

Processes the input docs collection of documents. Result is either an iterable of processed strings or an iterable of lists of processed tokens (if tokenize is True).

If n_jobs is greater than one, multiple worker are launched to process the documents.

Project details


Download files

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

Source Distribution

vltava-0.1.3.tar.gz (5.1 MB view hashes)

Uploaded Source

Built Distribution

vltava-0.1.3-py3-none-any.whl (5.1 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page