ablt 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ablt/__init__.py ADDED
@@ -0,0 +1,13 @@
1
+ # Copyright 2025-2026 Mathew Sekanjako and Psalms23Wave LLC
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """ABLT: a grammar-first tokenizer for Luganda and other Bantu languages."""
4
+
5
+ from .segmenter import cut, show_cuts, split_word
6
+ from .tokenizer import ABLT
7
+
8
+ __version__ = "2.0.0"
9
+ __author__ = "Mathew Sekanjako"
10
+ __copyright__ = "Copyright 2025-2026 Mathew Sekanjako and Psalms23Wave LLC"
11
+ __license__ = "Apache-2.0"
12
+ __url__ = "https://www.sekanjakomathew.com"
13
+ __all__ = ["ABLT", "cut", "show_cuts", "split_word"]
ablt/cli.py ADDED
@@ -0,0 +1,59 @@
1
+ # Copyright 2025-2026 Mathew Sekanjako and Psalms23Wave LLC
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """Use ABLT from the terminal.
4
+
5
+ ablt "Abantu basoma ebitabo." show the pieces
6
+ ablt --cuts "Abantu basoma ebitabo." show where the grammar cuts fall
7
+ ablt --ids "Abantu basoma ebitabo." show the piece numbers
8
+ ablt < story.txt read lines from a file
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import argparse
14
+ import sys
15
+
16
+ from . import __version__
17
+ from .segmenter import show_cuts
18
+ from .tokenizer import ABLT
19
+
20
+
21
+ def main(arguments: list[str] | None = None) -> int:
22
+ parser = argparse.ArgumentParser(
23
+ prog="ablt",
24
+ description="ABLT: a grammar-first tokenizer for Luganda, by Mathew Sekanjako (Psalms23Wave LLC).",
25
+ )
26
+ parser.add_argument(
27
+ "text",
28
+ nargs="*",
29
+ help="text to tokenize; if left out, lines are read from standard input",
30
+ )
31
+ output = parser.add_mutually_exclusive_group()
32
+ output.add_argument(
33
+ "--cuts", action="store_true", help="show the text with | at each grammar cut"
34
+ )
35
+ output.add_argument(
36
+ "--ids", action="store_true", help="show piece numbers instead of pieces"
37
+ )
38
+ credit = f"ablt {__version__}. Copyright 2025-2026 Mathew Sekanjako and Psalms23Wave LLC. Apache-2.0."
39
+ parser.add_argument("--version", action="version", version=credit)
40
+ options = parser.parse_args(arguments)
41
+
42
+ lines = (
43
+ [" ".join(options.text)]
44
+ if options.text
45
+ else (line.rstrip("\n") for line in sys.stdin)
46
+ )
47
+ tokenizer = None if options.cuts else ABLT()
48
+ for line in lines:
49
+ if options.cuts:
50
+ print(show_cuts(line))
51
+ elif options.ids:
52
+ print(" ".join(str(index) for index in tokenizer.encode(line)))
53
+ else:
54
+ print(" ".join(tokenizer.tokenize(line)))
55
+ return 0
56
+
57
+
58
+ if __name__ == "__main__":
59
+ raise SystemExit(main())
ablt/models/README.txt ADDED
@@ -0,0 +1,4 @@
1
+ ABLT Luganda model, version 2.
2
+ Copyright 2025-2026 Mathew Sekanjako and Psalms23Wave LLC. Licensed under Apache-2.0.
3
+ Trained on Luganda text that includes the SALT dataset by Sunbird AI (CC BY-SA 4.0).
4
+ SHA256SUMS lists the fingerprints of the files in this folder.
ablt/models/SHA256SUMS ADDED
@@ -0,0 +1,2 @@
1
+ 99d102dcc9c717269b5333db6197c52459d17fb99641774ba7c90060341ca6b6 ablt-luganda-v2.model
2
+ 4249afe472f4e4f7c1f2596174d6224fed270b0e559543636585c06783ccb19a ablt-luganda-v2.joiners.json