Skip to main content

This is a library for reading ARPA n-gram models.

Project description

PyPI Version PyPI Downloads Travis Coverage Status Dependency Status

This is a library for reading ARPA n-gram models.
Python 3.2+ and Wheels are supported.
It was initiated by Stefan Fischer and is developed and maintained by many others.

Install

PyPI Python Versions PyPI Wheel

The package is available on PyPI:

$ pip install arpa

Use

The package may be imported directly:

import arpa
models = arpa.loadf("foo.arpa")
lm = models[0]  # ARPA files may contain several models.

# probability p(end|in, the)
lm.p("in the end")
lm.log_p("in the end")

# sentence score w/ sentence markers
lm.s("This is the end .")
lm.log_s("This is the end .")

# sentence score w/o sentence markers
lm.s("This is the end .", sos=False, eos=False)
lm.log_s("This is the end .", sos=False, eos=False)

Contribute

Write a bug report or send a pull request.
Other contributors have done so before.

License

Copyright (c) 2015 Stefan Fischer
The source code is available under the MIT License.
See LICENSE for further details.

Project details


Download files

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

Files for arpa, version 0.1.0b1
Filename, size File type Python version Upload date Hashes
Filename, size arpa-0.1.0b1-py3-none-any.whl (10.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size arpa-0.1.0b1.tar.gz (7.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page