dhivehin-num 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.
- dhivehin_num-0.1.0/PKG-INFO +25 -0
- dhivehin_num-0.1.0/README.md +17 -0
- dhivehin_num-0.1.0/pyproject.toml +16 -0
- dhivehin_num-0.1.0/src/dhivehin_num/__init__.py +4 -0
- dhivehin_num-0.1.0/src/dhivehin_num/converter.py +57 -0
- dhivehin_num-0.1.0/src/dhivehin_num/numbers.py +42 -0
- dhivehin_num-0.1.0/src/dhivehin_num.egg-info/PKG-INFO +6 -0
- dhivehin_num-0.1.0/src/dhivehin_num.egg-info/SOURCES.txt +8 -0
- dhivehin_num-0.1.0/src/dhivehin_num.egg-info/dependency_links.txt +1 -0
- dhivehin_num-0.1.0/src/dhivehin_num.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: dhivehin_num
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Convert numbers into Dhivehi text
|
|
5
|
+
Author: Ahmed Ghilmaan
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
Dhivehin Num – Installation & Usage
|
|
10
|
+
|
|
11
|
+
A Python library that converts numbers into Dhivehi text.
|
|
12
|
+
|
|
13
|
+
1. Install
|
|
14
|
+
|
|
15
|
+
Download dhivehin_num-0.1.0-py3-none-any.whl, open CMD in its folder and run:
|
|
16
|
+
|
|
17
|
+
pip install dhivehin_num-0.1.0-py3-none-any.whl
|
|
18
|
+
|
|
19
|
+
2. Use in Python
|
|
20
|
+
|
|
21
|
+
from dhivehin_num import convert
|
|
22
|
+
|
|
23
|
+
print(convert(31))
|
|
24
|
+
print(convert(450))
|
|
25
|
+
print(convert(999999))
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Dhivehin Num – Installation & Usage
|
|
2
|
+
|
|
3
|
+
A Python library that converts numbers into Dhivehi text.
|
|
4
|
+
|
|
5
|
+
1. Install
|
|
6
|
+
|
|
7
|
+
Download dhivehin_num-0.1.0-py3-none-any.whl, open CMD in its folder and run:
|
|
8
|
+
|
|
9
|
+
pip install dhivehin_num-0.1.0-py3-none-any.whl
|
|
10
|
+
|
|
11
|
+
2. Use in Python
|
|
12
|
+
|
|
13
|
+
from dhivehin_num import convert
|
|
14
|
+
|
|
15
|
+
print(convert(31))
|
|
16
|
+
print(convert(450))
|
|
17
|
+
print(convert(999999))
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dhivehin_num"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Convert numbers into Dhivehi text"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Ahmed Ghilmaan"}
|
|
13
|
+
]
|
|
14
|
+
[tool.hatch.build.targets.wheel]
|
|
15
|
+
packages = ["dhivehin_num"]
|
|
16
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from .numbers import NUMBERS
|
|
2
|
+
|
|
3
|
+
def convert(number, rabove=False):
|
|
4
|
+
|
|
5
|
+
if number in NUMBERS:
|
|
6
|
+
return NUMBERS[number]
|
|
7
|
+
|
|
8
|
+
# 30-99 (excluding multiples of 10)
|
|
9
|
+
if 30 < number < 100:
|
|
10
|
+
tens = (number // 10) * 10
|
|
11
|
+
ones = number % 10
|
|
12
|
+
|
|
13
|
+
return NUMBERS[tens] + " " + NUMBERS[ones]
|
|
14
|
+
|
|
15
|
+
# 100-999
|
|
16
|
+
if 100 < number < 1000:
|
|
17
|
+
hundreds = (number // 100) * 100
|
|
18
|
+
remainder = number % 100
|
|
19
|
+
|
|
20
|
+
if hundreds in NUMBERS and rabove:#check if number is
|
|
21
|
+
result = NUMBERS[hundreds]
|
|
22
|
+
else:
|
|
23
|
+
result = convert(hundreds // 100) + " " + NUMBERS[100]
|
|
24
|
+
rabove = True
|
|
25
|
+
|
|
26
|
+
if remainder:
|
|
27
|
+
result += " " + convert(remainder)
|
|
28
|
+
|
|
29
|
+
return result
|
|
30
|
+
|
|
31
|
+
# 1000-99999
|
|
32
|
+
if 1000 < number < 99999:
|
|
33
|
+
thousands = number // 1000
|
|
34
|
+
remainder = number % 1000
|
|
35
|
+
if (number // 100) % 10 == 1:rabove = False
|
|
36
|
+
|
|
37
|
+
result = convert(thousands) + " " + NUMBERS[1000]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
if remainder:
|
|
41
|
+
rabove = True
|
|
42
|
+
result += " " + convert(remainder)
|
|
43
|
+
|
|
44
|
+
return result
|
|
45
|
+
|
|
46
|
+
if 100000 < number < 999999:
|
|
47
|
+
hundredthousands = number // 100000
|
|
48
|
+
remainder = number % 100000
|
|
49
|
+
|
|
50
|
+
result = convert(hundredthousands) + " " + NUMBERS[100000]
|
|
51
|
+
|
|
52
|
+
if remainder:
|
|
53
|
+
result += " " + convert(remainder)
|
|
54
|
+
|
|
55
|
+
return result
|
|
56
|
+
|
|
57
|
+
return "Number out of range"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
NUMBERS = {
|
|
2
|
+
1: "އެއް",
|
|
3
|
+
2: "ދެ",
|
|
4
|
+
3: "ތިން",
|
|
5
|
+
4: "ހަތަރު",
|
|
6
|
+
5: "ފަސް",
|
|
7
|
+
6: "ހަ",
|
|
8
|
+
7: "ހަތް",
|
|
9
|
+
8: "އަށް",
|
|
10
|
+
9: "ނުވަ",
|
|
11
|
+
10: "ދިހަ",
|
|
12
|
+
11: "އެގާރަ",
|
|
13
|
+
12: "ބާރަ",
|
|
14
|
+
13: "ތޭރަ",
|
|
15
|
+
14: "ސާދަ",
|
|
16
|
+
15: "ފަނަރަ",
|
|
17
|
+
16: "ސޯޅަ",
|
|
18
|
+
17: "ސަތާރަ",
|
|
19
|
+
18: "އަށާރަ",
|
|
20
|
+
19: "ނަވާރަ",
|
|
21
|
+
20: "ވިހި",
|
|
22
|
+
21: "އެކާވީސް",
|
|
23
|
+
22: "ބާވީސް",
|
|
24
|
+
23: "ތޭވީސް",
|
|
25
|
+
24: "ސައުވީސް",
|
|
26
|
+
25: "ފަންސަވީސް",
|
|
27
|
+
26: "ސައްބީސް",
|
|
28
|
+
27: "ހަތާވީސް",
|
|
29
|
+
28: "އަށާވީސް",
|
|
30
|
+
29: "ނަވާވީސް",
|
|
31
|
+
30: "ތިރީސް",
|
|
32
|
+
40: "ސާޅީސް",
|
|
33
|
+
50: "ފަންސާސް",
|
|
34
|
+
60: "ފަސްދޮޅަސް",
|
|
35
|
+
70: "ހަތްދިހަ",
|
|
36
|
+
80: "އައްޑިހަ",
|
|
37
|
+
90: "ނުވަދިހަ",
|
|
38
|
+
100: "ސަތޭކަ",
|
|
39
|
+
200: "ދުވިސަސްތަ",
|
|
40
|
+
1000: "ހާސް",
|
|
41
|
+
100000: "ލައްކަ"
|
|
42
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pyproject.toml
|
|
2
|
+
src/dhivehin_num/__init__.py
|
|
3
|
+
src/dhivehin_num/converter.py
|
|
4
|
+
src/dhivehin_num/numbers.py
|
|
5
|
+
src/dhivehin_num.egg-info/PKG-INFO
|
|
6
|
+
src/dhivehin_num.egg-info/SOURCES.txt
|
|
7
|
+
src/dhivehin_num.egg-info/dependency_links.txt
|
|
8
|
+
src/dhivehin_num.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dhivehin_num
|