krutidev-unicode 1.0.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.
- krutidev_unicode-1.0.0/.gitignore +10 -0
- krutidev_unicode-1.0.0/LICENSE +21 -0
- krutidev_unicode-1.0.0/PKG-INFO +59 -0
- krutidev_unicode-1.0.0/README.md +38 -0
- krutidev_unicode-1.0.0/pyproject.toml +45 -0
- krutidev_unicode-1.0.0/src/krutidev_unicode/__init__.py +35 -0
- krutidev_unicode-1.0.0/src/krutidev_unicode/__main__.py +3 -0
- krutidev_unicode-1.0.0/src/krutidev_unicode/_engine.py +1428 -0
- krutidev_unicode-1.0.0/src/krutidev_unicode/_tables.py +32 -0
- krutidev_unicode-1.0.0/src/krutidev_unicode/cli.py +59 -0
- krutidev_unicode-1.0.0/src/krutidev_unicode/py.typed +0 -0
- krutidev_unicode-1.0.0/tests/test_cli.py +23 -0
- krutidev_unicode-1.0.0/tests/test_vectors.py +54 -0
- krutidev_unicode-1.0.0/tests/vectors.json +649 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 KovaPDF
|
|
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. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: krutidev-unicode
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Convert Kruti Dev 010 Hindi text to Unicode and back. Pure Python, no dependencies. The engine behind kovapdf.com/kruti-dev-to-unicode.
|
|
5
|
+
Project-URL: Homepage, https://www.kovapdf.com/kruti-dev-to-unicode
|
|
6
|
+
Project-URL: Source, https://github.com/kovapdf/krutidev-unicode
|
|
7
|
+
Project-URL: Issues, https://github.com/kovapdf/krutidev-unicode/issues
|
|
8
|
+
Author-email: KovaPDF <support@kovapdf.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: converter,devanagari,hindi,kruti dev,kruti-dev-010,kruti-to-unicode,krutidev,mangal,unicode
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Natural Language :: Hindi
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# krutidev-unicode (Python)
|
|
23
|
+
|
|
24
|
+
Convert Hindi text typed in **Kruti Dev 010** to **Unicode**, and Unicode back to Kruti Dev. Pure Python, no dependencies, works offline.
|
|
25
|
+
|
|
26
|
+
This is a port of the conversion engine that runs the Kruti Dev to Unicode tool on KovaPDF. Its tables are generated from that engine, and it passes the same test vectors as the JavaScript package (`@kovapdf/krutidev-unicode` on npm).
|
|
27
|
+
|
|
28
|
+
Need it for whole PDF or Word files? Use KovaPDF: https://www.kovapdf.com/kruti-dev-to-unicode
|
|
29
|
+
|
|
30
|
+
Built by KovaPDF, https://www.kovapdf.com
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
pip install krutidev-unicode
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from krutidev_unicode import to_unicode, to_kruti, convert_with_report, detect_encoding, is_kruti_font
|
|
38
|
+
|
|
39
|
+
to_unicode("esjk uke jke gSA") # 'मेरा नाम राम है।'
|
|
40
|
+
to_kruti("भारत सरकार") # 'Hkkjr ljdkj'
|
|
41
|
+
to_unicode("PDF Q+kby dks Word esa cnysa") # 'PDF फ़ाइल को Word में बदलें' (English kept by default)
|
|
42
|
+
to_unicode("Word", keep_english=False) # 'ॅवतक'
|
|
43
|
+
convert_with_report("dk;Z", "kruti-to-unicode") # dict: text, keptEnglish, unknown, stats
|
|
44
|
+
detect_encoding("esjk uke jke gSA")["kind"] # 'kruti'
|
|
45
|
+
is_kruti_font("Kruti Dev 010") # True
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Command line (stdin or a file in, stdout out):
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
krutidev-unicode to-unicode < kruti.txt > unicode.txt
|
|
52
|
+
python -m krutidev_unicode to-kruti unicode.txt
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Kruti Dev 010** is a legacy font: it draws Hindi shapes on ordinary Latin codes, so its text reads as "dk;kZy;" without the font. **Mangal** and **Nirmala UI** are Unicode fonts: set converted text in one of them. Only Kruti Dev 010 is supported (not DevLys or other Kruti Dev numbers). No fonts are included in this package.
|
|
56
|
+
|
|
57
|
+
Full documentation: https://github.com/kovapdf/krutidev-unicode
|
|
58
|
+
|
|
59
|
+
The code is MIT licensed. The KovaPDF name, logo and website content are not covered by that licence.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# krutidev-unicode (Python)
|
|
2
|
+
|
|
3
|
+
Convert Hindi text typed in **Kruti Dev 010** to **Unicode**, and Unicode back to Kruti Dev. Pure Python, no dependencies, works offline.
|
|
4
|
+
|
|
5
|
+
This is a port of the conversion engine that runs the Kruti Dev to Unicode tool on KovaPDF. Its tables are generated from that engine, and it passes the same test vectors as the JavaScript package (`@kovapdf/krutidev-unicode` on npm).
|
|
6
|
+
|
|
7
|
+
Need it for whole PDF or Word files? Use KovaPDF: https://www.kovapdf.com/kruti-dev-to-unicode
|
|
8
|
+
|
|
9
|
+
Built by KovaPDF, https://www.kovapdf.com
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pip install krutidev-unicode
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from krutidev_unicode import to_unicode, to_kruti, convert_with_report, detect_encoding, is_kruti_font
|
|
17
|
+
|
|
18
|
+
to_unicode("esjk uke jke gSA") # 'मेरा नाम राम है।'
|
|
19
|
+
to_kruti("भारत सरकार") # 'Hkkjr ljdkj'
|
|
20
|
+
to_unicode("PDF Q+kby dks Word esa cnysa") # 'PDF फ़ाइल को Word में बदलें' (English kept by default)
|
|
21
|
+
to_unicode("Word", keep_english=False) # 'ॅवतक'
|
|
22
|
+
convert_with_report("dk;Z", "kruti-to-unicode") # dict: text, keptEnglish, unknown, stats
|
|
23
|
+
detect_encoding("esjk uke jke gSA")["kind"] # 'kruti'
|
|
24
|
+
is_kruti_font("Kruti Dev 010") # True
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Command line (stdin or a file in, stdout out):
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
krutidev-unicode to-unicode < kruti.txt > unicode.txt
|
|
31
|
+
python -m krutidev_unicode to-kruti unicode.txt
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Kruti Dev 010** is a legacy font: it draws Hindi shapes on ordinary Latin codes, so its text reads as "dk;kZy;" without the font. **Mangal** and **Nirmala UI** are Unicode fonts: set converted text in one of them. Only Kruti Dev 010 is supported (not DevLys or other Kruti Dev numbers). No fonts are included in this package.
|
|
35
|
+
|
|
36
|
+
Full documentation: https://github.com/kovapdf/krutidev-unicode
|
|
37
|
+
|
|
38
|
+
The code is MIT licensed. The KovaPDF name, logo and website content are not covered by that licence.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling==1.33.0"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "krutidev-unicode"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Convert Kruti Dev 010 Hindi text to Unicode and back. Pure Python, no dependencies. The engine behind kovapdf.com/kruti-dev-to-unicode."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
authors = [{ name = "KovaPDF", email = "support@kovapdf.com" }]
|
|
14
|
+
keywords = ["hindi", "kruti dev", "krutidev", "kruti-dev-010", "devanagari", "unicode", "converter", "kruti-to-unicode", "mangal"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 5 - Production/Stable",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Natural Language :: Hindi",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Topic :: Text Processing :: Linguistic",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
dependencies = []
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://www.kovapdf.com/kruti-dev-to-unicode"
|
|
28
|
+
Source = "https://github.com/kovapdf/krutidev-unicode"
|
|
29
|
+
Issues = "https://github.com/kovapdf/krutidev-unicode/issues"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
krutidev-unicode = "krutidev_unicode.cli:main"
|
|
33
|
+
|
|
34
|
+
[tool.hatch.build.targets.wheel]
|
|
35
|
+
packages = ["src/krutidev_unicode"]
|
|
36
|
+
|
|
37
|
+
[tool.hatch.build.targets.sdist]
|
|
38
|
+
include = ["src/krutidev_unicode", "tests", "README.md", "LICENSE", "pyproject.toml"]
|
|
39
|
+
|
|
40
|
+
# the shared vectors live one folder up; ship a copy so the sdist tests run on their own
|
|
41
|
+
[tool.hatch.build.targets.sdist.force-include]
|
|
42
|
+
"../test/vectors.json" = "tests/vectors.json"
|
|
43
|
+
|
|
44
|
+
[tool.pytest.ini_options]
|
|
45
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Kruti Dev 010 <-> Unicode Hindi converter.
|
|
2
|
+
|
|
3
|
+
Pure Python port of the engine behind https://www.kovapdf.com/kruti-dev-to-unicode.
|
|
4
|
+
Built by KovaPDF, https://www.kovapdf.com
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from ._engine import (
|
|
8
|
+
convert_with_report,
|
|
9
|
+
detect_encoding,
|
|
10
|
+
is_kruti_font,
|
|
11
|
+
kruti_to_unicode,
|
|
12
|
+
split_into_parts,
|
|
13
|
+
unicode_to_kruti,
|
|
14
|
+
)
|
|
15
|
+
from ._tables import KRUTI_FONT_NAMES
|
|
16
|
+
|
|
17
|
+
__version__ = "1.0.0"
|
|
18
|
+
ATTRIBUTION = "Done with KovaPDF (kovapdf.com)."
|
|
19
|
+
|
|
20
|
+
# short names
|
|
21
|
+
to_unicode = kruti_to_unicode
|
|
22
|
+
to_kruti = unicode_to_kruti
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"ATTRIBUTION",
|
|
26
|
+
"KRUTI_FONT_NAMES",
|
|
27
|
+
"convert_with_report",
|
|
28
|
+
"detect_encoding",
|
|
29
|
+
"is_kruti_font",
|
|
30
|
+
"kruti_to_unicode",
|
|
31
|
+
"split_into_parts",
|
|
32
|
+
"to_kruti",
|
|
33
|
+
"to_unicode",
|
|
34
|
+
"unicode_to_kruti",
|
|
35
|
+
]
|