跳转到主要内容

使用Python 2.7读取ARPA n-gram模型的库。

项目描述

Python ARPA包

Python库,用于读取ARPA n-gram模型。

安装

Python 3.4+

PyPI Python Versions PyPI Version

为了安装Python 3版本

$ pip install --user -U arpa

Python 2.7

PyPI Python Versions PyPI Version

为了安装Python 2.7版本

$ pip install --user -U arpa-backport

用法

可以直接导入此包

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)

开发

Travis Documentation Status Coverage Status

欢迎贡献!
编写错误报告或发送拉取请求。
其他贡献者 已这样做。

许可协议

版权(c)2015-2018 Stefan Fischer
源代码可在 MIT 许可证 下获得。
有关详细信息,请参阅 LICENSE

历史

本项目所有显著的更改都将记录在此文件中。
本项目遵循 语义版本控制
您也应该 维护一个变更日志

下一个版本

新增

更改

弃用

修复

移除

安全

0.1.0b4 - 2018-12-12

0.1.0b3 - 2018-12-06

首次发布在 PyPI 上。

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪一个,请了解更多关于 安装包 的信息。

源代码分发

arpa-backport-0.1.0b4.tar.gz (29.7 kB 查看哈希值)

上传时间 源代码

构建分发

arpa_backport-0.1.0b4-py2-none-any.whl (10.4 kB 查看哈希值)

上传时间 Python 2

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面