georgian-hyphenation 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.
- georgian_hyphenation-1.0.0/LICENSE.txt +21 -0
- georgian_hyphenation-1.0.0/PKG-INFO +347 -0
- georgian_hyphenation-1.0.0/README.md +317 -0
- georgian_hyphenation-1.0.0/pyproject.toml +32 -0
- georgian_hyphenation-1.0.0/setup.cfg +4 -0
- georgian_hyphenation-1.0.0/setup.py +30 -0
- georgian_hyphenation-1.0.0/src/georgian_hyphenation/__init__.py +21 -0
- georgian_hyphenation-1.0.0/src/georgian_hyphenation/hyphenator.py +312 -0
- georgian_hyphenation-1.0.0/src/georgian_hyphenation.egg-info/PKG-INFO +347 -0
- georgian_hyphenation-1.0.0/src/georgian_hyphenation.egg-info/SOURCES.txt +11 -0
- georgian_hyphenation-1.0.0/src/georgian_hyphenation.egg-info/dependency_links.txt +1 -0
- georgian_hyphenation-1.0.0/src/georgian_hyphenation.egg-info/top_level.txt +1 -0
- georgian_hyphenation-1.0.0/tests/test_basic.py +328 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 [შენი სახელი]
|
|
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,347 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: georgian-hyphenation
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Georgian Language Hyphenation Library - ქართული ენის დამარცვლის ბიბლიოთეკა
|
|
5
|
+
Home-page: https://github.com/guramzhgamadze/georgian-hyphenation
|
|
6
|
+
Author: Guram Zhgamadze
|
|
7
|
+
Author-email: Guram Zhgamadze <guramzhgamadze@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/guramzhgamadze/georgian-hyphenation
|
|
10
|
+
Project-URL: Documentation, https://guramzhgamadze.github.io/georgian-hyphenation/
|
|
11
|
+
Project-URL: Repository, https://github.com/guramzhgamadze/georgian-hyphenation
|
|
12
|
+
Keywords: georgian,hyphenation,nlp,linguistics,kartuli,syllabification
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Natural Language :: Georgian
|
|
23
|
+
Requires-Python: >=3.7
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE.txt
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
Dynamic: requires-python
|
|
30
|
+
|
|
31
|
+
# Georgian Language Hyphenation / ქართული ენის დამარცვლა
|
|
32
|
+
|
|
33
|
+
[](https://opensource.org/licenses/MIT)
|
|
34
|
+
[](https://www.python.org/downloads/)
|
|
35
|
+
[](https://www.ecma-international.org/)
|
|
36
|
+
|
|
37
|
+
A comprehensive hyphenation library for the Georgian language, supporting multiple output formats including TeX, Hunspell, and web standards.
|
|
38
|
+
|
|
39
|
+
ქართული ენის სრული დამარცვლის ბიბლიოთეკა, რომელიც მხარს უჭერს მრავალ ფორმატს: TeX, Hunspell და ვებ სტანდარტები.
|
|
40
|
+
|
|
41
|
+
## Features / ფუნქციები
|
|
42
|
+
|
|
43
|
+
- ✅ **Accurate syllabification** based on Georgian phonological rules
|
|
44
|
+
- ✅ **Multiple output formats**: Soft hyphens (U+00AD), TeX patterns, Hunspell dictionary
|
|
45
|
+
- ✅ **Python and JavaScript implementations** for maximum compatibility
|
|
46
|
+
- ✅ **Web-ready** with HTML/CSS/JS demo
|
|
47
|
+
- ✅ **Export capabilities**: JSON, CSV, TeX, Hunspell
|
|
48
|
+
- ✅ **Well-tested** with comprehensive Georgian word corpus
|
|
49
|
+
|
|
50
|
+
## Installation / ინსტალაცია
|
|
51
|
+
|
|
52
|
+
### Python
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install georgian-hyphenation # Coming soon
|
|
56
|
+
# Or clone this repository
|
|
57
|
+
git clone https://github.com/guramzhgamadze/georgian-hyphenation.git
|
|
58
|
+
cd georgian-hyphenation
|
|
59
|
+
python setup.py install
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### JavaScript
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install georgian-hyphenation # Coming soon
|
|
66
|
+
# Or include directly in HTML
|
|
67
|
+
<script src="georgian-hyphenation.js"></script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Usage / გამოყენება
|
|
71
|
+
|
|
72
|
+
### Python
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from georgian_hyphenation import GeorgianHyphenator
|
|
76
|
+
|
|
77
|
+
# Initialize with soft hyphen (default)
|
|
78
|
+
hyphenator = GeorgianHyphenator()
|
|
79
|
+
|
|
80
|
+
# Hyphenate a word
|
|
81
|
+
word = "საქართველო"
|
|
82
|
+
result = hyphenator.hyphenate_word(word)
|
|
83
|
+
print(result) # საქართველო (with U+00AD soft hyphens)
|
|
84
|
+
|
|
85
|
+
# Get syllables as a list
|
|
86
|
+
syllables = hyphenator.get_syllables(word)
|
|
87
|
+
print(syllables) # ['სა', 'ქარ', 'თვე', 'ლო']
|
|
88
|
+
|
|
89
|
+
# Use visible hyphens for display
|
|
90
|
+
visible = GeorgianHyphenator('-')
|
|
91
|
+
print(visible.hyphenate_word(word)) # სა-ქარ-თვე-ლო
|
|
92
|
+
|
|
93
|
+
# Hyphenate entire text
|
|
94
|
+
text = "საქართველო არის ლამაზი ქვეყანა"
|
|
95
|
+
print(hyphenator.hyphenate_text(text))
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### JavaScript
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
// Initialize hyphenator
|
|
102
|
+
const hyphenator = new GeorgianHyphenator();
|
|
103
|
+
|
|
104
|
+
// Hyphenate a word
|
|
105
|
+
const word = "საქართველო";
|
|
106
|
+
const result = hyphenator.hyphenate(word);
|
|
107
|
+
console.log(result); // საქართველო (with U+00AD)
|
|
108
|
+
|
|
109
|
+
// Get syllables
|
|
110
|
+
const syllables = hyphenator.getSyllables(word);
|
|
111
|
+
console.log(syllables); // ['სა', 'ქარ', 'თვე', 'ლო']
|
|
112
|
+
|
|
113
|
+
// Use visible hyphens
|
|
114
|
+
const visible = new GeorgianHyphenator('-');
|
|
115
|
+
console.log(visible.hyphenate(word)); // სა-ქარ-თვე-ლო
|
|
116
|
+
|
|
117
|
+
// Hyphenate text
|
|
118
|
+
const text = "საქართველო არის ლამაზი ქვეყანა";
|
|
119
|
+
console.log(hyphenator.hyphenateText(text));
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### HTML/CSS Integration
|
|
123
|
+
|
|
124
|
+
```html
|
|
125
|
+
<!DOCTYPE html>
|
|
126
|
+
<html lang="ka">
|
|
127
|
+
<head>
|
|
128
|
+
<style>
|
|
129
|
+
.hyphenated {
|
|
130
|
+
hyphens: manual;
|
|
131
|
+
text-align: justify;
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
134
|
+
</head>
|
|
135
|
+
<body>
|
|
136
|
+
<p class="hyphenated" id="text"></p>
|
|
137
|
+
|
|
138
|
+
<script src="georgian-hyphenation.js"></script>
|
|
139
|
+
<script>
|
|
140
|
+
const hyphenator = new GeorgianHyphenator('\u00AD');
|
|
141
|
+
const text = "საქართველო არის ძალიან ლამაზი ქვეყანა";
|
|
142
|
+
document.getElementById('text').textContent =
|
|
143
|
+
hyphenator.hyphenateText(text);
|
|
144
|
+
</script>
|
|
145
|
+
</body>
|
|
146
|
+
</html>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Export Formats / ექსპორტის ფორმატები
|
|
150
|
+
|
|
151
|
+
### TeX Patterns
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
from georgian_hyphenation import TeXPatternGenerator
|
|
155
|
+
|
|
156
|
+
hyphenator = GeorgianHyphenator()
|
|
157
|
+
tex_gen = TeXPatternGenerator(hyphenator)
|
|
158
|
+
|
|
159
|
+
words = ["საქართველო", "მთავრობა", "დედაქალაქი"]
|
|
160
|
+
tex_gen.generate_patterns_file(words, "hyph-ka.tex")
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Output (`hyph-ka.tex`):
|
|
164
|
+
```tex
|
|
165
|
+
% Georgian hyphenation patterns
|
|
166
|
+
\patterns{
|
|
167
|
+
.სა1ქარ1თვე1ლო
|
|
168
|
+
.მთავ1რო1ბა
|
|
169
|
+
.დე1და1ქა1ლა1ქი
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Hunspell Dictionary
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
from georgian_hyphenation import HunspellDictionaryGenerator
|
|
177
|
+
|
|
178
|
+
hunspell_gen = HunspellDictionaryGenerator(hyphenator)
|
|
179
|
+
words = ["საქართველო", "მთავრობა"]
|
|
180
|
+
hunspell_gen.generate_dictionary(words, "hyph_ka_GE")
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Output (`hyph_ka_GE.dic`):
|
|
184
|
+
```
|
|
185
|
+
UTF-8
|
|
186
|
+
2
|
|
187
|
+
სა=ქარ=თვე=ლო
|
|
188
|
+
მთავ=რო=ბა
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### JSON Export
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
from georgian_hyphenation import HyphenationExporter
|
|
195
|
+
|
|
196
|
+
exporter = HyphenationExporter(hyphenator)
|
|
197
|
+
words = ["საქართველო", "მთავრობა"]
|
|
198
|
+
exporter.export_json(words, "georgian_hyphenation.json")
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Output:
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"საქართველო": {
|
|
205
|
+
"syllables": ["სა", "ქარ", "თვე", "ლო"],
|
|
206
|
+
"hyphenated": "საქართველო"
|
|
207
|
+
},
|
|
208
|
+
"მთავრობა": {
|
|
209
|
+
"syllables": ["მთავ", "რო", "ბა"],
|
|
210
|
+
"hyphenated": "მთავრობა"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Hyphenation Rules / დამარცვლის წესები
|
|
216
|
+
|
|
217
|
+
The library implements Georgian syllabification rules based on phonological patterns:
|
|
218
|
+
|
|
219
|
+
ბიბლიოთეკა იყენებს ქართული ფონოლოგიის წესებზე დაფუძნებულ მარცვლების გამოყოფას:
|
|
220
|
+
|
|
221
|
+
1. **V+C+C+V** → VC|CV (ხმოვანი + თანხმოვანი + თანხმოვნები + ხმოვანი)
|
|
222
|
+
2. **V+C+V+C+V** → VCV|CV
|
|
223
|
+
3. **C+V+C+V** → CV|CV
|
|
224
|
+
4. **V+V+V** → VV|V (სამი ხმოვანი ზედიზედ)
|
|
225
|
+
5. Special rules for word boundaries (სიტყვის საზღვრების სპეციალური წესები)
|
|
226
|
+
|
|
227
|
+
Where:
|
|
228
|
+
- **V** = vowel (ხმოვანი): ა, ე, ი, ო, უ
|
|
229
|
+
- **C** = consonant (თანხმოვანი): ბ, გ, დ, ვ, ზ, თ, კ, ლ, მ, ნ, პ, ჟ, რ, ს, ტ, ფ, ქ, ღ, ყ, შ, ჩ, ც, ძ, წ, ჭ, ხ, ჯ, ჰ
|
|
230
|
+
|
|
231
|
+
## Examples / მაგალითები
|
|
232
|
+
|
|
233
|
+
| Word (სიტყვა) | Syllables (მარცვლები) | Pattern |
|
|
234
|
+
|---------------|----------------------|---------|
|
|
235
|
+
| საქართველო | სა-ქარ-თვე-ლო | .სა1ქარ1თვე1ლო |
|
|
236
|
+
| მთავრობა | მთავ-რო-ბა | .მთავ1რო1ბა |
|
|
237
|
+
| დედაქალაქი | დე-და-ქა-ლა-ქი | .დე1და1ქა1ლა1ქი |
|
|
238
|
+
| ტელევიზორი | ტე-ლე-ვი-ზო-რი | .ტე1ლე1ვი1ზო1რი |
|
|
239
|
+
| კომპიუტერი | კომ-პი-უ-ტე-რი | .კომ1პი1უ1ტე1რი |
|
|
240
|
+
| უნივერსიტეტი | უ-ნი-ვერ-სი-ტე-ტი | .უ1ნი1ვერ1სი1ტე1ტი |
|
|
241
|
+
|
|
242
|
+
## Testing / ტესტირება
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Python tests
|
|
246
|
+
python -m pytest tests/
|
|
247
|
+
|
|
248
|
+
# JavaScript tests
|
|
249
|
+
npm test
|
|
250
|
+
|
|
251
|
+
# Run demo
|
|
252
|
+
python georgian_hyphenation.py
|
|
253
|
+
# or open demo.html in browser
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Contributing / წვლილის შეტანა
|
|
257
|
+
|
|
258
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
259
|
+
|
|
260
|
+
მოხარული ვიქნებით თქვენი წვლილით! გთხოვთ გამოგზავნოთ Pull Request.
|
|
261
|
+
|
|
262
|
+
1. Fork the repository
|
|
263
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
264
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
265
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
266
|
+
5. Open a Pull Request
|
|
267
|
+
|
|
268
|
+
## Integration with Popular Tools / ინტეგრაცია პოპულარულ ხელსაწყოებთან
|
|
269
|
+
|
|
270
|
+
### LibreOffice / OpenOffice
|
|
271
|
+
|
|
272
|
+
1. Generate Hunspell dictionary files
|
|
273
|
+
2. Copy to extensions directory:
|
|
274
|
+
- Linux: `~/.config/libreoffice/4/user/uno_packages/cache/`
|
|
275
|
+
- Windows: `%APPDATA%\LibreOffice\4\user\uno_packages\cache\`
|
|
276
|
+
- macOS: `~/Library/Application Support/LibreOffice/4/user/uno_packages/cache/`
|
|
277
|
+
|
|
278
|
+
### LaTeX / XeLaTeX
|
|
279
|
+
|
|
280
|
+
```latex
|
|
281
|
+
\documentclass{article}
|
|
282
|
+
\usepackage{polyglossia}
|
|
283
|
+
\setmainlanguage{georgian}
|
|
284
|
+
\usepackage{hyphenat}
|
|
285
|
+
|
|
286
|
+
% Include generated patterns
|
|
287
|
+
\input{hyph-ka.tex}
|
|
288
|
+
|
|
289
|
+
\begin{document}
|
|
290
|
+
საქართველო არის ძალიან ლამაზი ქვეყანა
|
|
291
|
+
\end{document}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Web Browsers (CSS)
|
|
295
|
+
|
|
296
|
+
```css
|
|
297
|
+
html {
|
|
298
|
+
lang: ka;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
p {
|
|
302
|
+
hyphens: manual; /* Use with soft hyphens */
|
|
303
|
+
/* or */
|
|
304
|
+
hyphens: auto; /* If browser supports Georgian */
|
|
305
|
+
text-align: justify;
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Roadmap / სამომავლო გეგმები
|
|
310
|
+
|
|
311
|
+
- [ ] PyPI package release
|
|
312
|
+
- [ ] NPM package release
|
|
313
|
+
- [ ] Browser extension (Chrome, Firefox)
|
|
314
|
+
- [ ] InDesign plugin
|
|
315
|
+
- [ ] MS Word add-in
|
|
316
|
+
- [ ] Submit to TeX Live hyphenation database
|
|
317
|
+
- [ ] Submit to Unicode CLDR
|
|
318
|
+
- [ ] Mobile apps (iOS, Android)
|
|
319
|
+
- [ ] API service
|
|
320
|
+
|
|
321
|
+
## License / ლიცენზია
|
|
322
|
+
|
|
323
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
324
|
+
|
|
325
|
+
## Acknowledgments / მადლობა
|
|
326
|
+
|
|
327
|
+
- Based on Georgian phonological research
|
|
328
|
+
- Inspired by TeX hyphenation patterns
|
|
329
|
+
- Thanks to the Georgian linguistic community
|
|
330
|
+
|
|
331
|
+
## Contact / კონტაქტი
|
|
332
|
+
|
|
333
|
+
- GitHub Issues: [Report bugs or request features](https://github.com/guramzhgamadze/georgian-hyphenation/issues)
|
|
334
|
+
- Email: guramzhgamadze@gmail.com
|
|
335
|
+
|
|
336
|
+
## References / ლიტერატურა
|
|
337
|
+
|
|
338
|
+
- Georgian Language Phonology and Syllable Structure
|
|
339
|
+
- TeX Hyphenation Algorithm (Liang, 1983)
|
|
340
|
+
- Hunspell Hyphenation Documentation
|
|
341
|
+
- Unicode Standard for Georgian Script
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
Made with ❤️ for the Georgian language community
|
|
346
|
+
|
|
347
|
+
შექმნილია ❤️-ით ქართული ენის საზოგადოებისთვის
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# Georgian Language Hyphenation / ქართული ენის დამარცვლა
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://www.ecma-international.org/)
|
|
6
|
+
|
|
7
|
+
A comprehensive hyphenation library for the Georgian language, supporting multiple output formats including TeX, Hunspell, and web standards.
|
|
8
|
+
|
|
9
|
+
ქართული ენის სრული დამარცვლის ბიბლიოთეკა, რომელიც მხარს უჭერს მრავალ ფორმატს: TeX, Hunspell და ვებ სტანდარტები.
|
|
10
|
+
|
|
11
|
+
## Features / ფუნქციები
|
|
12
|
+
|
|
13
|
+
- ✅ **Accurate syllabification** based on Georgian phonological rules
|
|
14
|
+
- ✅ **Multiple output formats**: Soft hyphens (U+00AD), TeX patterns, Hunspell dictionary
|
|
15
|
+
- ✅ **Python and JavaScript implementations** for maximum compatibility
|
|
16
|
+
- ✅ **Web-ready** with HTML/CSS/JS demo
|
|
17
|
+
- ✅ **Export capabilities**: JSON, CSV, TeX, Hunspell
|
|
18
|
+
- ✅ **Well-tested** with comprehensive Georgian word corpus
|
|
19
|
+
|
|
20
|
+
## Installation / ინსტალაცია
|
|
21
|
+
|
|
22
|
+
### Python
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install georgian-hyphenation # Coming soon
|
|
26
|
+
# Or clone this repository
|
|
27
|
+
git clone https://github.com/guramzhgamadze/georgian-hyphenation.git
|
|
28
|
+
cd georgian-hyphenation
|
|
29
|
+
python setup.py install
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### JavaScript
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install georgian-hyphenation # Coming soon
|
|
36
|
+
# Or include directly in HTML
|
|
37
|
+
<script src="georgian-hyphenation.js"></script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage / გამოყენება
|
|
41
|
+
|
|
42
|
+
### Python
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from georgian_hyphenation import GeorgianHyphenator
|
|
46
|
+
|
|
47
|
+
# Initialize with soft hyphen (default)
|
|
48
|
+
hyphenator = GeorgianHyphenator()
|
|
49
|
+
|
|
50
|
+
# Hyphenate a word
|
|
51
|
+
word = "საქართველო"
|
|
52
|
+
result = hyphenator.hyphenate_word(word)
|
|
53
|
+
print(result) # საქართველო (with U+00AD soft hyphens)
|
|
54
|
+
|
|
55
|
+
# Get syllables as a list
|
|
56
|
+
syllables = hyphenator.get_syllables(word)
|
|
57
|
+
print(syllables) # ['სა', 'ქარ', 'თვე', 'ლო']
|
|
58
|
+
|
|
59
|
+
# Use visible hyphens for display
|
|
60
|
+
visible = GeorgianHyphenator('-')
|
|
61
|
+
print(visible.hyphenate_word(word)) # სა-ქარ-თვე-ლო
|
|
62
|
+
|
|
63
|
+
# Hyphenate entire text
|
|
64
|
+
text = "საქართველო არის ლამაზი ქვეყანა"
|
|
65
|
+
print(hyphenator.hyphenate_text(text))
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### JavaScript
|
|
69
|
+
|
|
70
|
+
```javascript
|
|
71
|
+
// Initialize hyphenator
|
|
72
|
+
const hyphenator = new GeorgianHyphenator();
|
|
73
|
+
|
|
74
|
+
// Hyphenate a word
|
|
75
|
+
const word = "საქართველო";
|
|
76
|
+
const result = hyphenator.hyphenate(word);
|
|
77
|
+
console.log(result); // საქართველო (with U+00AD)
|
|
78
|
+
|
|
79
|
+
// Get syllables
|
|
80
|
+
const syllables = hyphenator.getSyllables(word);
|
|
81
|
+
console.log(syllables); // ['სა', 'ქარ', 'თვე', 'ლო']
|
|
82
|
+
|
|
83
|
+
// Use visible hyphens
|
|
84
|
+
const visible = new GeorgianHyphenator('-');
|
|
85
|
+
console.log(visible.hyphenate(word)); // სა-ქარ-თვე-ლო
|
|
86
|
+
|
|
87
|
+
// Hyphenate text
|
|
88
|
+
const text = "საქართველო არის ლამაზი ქვეყანა";
|
|
89
|
+
console.log(hyphenator.hyphenateText(text));
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### HTML/CSS Integration
|
|
93
|
+
|
|
94
|
+
```html
|
|
95
|
+
<!DOCTYPE html>
|
|
96
|
+
<html lang="ka">
|
|
97
|
+
<head>
|
|
98
|
+
<style>
|
|
99
|
+
.hyphenated {
|
|
100
|
+
hyphens: manual;
|
|
101
|
+
text-align: justify;
|
|
102
|
+
}
|
|
103
|
+
</style>
|
|
104
|
+
</head>
|
|
105
|
+
<body>
|
|
106
|
+
<p class="hyphenated" id="text"></p>
|
|
107
|
+
|
|
108
|
+
<script src="georgian-hyphenation.js"></script>
|
|
109
|
+
<script>
|
|
110
|
+
const hyphenator = new GeorgianHyphenator('\u00AD');
|
|
111
|
+
const text = "საქართველო არის ძალიან ლამაზი ქვეყანა";
|
|
112
|
+
document.getElementById('text').textContent =
|
|
113
|
+
hyphenator.hyphenateText(text);
|
|
114
|
+
</script>
|
|
115
|
+
</body>
|
|
116
|
+
</html>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Export Formats / ექსპორტის ფორმატები
|
|
120
|
+
|
|
121
|
+
### TeX Patterns
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from georgian_hyphenation import TeXPatternGenerator
|
|
125
|
+
|
|
126
|
+
hyphenator = GeorgianHyphenator()
|
|
127
|
+
tex_gen = TeXPatternGenerator(hyphenator)
|
|
128
|
+
|
|
129
|
+
words = ["საქართველო", "მთავრობა", "დედაქალაქი"]
|
|
130
|
+
tex_gen.generate_patterns_file(words, "hyph-ka.tex")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Output (`hyph-ka.tex`):
|
|
134
|
+
```tex
|
|
135
|
+
% Georgian hyphenation patterns
|
|
136
|
+
\patterns{
|
|
137
|
+
.სა1ქარ1თვე1ლო
|
|
138
|
+
.მთავ1რო1ბა
|
|
139
|
+
.დე1და1ქა1ლა1ქი
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Hunspell Dictionary
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from georgian_hyphenation import HunspellDictionaryGenerator
|
|
147
|
+
|
|
148
|
+
hunspell_gen = HunspellDictionaryGenerator(hyphenator)
|
|
149
|
+
words = ["საქართველო", "მთავრობა"]
|
|
150
|
+
hunspell_gen.generate_dictionary(words, "hyph_ka_GE")
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Output (`hyph_ka_GE.dic`):
|
|
154
|
+
```
|
|
155
|
+
UTF-8
|
|
156
|
+
2
|
|
157
|
+
სა=ქარ=თვე=ლო
|
|
158
|
+
მთავ=რო=ბა
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### JSON Export
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from georgian_hyphenation import HyphenationExporter
|
|
165
|
+
|
|
166
|
+
exporter = HyphenationExporter(hyphenator)
|
|
167
|
+
words = ["საქართველო", "მთავრობა"]
|
|
168
|
+
exporter.export_json(words, "georgian_hyphenation.json")
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Output:
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"საქართველო": {
|
|
175
|
+
"syllables": ["სა", "ქარ", "თვე", "ლო"],
|
|
176
|
+
"hyphenated": "საქართველო"
|
|
177
|
+
},
|
|
178
|
+
"მთავრობა": {
|
|
179
|
+
"syllables": ["მთავ", "რო", "ბა"],
|
|
180
|
+
"hyphenated": "მთავრობა"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Hyphenation Rules / დამარცვლის წესები
|
|
186
|
+
|
|
187
|
+
The library implements Georgian syllabification rules based on phonological patterns:
|
|
188
|
+
|
|
189
|
+
ბიბლიოთეკა იყენებს ქართული ფონოლოგიის წესებზე დაფუძნებულ მარცვლების გამოყოფას:
|
|
190
|
+
|
|
191
|
+
1. **V+C+C+V** → VC|CV (ხმოვანი + თანხმოვანი + თანხმოვნები + ხმოვანი)
|
|
192
|
+
2. **V+C+V+C+V** → VCV|CV
|
|
193
|
+
3. **C+V+C+V** → CV|CV
|
|
194
|
+
4. **V+V+V** → VV|V (სამი ხმოვანი ზედიზედ)
|
|
195
|
+
5. Special rules for word boundaries (სიტყვის საზღვრების სპეციალური წესები)
|
|
196
|
+
|
|
197
|
+
Where:
|
|
198
|
+
- **V** = vowel (ხმოვანი): ა, ე, ი, ო, უ
|
|
199
|
+
- **C** = consonant (თანხმოვანი): ბ, გ, დ, ვ, ზ, თ, კ, ლ, მ, ნ, პ, ჟ, რ, ს, ტ, ფ, ქ, ღ, ყ, შ, ჩ, ც, ძ, წ, ჭ, ხ, ჯ, ჰ
|
|
200
|
+
|
|
201
|
+
## Examples / მაგალითები
|
|
202
|
+
|
|
203
|
+
| Word (სიტყვა) | Syllables (მარცვლები) | Pattern |
|
|
204
|
+
|---------------|----------------------|---------|
|
|
205
|
+
| საქართველო | სა-ქარ-თვე-ლო | .სა1ქარ1თვე1ლო |
|
|
206
|
+
| მთავრობა | მთავ-რო-ბა | .მთავ1რო1ბა |
|
|
207
|
+
| დედაქალაქი | დე-და-ქა-ლა-ქი | .დე1და1ქა1ლა1ქი |
|
|
208
|
+
| ტელევიზორი | ტე-ლე-ვი-ზო-რი | .ტე1ლე1ვი1ზო1რი |
|
|
209
|
+
| კომპიუტერი | კომ-პი-უ-ტე-რი | .კომ1პი1უ1ტე1რი |
|
|
210
|
+
| უნივერსიტეტი | უ-ნი-ვერ-სი-ტე-ტი | .უ1ნი1ვერ1სი1ტე1ტი |
|
|
211
|
+
|
|
212
|
+
## Testing / ტესტირება
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Python tests
|
|
216
|
+
python -m pytest tests/
|
|
217
|
+
|
|
218
|
+
# JavaScript tests
|
|
219
|
+
npm test
|
|
220
|
+
|
|
221
|
+
# Run demo
|
|
222
|
+
python georgian_hyphenation.py
|
|
223
|
+
# or open demo.html in browser
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Contributing / წვლილის შეტანა
|
|
227
|
+
|
|
228
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
229
|
+
|
|
230
|
+
მოხარული ვიქნებით თქვენი წვლილით! გთხოვთ გამოგზავნოთ Pull Request.
|
|
231
|
+
|
|
232
|
+
1. Fork the repository
|
|
233
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
234
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
235
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
236
|
+
5. Open a Pull Request
|
|
237
|
+
|
|
238
|
+
## Integration with Popular Tools / ინტეგრაცია პოპულარულ ხელსაწყოებთან
|
|
239
|
+
|
|
240
|
+
### LibreOffice / OpenOffice
|
|
241
|
+
|
|
242
|
+
1. Generate Hunspell dictionary files
|
|
243
|
+
2. Copy to extensions directory:
|
|
244
|
+
- Linux: `~/.config/libreoffice/4/user/uno_packages/cache/`
|
|
245
|
+
- Windows: `%APPDATA%\LibreOffice\4\user\uno_packages\cache\`
|
|
246
|
+
- macOS: `~/Library/Application Support/LibreOffice/4/user/uno_packages/cache/`
|
|
247
|
+
|
|
248
|
+
### LaTeX / XeLaTeX
|
|
249
|
+
|
|
250
|
+
```latex
|
|
251
|
+
\documentclass{article}
|
|
252
|
+
\usepackage{polyglossia}
|
|
253
|
+
\setmainlanguage{georgian}
|
|
254
|
+
\usepackage{hyphenat}
|
|
255
|
+
|
|
256
|
+
% Include generated patterns
|
|
257
|
+
\input{hyph-ka.tex}
|
|
258
|
+
|
|
259
|
+
\begin{document}
|
|
260
|
+
საქართველო არის ძალიან ლამაზი ქვეყანა
|
|
261
|
+
\end{document}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Web Browsers (CSS)
|
|
265
|
+
|
|
266
|
+
```css
|
|
267
|
+
html {
|
|
268
|
+
lang: ka;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
p {
|
|
272
|
+
hyphens: manual; /* Use with soft hyphens */
|
|
273
|
+
/* or */
|
|
274
|
+
hyphens: auto; /* If browser supports Georgian */
|
|
275
|
+
text-align: justify;
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Roadmap / სამომავლო გეგმები
|
|
280
|
+
|
|
281
|
+
- [ ] PyPI package release
|
|
282
|
+
- [ ] NPM package release
|
|
283
|
+
- [ ] Browser extension (Chrome, Firefox)
|
|
284
|
+
- [ ] InDesign plugin
|
|
285
|
+
- [ ] MS Word add-in
|
|
286
|
+
- [ ] Submit to TeX Live hyphenation database
|
|
287
|
+
- [ ] Submit to Unicode CLDR
|
|
288
|
+
- [ ] Mobile apps (iOS, Android)
|
|
289
|
+
- [ ] API service
|
|
290
|
+
|
|
291
|
+
## License / ლიცენზია
|
|
292
|
+
|
|
293
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
294
|
+
|
|
295
|
+
## Acknowledgments / მადლობა
|
|
296
|
+
|
|
297
|
+
- Based on Georgian phonological research
|
|
298
|
+
- Inspired by TeX hyphenation patterns
|
|
299
|
+
- Thanks to the Georgian linguistic community
|
|
300
|
+
|
|
301
|
+
## Contact / კონტაქტი
|
|
302
|
+
|
|
303
|
+
- GitHub Issues: [Report bugs or request features](https://github.com/guramzhgamadze/georgian-hyphenation/issues)
|
|
304
|
+
- Email: guramzhgamadze@gmail.com
|
|
305
|
+
|
|
306
|
+
## References / ლიტერატურა
|
|
307
|
+
|
|
308
|
+
- Georgian Language Phonology and Syllable Structure
|
|
309
|
+
- TeX Hyphenation Algorithm (Liang, 1983)
|
|
310
|
+
- Hunspell Hyphenation Documentation
|
|
311
|
+
- Unicode Standard for Georgian Script
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
Made with ❤️ for the Georgian language community
|
|
316
|
+
|
|
317
|
+
შექმნილია ❤️-ით ქართული ენის საზოგადოებისთვის
|