- Notifications
You must be signed in to change notification settings - Fork13
🐍 Python library for n-gram models in ARPA format
License
NotificationsYou must be signed in to change notification settings
sfischer13/python-arpa
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Python library for reading ARPA n-gram models.
- 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.
In order to install the Python 3 version:
$ pip install --user -U arpa
In order to install the Python 2.7 version:
$ pip install --user -U arpa-backport
The package may be imported directly:
import arpa # Python 3.4+# ORimport arpa_backport as arpa # Python 2.7models = 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 markerslm.s("This is the end .")lm.log_s("This is the end .")# sentence score w/o sentence markerslm.s("This is the end .", sos=False, eos=False)lm.log_s("This is the end .", sos=False, eos=False)
Contributions are welcome!
Write a bug report or send a pull request.
Othercontributors have done so before.
Copyright (c) 2015-2018 Stefan Fischer
The source code is available under theMIT License.
SeeLICENSE for further details.
About
🐍 Python library for n-gram models in ARPA format
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published