iraqitext 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.
- iraqitext-0.1.0/LICENSE +21 -0
- iraqitext-0.1.0/PKG-INFO +69 -0
- iraqitext-0.1.0/README.md +54 -0
- iraqitext-0.1.0/pyproject.toml +31 -0
- iraqitext-0.1.0/setup.cfg +4 -0
- iraqitext-0.1.0/src/iraqitext/__init__.py +1 -0
- iraqitext-0.1.0/src/iraqitext/dictionary.json +11 -0
- iraqitext-0.1.0/src/iraqitext/rules.py +13 -0
- iraqitext-0.1.0/src/iraqitext/translator.py +35 -0
- iraqitext-0.1.0/src/iraqitext.egg-info/PKG-INFO +69 -0
- iraqitext-0.1.0/src/iraqitext.egg-info/SOURCES.txt +11 -0
- iraqitext-0.1.0/src/iraqitext.egg-info/dependency_links.txt +1 -0
- iraqitext-0.1.0/src/iraqitext.egg-info/top_level.txt +1 -0
iraqitext-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ali
|
|
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.
|
iraqitext-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iraqitext
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Translate Iraqi dialect to Modern Standard Arabic and back
|
|
5
|
+
Author: JOHN
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Natural Language :: Arabic
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# IraqiText 🇮🇶
|
|
17
|
+
|
|
18
|
+
A Python library for translating Iraqi Arabic dialect to Modern Standard Arabic (MSA) and vice versa.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- 🇮🇶 Iraqi → Modern Standard Arabic
|
|
23
|
+
- 📖 Modern Standard Arabic → Iraqi
|
|
24
|
+
- ⚡ Fast dictionary-based translation
|
|
25
|
+
- 🧩 Easy to integrate into Python projects
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install iraqitext
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from iraqitext import IraqiTranslator
|
|
37
|
+
|
|
38
|
+
translator = IraqiTranslator()
|
|
39
|
+
|
|
40
|
+
print(translator.to_fusha("شلونك"))
|
|
41
|
+
# كيف حالك
|
|
42
|
+
|
|
43
|
+
print(translator.to_iraqi("كيف حالك"))
|
|
44
|
+
# شلونك
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Example
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
text = "هسه أكدر أجي"
|
|
51
|
+
|
|
52
|
+
print(translator.to_fusha(text))
|
|
53
|
+
# الآن أستطيع أن آتي
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Roadmap
|
|
57
|
+
|
|
58
|
+
- [x] Iraqi ↔ MSA translation
|
|
59
|
+
- [ ] More than 20,000 Iraqi words
|
|
60
|
+
- [ ] Grammar rules
|
|
61
|
+
- [ ] Iraqi spell checker
|
|
62
|
+
- [ ] Southern dialect support
|
|
63
|
+
- [ ] Mosul dialect support
|
|
64
|
+
- [ ] Baghdadi dialect support
|
|
65
|
+
- [ ] AI translation model
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT License
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# IraqiText 🇮🇶
|
|
2
|
+
|
|
3
|
+
A Python library for translating Iraqi Arabic dialect to Modern Standard Arabic (MSA) and vice versa.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🇮🇶 Iraqi → Modern Standard Arabic
|
|
8
|
+
- 📖 Modern Standard Arabic → Iraqi
|
|
9
|
+
- ⚡ Fast dictionary-based translation
|
|
10
|
+
- 🧩 Easy to integrate into Python projects
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install iraqitext
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from iraqitext import IraqiTranslator
|
|
22
|
+
|
|
23
|
+
translator = IraqiTranslator()
|
|
24
|
+
|
|
25
|
+
print(translator.to_fusha("شلونك"))
|
|
26
|
+
# كيف حالك
|
|
27
|
+
|
|
28
|
+
print(translator.to_iraqi("كيف حالك"))
|
|
29
|
+
# شلونك
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
text = "هسه أكدر أجي"
|
|
36
|
+
|
|
37
|
+
print(translator.to_fusha(text))
|
|
38
|
+
# الآن أستطيع أن آتي
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Roadmap
|
|
42
|
+
|
|
43
|
+
- [x] Iraqi ↔ MSA translation
|
|
44
|
+
- [ ] More than 20,000 Iraqi words
|
|
45
|
+
- [ ] Grammar rules
|
|
46
|
+
- [ ] Iraqi spell checker
|
|
47
|
+
- [ ] Southern dialect support
|
|
48
|
+
- [ ] Mosul dialect support
|
|
49
|
+
- [ ] Baghdadi dialect support
|
|
50
|
+
- [ ] AI translation model
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT License
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "iraqitext"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Translate Iraqi dialect to Modern Standard Arabic and back"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "JOHN" }
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Natural Language :: Arabic",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[tool.setuptools]
|
|
25
|
+
package-dir = {"" = "src"}
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.packages.find]
|
|
28
|
+
where = ["src"]
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.package-data]
|
|
31
|
+
iraqitext = ["dictionary.json"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .translator import IraqiTranslator
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import unicodedata
|
|
3
|
+
def normalize(text: str) -> str:
|
|
4
|
+
|
|
5
|
+
text = text.replace("إ", "ا")
|
|
6
|
+
text = text.replace("أ", "ا")
|
|
7
|
+
text = text.replace("آ", "ا")
|
|
8
|
+
text = text.replace("ٱ", "ا")
|
|
9
|
+
text = text.replace("ه","ة")
|
|
10
|
+
text = text.replace("ة","ه")
|
|
11
|
+
# text = text.replace("","")
|
|
12
|
+
|
|
13
|
+
return text
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import re
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from .rules import normalize
|
|
5
|
+
|
|
6
|
+
BASE_DIR = Path(__file__).parent
|
|
7
|
+
with open(BASE_DIR / "dialects" / "dictionary.json", "r", encoding="utf-8") as f:
|
|
8
|
+
dictionary = json.load(f)
|
|
9
|
+
|
|
10
|
+
_fusha_phrases = sorted(
|
|
11
|
+
[(v, k) for k, v in dictionary.items()],
|
|
12
|
+
key=lambda pair: len(pair[0]),
|
|
13
|
+
reverse=True,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
_iraqi_phrases = sorted(
|
|
17
|
+
[(normalize(k), v) for k, v in dictionary.items()],
|
|
18
|
+
key=lambda pair: len(pair[0]),
|
|
19
|
+
reverse=True,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _word_replacements(text, phrases):
|
|
24
|
+
for pattern, replacement in phrases:
|
|
25
|
+
regex = re.compile(r'(?<!\S)' + re.escape(pattern) + r'(?!\S)')
|
|
26
|
+
text = regex.sub(replacement, text)
|
|
27
|
+
return text
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class IraqiTranslator:
|
|
31
|
+
def to_fusha(self, text: str) -> str:
|
|
32
|
+
return _word_replacements(text, _iraqi_phrases)
|
|
33
|
+
|
|
34
|
+
def to_iraqi(self, text: str) -> str:
|
|
35
|
+
return _word_replacements(text, _fusha_phrases)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iraqitext
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Translate Iraqi dialect to Modern Standard Arabic and back
|
|
5
|
+
Author: JOHN
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Natural Language :: Arabic
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# IraqiText 🇮🇶
|
|
17
|
+
|
|
18
|
+
A Python library for translating Iraqi Arabic dialect to Modern Standard Arabic (MSA) and vice versa.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- 🇮🇶 Iraqi → Modern Standard Arabic
|
|
23
|
+
- 📖 Modern Standard Arabic → Iraqi
|
|
24
|
+
- ⚡ Fast dictionary-based translation
|
|
25
|
+
- 🧩 Easy to integrate into Python projects
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install iraqitext
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from iraqitext import IraqiTranslator
|
|
37
|
+
|
|
38
|
+
translator = IraqiTranslator()
|
|
39
|
+
|
|
40
|
+
print(translator.to_fusha("شلونك"))
|
|
41
|
+
# كيف حالك
|
|
42
|
+
|
|
43
|
+
print(translator.to_iraqi("كيف حالك"))
|
|
44
|
+
# شلونك
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Example
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
text = "هسه أكدر أجي"
|
|
51
|
+
|
|
52
|
+
print(translator.to_fusha(text))
|
|
53
|
+
# الآن أستطيع أن آتي
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Roadmap
|
|
57
|
+
|
|
58
|
+
- [x] Iraqi ↔ MSA translation
|
|
59
|
+
- [ ] More than 20,000 Iraqi words
|
|
60
|
+
- [ ] Grammar rules
|
|
61
|
+
- [ ] Iraqi spell checker
|
|
62
|
+
- [ ] Southern dialect support
|
|
63
|
+
- [ ] Mosul dialect support
|
|
64
|
+
- [ ] Baghdadi dialect support
|
|
65
|
+
- [ ] AI translation model
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT License
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/iraqitext/__init__.py
|
|
5
|
+
src/iraqitext/dictionary.json
|
|
6
|
+
src/iraqitext/rules.py
|
|
7
|
+
src/iraqitext/translator.py
|
|
8
|
+
src/iraqitext.egg-info/PKG-INFO
|
|
9
|
+
src/iraqitext.egg-info/SOURCES.txt
|
|
10
|
+
src/iraqitext.egg-info/dependency_links.txt
|
|
11
|
+
src/iraqitext.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
iraqitext
|