Skip to main content

Library for reading ARPA n-gram models.

Project description

Python ARPA Package

Python library for reading ARPA n-gram models.

Setup

Python 3.4+

PyPI Python Versions PyPI Version

In order to install the Python 3 version:

$ pip install --user -U arpa

Python 2.7

PyPI Python Versions PyPI Version

In order to install the Python 2.7 version:

$ pip install --user -U arpa-backport

Usage

The package may be imported directly:

import arpa  # Python 3.4+
# OR
import arpa_backport as arpa  # Python 2.7

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)

Development

Travis Documentation Status Coverage Status

Contributions are welcome!
Write a bug report or send a pull request.
Other contributors have done so before.

License

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

History

All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
You should Keep a CHANGELOG, too!

Next Release

Added

Changed

Deprecated

Fixed

Removed

Security

0.1.0b4 - 2018-12-12

0.1.0b3 - 2018-12-06

0.1.0b2 - 2018-04-28

0.1.0b1 - 2015-09-13

0.1.0a6 - 2015-07-24

0.1.0a5 - 2015-07-19

0.1.0a4 - 2015-07-14

0.1.0a3 - 2015-07-10

0.1.0a2 - 2015-07-05

0.1.0a1 - 2015-07-05

First release on PyPI.

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

arpa-0.1.0b4.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

arpa-0.1.0b4-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file arpa-0.1.0b4.tar.gz.

File metadata

  • Download URL: arpa-0.1.0b4.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for arpa-0.1.0b4.tar.gz
Algorithm Hash digest
SHA256 4b740cb8796219335dcb476297430ad47ea59c22993295a3a5c1afcda66d79db
MD5 e32b7a2c68abf45c544bf6ce6f98a821
BLAKE2b-256 ab1e04d7252515a66416cc0fee0a55316872c9e3d9f93ba48ea3cf9d76af3118

See more details on using hashes here.

File details

Details for the file arpa-0.1.0b4-py3-none-any.whl.

File metadata

  • Download URL: arpa-0.1.0b4-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for arpa-0.1.0b4-py3-none-any.whl
Algorithm Hash digest
SHA256 7df030d388eade2aee366663d8986506d97436b91f03172f5770f8a150de4d7f
MD5 1f45c8c9a77cc5f500fbb50a76f16532
BLAKE2b-256 c68ef396e5e9fc47bf06891e25211f59bd15f37260046c43aea8131efd8ec6e6

See more details on using hashes here.

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