git: 96b49826ef20 - main - misc/py-kenlm: New port: KenLM: Faster and Smaller Language Model Queries

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 20 Oct 2026 19:36:11 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=96b49826ef20949003c3cf20486e4f6a0a23685b

commit 96b49826ef20949003c3cf20486e4f6a0a23685b
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-10-20 19:35:09 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-10-20 19:36:02 +0000

    misc/py-kenlm: New port: KenLM: Faster and Smaller Language Model Queries
    
    PR:             298596
    Approved by:    Baptiste Daroussin <bapt@FreeBSD.org> (on behalf of portmgr@)
---
 misc/Makefile                            |  1 +
 misc/py-kenlm/Makefile                   | 21 +++++++++++++++++++++
 misc/py-kenlm/distinfo                   |  3 +++
 misc/py-kenlm/files/patch-pyproject.toml |  6 ++++++
 misc/py-kenlm/pkg-descr                  |  8 ++++++++
 5 files changed, 39 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index 2a88a2dfda80..be0a515297b8 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -542,6 +542,7 @@
     SUBDIR += py-ipyfastscape
     SUBDIR += py-jiwer
     SUBDIR += py-kartograph
+    SUBDIR += py-kenlm
     SUBDIR += py-kokoro
     SUBDIR += py-langchain
     SUBDIR += py-langchain-anthropic
diff --git a/misc/py-kenlm/Makefile b/misc/py-kenlm/Makefile
new file mode 100644
index 000000000000..2921b5e1b286
--- /dev/null
+++ b/misc/py-kenlm/Makefile
@@ -0,0 +1,21 @@
+PORTNAME=	kenlm
+DISTVERSION=	0.3.0
+CATEGORIES=	misc
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	KenLM: Faster and Smaller Language Model Queries
+WWW=		https://kheafield.com/code/kenlm/
+
+LICENSE=	LGPL21
+
+BUILD_DEPENDS=	${PY_SETUPTOOLS} \
+		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
+
+USES=		cmake:indirect python
+USE_PYTHON=	pep517 autoplist
+
+TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+
+.include <bsd.port.mk>
diff --git a/misc/py-kenlm/distinfo b/misc/py-kenlm/distinfo
new file mode 100644
index 000000000000..c009a85e5654
--- /dev/null
+++ b/misc/py-kenlm/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1755883459
+SHA256 (kenlm-0.3.0.tar.gz) = c4628bb9fb63c8a6f9240035b8b037385cfc404cb72e933cf48878291edac1e8
+SIZE (kenlm-0.3.0.tar.gz) = 427500
diff --git a/misc/py-kenlm/files/patch-pyproject.toml b/misc/py-kenlm/files/patch-pyproject.toml
new file mode 100644
index 000000000000..cee6ebd87145
--- /dev/null
+++ b/misc/py-kenlm/files/patch-pyproject.toml
@@ -0,0 +1,6 @@
+--- pyproject.toml.orig	2026-09-17 06:52:08 UTC
++++ pyproject.toml
+@@ -1,2 +1,2 @@
+ [build-system]
+-requires = ["setuptools", "wheel", "cmake>=3.10"]
++requires = ["setuptools", "wheel"]
diff --git a/misc/py-kenlm/pkg-descr b/misc/py-kenlm/pkg-descr
new file mode 100644
index 000000000000..b8f9898b9d1a
--- /dev/null
+++ b/misc/py-kenlm/pkg-descr
@@ -0,0 +1,8 @@
+KenLM is a fast and memory-efficient library for estimating and querying
+n-gram language models.
+
+This package provides the official Python bindings for KenLM, allowing users
+to load trained language models, query n-gram probabilities, and compute
+sentence scores directly within Python pipelines. It is commonly used in
+speech recognition, machine translation, and text generation tasks for fast
+perplexity estimation.