Library for reading ARPA n-gram models with Python 2.7.
Project description
Python ARPA Package
Python library for reading ARPA n-gram models.
It was initiated by Stefan Fischer and is developed and maintained by many others.
- Documentation is available.
- Changes between releases are documented.
- Bugs can be reported on the issue tracker.
- Questions can be asked via e-mail.
- Source code is tracked on GitHub.
Setup
The package is available on PyPI:
$ pip install arpa-backport
Usage
NOTE:
Like its Python 3 equivalent, this library uses unicode strings.
Using byte strings (str
) will cause an exception.
The package may be imported directly:
import arpa-backport as 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-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.0b3 - 2018-12-06
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for arpa_backport-0.1.0b3-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 095ac15e9eab8ebf216e63e00f220df10fd95ed38adfd0bc0f54515fd07cd22c |
|
MD5 | c4c852132a409a7e5f982e83be6698db |
|
BLAKE2b-256 | 4640199e5706eb1d344d7146dc947a2e028c3018441851f6ae7842bbffed6e87 |