summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2026-02-18 02:40:25 +0900
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2026-03-26 06:39:05 +0100
commitd884eb3ce70b70a5f281f8df46a939d6d91cad26 (patch)
tree225343e889c202138c3c69ba2b002eb77e8e985f /gnu
parenteff1709a0d90fe37308a39c3790c05b0a027eaaa (diff)
gnu: Add python-lexilang.
* gnu/packages/language.scm (python-lexilang): New variable. Change-Id: I0342433381e9e06f336aed52f39a5a6972ea2b50 Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/language.scm43
1 files changed, 43 insertions, 0 deletions
diff --git a/gnu/packages/language.scm b/gnu/packages/language.scm
index 32a6dd6dc05..56317758176 100644
--- a/gnu/packages/language.scm
+++ b/gnu/packages/language.scm
@@ -1066,6 +1066,49 @@ from the database are used as entries (heading terms).")
;; triple-licensed (at the user’s choice)
(license (list license:gpl2+ license:lgpl2.1 license:bsd-3))))
+(define-public python-lexilang
+ (package
+ (name "python-lexilang")
+ (version "1.0.7")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/LibreTranslate/LexiLang")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256 (base32 "0myrim1m9zq65y5c77wq4f9ix024lyw8dvjxws33qkfsd6xzvwz7"))
+ (modules '((guix build utils)))
+ (snippet ;use src layout for isolated tests
+ #~(begin
+ (mkdir "src")
+ (rename-file "dictionaries" "src/dictionaries")
+ (rename-file "lexilang" "src/lexilang")
+ (substitute* "setup.py"
+ (("packages=" all)
+ (string-append "package_dir={'': 'src'}, " all)))))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:phases #~(modify-phases %standard-phases
+ (add-after 'unpack 'compile-data
+ (lambda _
+ (with-directory-excursion "src"
+ (invoke "python" "-c"
+ "from lexilang.utils import compile_data
+compile_data()")))))
+ #:test-backend #~'custom
+ #:test-flags #~'("test.py")))
+ (native-inputs (list python-setuptools))
+ (home-page "https://github.com/LibreTranslate/LexiLang")
+ (synopsis "Dictionary-based language detector for short texts")
+ (description
+ "LexiLang is a natural language detector, designed for handling small text
+(under 20 characters). It will probably not work reliably
+for longer text sequences. As it relies on dictionaries,
+if a word is missing or mispelled, the detection will fail.")
+ (license license:agpl3)))
+
(define-public python-sacremoses
(package
(name "python-sacremoses")