langtoken-toolkit 0.1.0__tar.gz
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.
- langtoken_toolkit-0.1.0/LICENSE +17 -0
- langtoken_toolkit-0.1.0/PKG-INFO +23 -0
- langtoken_toolkit-0.1.0/README +88 -0
- langtoken_toolkit-0.1.0/langtoken_toolkit.egg-info/PKG-INFO +23 -0
- langtoken_toolkit-0.1.0/langtoken_toolkit.egg-info/SOURCES.txt +8 -0
- langtoken_toolkit-0.1.0/langtoken_toolkit.egg-info/dependency_links.txt +1 -0
- langtoken_toolkit-0.1.0/langtoken_toolkit.egg-info/requires.txt +1 -0
- langtoken_toolkit-0.1.0/langtoken_toolkit.egg-info/top_level.txt +1 -0
- langtoken_toolkit-0.1.0/pyproject.toml +49 -0
- langtoken_toolkit-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LangToken Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: langtoken-toolkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A modular Python library for text tokenization.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/Emeka320/LangToken
|
|
7
|
+
Project-URL: Repository, https://github.com/Emeka320/LangToken
|
|
8
|
+
Project-URL: Issues, https://github.com/Emeka320/LangToken/issues
|
|
9
|
+
Keywords: tokenization,tokenizer,nlp,natural-language-processing,bpe,wordpiece,unigram,sentencepiece
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: regex>=2024.11.6
|
|
23
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
|
|
2
|
+
# LangToken
|
|
3
|
+
|
|
4
|
+
A modular Python library for text tokenization.
|
|
5
|
+
|
|
6
|
+
LangToken provides implementations of several tokenization
|
|
7
|
+
algorithms, organized into three main families:
|
|
8
|
+
|
|
9
|
+
- Subword tokenizers
|
|
10
|
+
- Character tokenizers
|
|
11
|
+
- Word tokenizers
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install langtoken-toolkit
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
### Subword Tokenizers
|
|
22
|
+
- BPE
|
|
23
|
+
- Byte-Level BPE
|
|
24
|
+
- WordPiece
|
|
25
|
+
- Unigram
|
|
26
|
+
- SentencePiece
|
|
27
|
+
|
|
28
|
+
### Character Tokenizers
|
|
29
|
+
- Character Tokenizer
|
|
30
|
+
- Character Shingle
|
|
31
|
+
|
|
32
|
+
### Word Tokenizers
|
|
33
|
+
- Word Tokenizer
|
|
34
|
+
- Whitespace Word Tokenizer
|
|
35
|
+
- Standard Word Tokenizer
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from langtoken import BPE
|
|
41
|
+
|
|
42
|
+
corpus = [
|
|
43
|
+
"The quick brown fox",
|
|
44
|
+
"The fox jumps over the dog",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
tokenizer = BPE()
|
|
48
|
+
|
|
49
|
+
tokenizer.train(
|
|
50
|
+
corpus,
|
|
51
|
+
vocab_size=100,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
text = "The quick brown fox"
|
|
55
|
+
|
|
56
|
+
tokens = tokenizer.encode(text)
|
|
57
|
+
ids = tokenizer.encode_ids(text)
|
|
58
|
+
|
|
59
|
+
print("Tokens:", tokens)
|
|
60
|
+
print("IDs:", ids)
|
|
61
|
+
|
|
62
|
+
print("Decoded:", tokenizer.decode(tokens))
|
|
63
|
+
print("Decoded IDs:", tokenizer.decode_ids(ids))
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Saving and Loading
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
tokenizer.save("tokenizer.json")
|
|
70
|
+
|
|
71
|
+
loaded = BPE.load("tokenizer.json")
|
|
72
|
+
|
|
73
|
+
print(loaded.encode("The quick brown fox"))
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Project Structure
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
langtoken/
|
|
80
|
+
base.py
|
|
81
|
+
subword/
|
|
82
|
+
char/
|
|
83
|
+
word/
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT License
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: langtoken-toolkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A modular Python library for text tokenization.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/Emeka320/LangToken
|
|
7
|
+
Project-URL: Repository, https://github.com/Emeka320/LangToken
|
|
8
|
+
Project-URL: Issues, https://github.com/Emeka320/LangToken/issues
|
|
9
|
+
Keywords: tokenization,tokenizer,nlp,natural-language-processing,bpe,wordpiece,unigram,sentencepiece
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: regex>=2024.11.6
|
|
23
|
+
Dynamic: license-file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
regex>=2024.11.6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "langtoken-toolkit"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A modular Python library for text tokenization."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
|
|
14
|
+
keywords = [
|
|
15
|
+
"tokenization",
|
|
16
|
+
"tokenizer",
|
|
17
|
+
"nlp",
|
|
18
|
+
"natural-language-processing",
|
|
19
|
+
"bpe",
|
|
20
|
+
"wordpiece",
|
|
21
|
+
"unigram",
|
|
22
|
+
"sentencepiece",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 3 - Alpha",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Programming Language :: Python :: 3.13",
|
|
33
|
+
"Topic :: Text Processing :: Linguistic",
|
|
34
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
dependencies = [
|
|
38
|
+
"regex>=2024.11.6",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/Emeka320/LangToken"
|
|
43
|
+
Repository = "https://github.com/Emeka320/LangToken"
|
|
44
|
+
Issues = "https://github.com/Emeka320/LangToken/issues"
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.packages.find]
|
|
47
|
+
where = ["."]
|
|
48
|
+
include = ["langtoken*"]
|
|
49
|
+
exclude = ["tests*"]
|