georgian-hyphenation 2.2.5 → 2.2.7
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.
- package/README.md +384 -541
- package/package.json +7 -3
- package/src/javascript/index.cjs +273 -12
- package/src/javascript/index.js +214 -7
package/README.md
CHANGED
|
@@ -1,721 +1,564 @@
|
|
|
1
|
-
# Georgian Language Hyphenation
|
|
1
|
+
# Georgian Language Hyphenation
|
|
2
2
|
|
|
3
|
-
[](https://pypi.org/project/georgian-hyphenation/)
|
|
4
3
|
[](https://www.npmjs.com/package/georgian-hyphenation)
|
|
5
|
-
[](https://www.python.org/downloads/)
|
|
6
|
-
[](https://www.ecma-international.org/)
|
|
7
4
|
[](https://opensource.org/licenses/MIT)
|
|
8
|
-
[](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
|
|
6
|
+
[](https://www.npmjs.com/package/georgian-hyphenation)
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
Georgian Language Hyphenation Library - Fast, accurate syllabification for Georgian (ქართული) text with support for both browser and Node.js environments.
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
## Features
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
- ✅ **Accurate Georgian syllabification** based on phonetic rules
|
|
13
|
+
- ✅ **Harmonic consonant clusters** recognition (ბრ, გრ, კრ, etc.)
|
|
14
|
+
- ✅ **Gemination handling** (double consonant splitting)
|
|
15
|
+
- ✅ **Exception dictionary** for irregular words (148 words)
|
|
16
|
+
- ✅ **HTML-aware hyphenation** - preserves tags and code blocks (new in v2.2.7)
|
|
17
|
+
- ✅ **17+ utility functions** for advanced text processing (new in v2.2.7)
|
|
18
|
+
- ✅ **Configurable settings** - adjust margins and hyphen character (new in v2.2.7)
|
|
19
|
+
- ✅ **Browser + Node.js compatible** (ESM & CommonJS)
|
|
20
|
+
- ✅ **Zero dependencies**
|
|
21
|
+
- ✅ **Lightweight** (~12KB)
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## ✨ Features / ფუნქციები
|
|
19
|
-
|
|
20
|
-
### 📝 Microsoft Word Add-in / ვორდის დამატება
|
|
21
|
-
|
|
22
|
-
* **ავტომატური დამარცვლა:** მონიშნეთ სასურველი აბზაცი და პროგრამა თავად გადაწყვეტს, სად არის მართებული სიტყვის გაყოფა.
|
|
23
|
-
* **უხილავი დეფისები (Soft Hyphens):** პროგრამა იყენებს სპეციალურ კოდს (`\u00AD`), რაც იმას ნიშნავს, რომ დეფისი გამოჩნდება მხოლოდ მაშინ, როცა სიტყვა სტრიქონის ბოლოს მოხვდება. ეს ინარჩუნებს ტექსტის სისუფთავეს ძებნისა და კოპირების დროს.
|
|
24
|
-
* **ვიზუალური მოწესრიგება:** განსაკუთრებით სასარგებლოა "გასწორებული" (Justified) ტექსტისთვის — ის აქრობს დიდ და არალამაზ ცარიელ ადგილებს სიტყვებს შორის.
|
|
25
|
-
* **აკადემიური სიზუსტე:** ითვალისწინებს ქართული ენის ისეთ სირთულეებს, როგორიცაა თანხმოვანთა გროვები და ჰარმონიული წყვილები.
|
|
26
|
-
|
|
27
|
-
### 🌟 New in v2.2.4 (Documentation Update)
|
|
28
|
-
|
|
29
|
-
* **📝 Corrected Examples**: გამოსწორდა არასწორი მაგალითები დოკუმენტაციაში (მაგ: არასწორი "კლასსი" → წაშლილია).
|
|
30
|
-
* **📚 Python README**: განახლდა Python package-ის README სრული და ზუსტი დოკუმენტაციით.
|
|
31
|
-
* **✅ PyPI Update**: ხელახლა გამოქვეყნდა PyPI-ზე გასწორებული README-ით.
|
|
32
|
-
|
|
33
|
-
### 🌟 v2.2.1 Features
|
|
34
|
-
|
|
35
|
-
* **🧹 Automatic Sanitization**: ბიბლიოთეკა ავტომატურად ცნობს და შლის ტექსტში უკვე არსებულ დამარცვლის ნიშნებს (Soft-hyphens) დამუშავებამდე. ეს გამორიცხავს "ორმაგი დამარცვლის" შეცდომას.
|
|
36
|
-
* **📚 Dictionary Integration**: მხარდაჭერილია გამონაკლისების ლექსიკონი (`exceptions.json`), რომელიც პრიორიტეტულია ალგორითმთან შედარებით რთული სიტყვების დამუშავებისას.
|
|
37
|
-
* **⚡ High Performance**: ჰარმონიული ჯგუფების ძებნა ოპტიმიზირებულია `Set` სტრუქტურით, რაც უზრუნველყოფს მყისიერ დამუშავებას (O(1) complexity) დიდ ტექსტებზეც კი.
|
|
38
|
-
* **📦 Modern ESM**: სრული თავსებადობა თანამედროვე JavaScript სტანდარტებთან (`import/export`), რაც აადვილებს ინტეგრაციას Vite, React და Vue პროექტებში.
|
|
39
|
-
|
|
40
|
-
### 🎓 v2.2 Academic Logic (Linguistic Core)
|
|
41
|
-
|
|
42
|
-
* **🧠 Phonological Distance Analysis**: ხმოვნებს შორის მანძილის ჭკვიანი გაზომვა ზუსტი დამარცვლისთვის.
|
|
43
|
-
* **🛡️ Anti-Orphan Protection**: ხელს უშლის სიტყვის დასაწყისში ან ბოლოში ერთი ასოს მარტო დატოვებას (მინიმუმ 2 სიმბოლო თითოეულ მხარეს).
|
|
44
|
-
* **🎼 Harmonic Clusters Support**: სპეციალური წესები ქართული ჰარმონიული თანხმოვნებისთვის (მაგ: `ბრ`, `წვ`, `მთ`), რომლებიც დამარცვლისას არ იშლება.
|
|
45
|
-
* **🔄 Hiatus Handling**: ხმოვანთშერწყმის (V-V) სწორი დამუშავება (მაგ: `გა-ა-ნა-ლი-ზა`).
|
|
46
|
-
|
|
47
|
-
### 🚀 Integration & Flexibility
|
|
48
|
-
|
|
49
|
-
* ✅ **Multi-Platform**: ხელმისაწვდომია Python, JavaScript (Node & Browser), WordPress და Browser Extensions პლატფორმებისთვის.
|
|
50
|
-
* ✅ **Universal Formats**: მხარდაჭერილია Soft-hyphen (\u00AD), ვიზუალური ტირე, TeX patterns და Hunspell ფორმატები.
|
|
51
|
-
* ✅ **Zero Dependencies**: ბიბლიოთეკა არის სრულიად დამოუკიდებელი და მსუბუქი (~5KB).
|
|
52
|
-
* ✅ **Punctuation Aware**: ტექსტის დამუშავებისას ინარჩუნებს სასვენ ნიშნებს, ციფრებს და ლათინურ სიმბოლოებს.
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
## 🧠 Algorithm Logic / ალგორითმის ლოგიკა
|
|
57
|
-
|
|
58
|
-
ბიბლიოთეკა იყენებს აკადემიურ ფონოლოგიურ ანალიზს, რომელიც ეფუძნება ხმოვნებს შორის მანძილს და თანხმოვნების ტიპებს. v2.2 ვერსიაში დამატებულია წინასწარი გასუფთავების ფენა (Sanitization).
|
|
59
|
-
|
|
60
|
-
### 1. წინასწარი დამუშავება (Sanitization)
|
|
61
|
-
|
|
62
|
-
დამარცვლის დაწყებამდე სისტემა ასრულებს შემდეგ ნაბიჯებს:
|
|
63
|
-
|
|
64
|
-
* **Cleaning**: ტექსტიდან იშლება ყველა არსებული დამარცვლის სიმბოლო (`\u00AD` ან `-`), რათა თავიდან ავიცილოთ ორმაგი დამარცვლა.
|
|
65
|
-
* **Validation**: მოკლე სიტყვები (4 სიმბოლოზე ნაკლები) და სიტყვები ხმოვნების გარეშე ავტომატურად გამოიტოვება.
|
|
66
|
-
|
|
67
|
-
### 2. ხმოვანთა მანძილის ანალიზი
|
|
68
|
-
|
|
69
|
-
ალგორითმი პოულობს ხმოვნების ინდექსებს და ითვლის მანძილს მათ შორის:
|
|
23
|
+
## Installation
|
|
70
24
|
|
|
71
|
-
* **V-V:** იყოფა ხმოვნებს შორის.
|
|
72
|
-
> მაგალითი: `გა-ა-ი-ა-რა-ღა`
|
|
73
|
-
|
|
74
|
-
* **V-C-V:** იყოფა პირველი ხმოვნის შემდეგ.
|
|
75
|
-
> მაგალითი: `მა-მა`, `დე-და`
|
|
76
|
-
|
|
77
|
-
* **V-CC-V:** სისტემა ამოწმებს თანხმოვნების ტიპს:
|
|
78
|
-
* **Double Consonants**: თუ გვერდიგვერდ ერთი და იგივე თანხმოვანია, იყოფა მათ შორის (იშვიათია ქართულში).
|
|
79
|
-
* **Harmonic Clusters**: თუ თანხმოვნები ქმნიან ჰარმონიულ წყვილს (მაგ: `ბრ`, `წვ`), ისინი რჩებიან ერთად და მარცვალი წყდება მათ წინ.
|
|
80
|
-
* **Default**: სხვა შემთხვევაში იყოფა პირველი თანხმოვნის შემდეგ.
|
|
81
|
-
|
|
82
|
-
### 3. უსაფრთხოების წესები (Constraints)
|
|
83
|
-
|
|
84
|
-
* **Anti-Orphan**: მარცვალი არასდროს წყდება ისე, რომ რომელიმე მხარეს დარჩეს მხოლოდ 1 ასო.
|
|
85
|
-
* **Left/Right Min**: დამარცვლა ხდება მხოლოდ მაშინ, თუ ორივე მხარეს მინიმუმ 2 სიმბოლო რჩება (მაგ: `არა` არ დაიყოფა).
|
|
86
|
-
|
|
87
|
-
### მაგალითების ანალიზი:
|
|
88
|
-
|
|
89
|
-
| სიტყვა | ანალიზი (ხმოვნებს შორის) | შედეგი | წესი |
|
|
90
|
-
| --- | --- | --- | --- |
|
|
91
|
-
| **საქართველო** | `ა-ქ-რ-ე` (2 თანხმოვანი) | `სა-ქარ-თვე-ლო` | სტანდარტული |
|
|
92
|
-
| **ბარბი** | `ა-რ-ბ-ი` ('რ' წესი) | `ბარ-ბი` | სპეციალური 'რ' წესი |
|
|
93
|
-
| **მწვრთნელი** | `მ-წ-ვ-რ-თ-ნ-ე` | `მწვრთნე-ლი` | ჰარმონიული ჯგუფი |
|
|
94
|
-
| **გაანალიზება** | `ა-ა` (0 თანხმოვანი) | `გა-ა-ნა-ლი-ზე-ბა` | ხმოვანთშერწყმა |
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## 📦 Installation / ინსტალაცია
|
|
99
|
-
|
|
100
|
-
### Python
|
|
101
|
-
```bash
|
|
102
|
-
pip install georgian-hyphenation
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### JavaScript (NPM)
|
|
106
25
|
```bash
|
|
107
26
|
npm install georgian-hyphenation
|
|
108
27
|
```
|
|
109
28
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
**🦊 Firefox:** [Install from Firefox Add-ons](https://addons.mozilla.org/firefox/addon/georgian-hyphenation/)
|
|
113
|
-
|
|
114
|
-
**🌐 Chrome:** *Coming soon to Chrome Web Store*
|
|
115
|
-
|
|
116
|
-
### 📝 Microsoft Word Add-in / ვორდის დამატება
|
|
29
|
+
## Quick Start
|
|
117
30
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
#### 1. საქაღალდის გაზიარება (Network Share)
|
|
121
|
-
1. შედით პროექტის ფოლდერში და იპოვნეთ საქაღალდე `word-addin`.
|
|
122
|
-
2. დააწკაპუნეთ მასზე მარჯვენა ღილაკით -> **Properties** -> **Sharing** -> **Share**.
|
|
123
|
-
3. დაამატეთ "Everyone" (ან თქვენი მომხმარებელი), მიეცით **Read/Write** უფლება და დააჭირეთ **Share**.
|
|
124
|
-
4. დააკოპირეთ მიღებული ქსელური მისამართი (მაგ: `\\თქვენი-კომპიუტერი\word-addin`).
|
|
125
|
-
|
|
126
|
-
#### 2. მისამართის დამატება Word-ში
|
|
127
|
-
1. გახსენით **Microsoft Word**.
|
|
128
|
-
2. გადადით: **File** -> **Options** -> **Trust Center** -> **Trust Center Settings...**.
|
|
129
|
-
3. მარცხენა მენიუში აირჩიეთ **Trusted Add-in Catalogs**.
|
|
130
|
-
4. **Catalog Url** ველში ჩასვით დაკოპირებული მისამართი და დააჭირეთ **Add Catalog**.
|
|
131
|
-
5. მონიშნეთ ოფცია **Show in Menu** და დააჭირეთ **OK**.
|
|
132
|
-
6. გადატვირთეთ Word-ი.
|
|
133
|
-
|
|
134
|
-
#### 3. დამატების გააქტიურება
|
|
135
|
-
1. Word-ში გადადით **Insert** ტაბზე -> **Get Add-ins** (ან My Add-ins).
|
|
136
|
-
2. ფანჯრის ზედა ნაწილში აირჩიეთ **Shared Folder**.
|
|
137
|
-
3. დაინახავთ "Georgian Hyphenation", მონიშნეთ და დააჭირეთ **Add**.
|
|
138
|
-
|
|
139
|
-
*ახლა "Home" ტაბზე გამოჩნდება ღილაკი "Georgian Hyphenator", რომელიც გახსნის სამუშაო პანელს.*
|
|
140
|
-
---
|
|
31
|
+
### ES Modules (Modern)
|
|
141
32
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
### Python API
|
|
145
|
-
```python
|
|
146
|
-
from georgian_hyphenation import GeorgianHyphenator
|
|
33
|
+
```javascript
|
|
34
|
+
import GeorgianHyphenator from 'georgian-hyphenation';
|
|
147
35
|
|
|
148
|
-
|
|
149
|
-
hyphenator = GeorgianHyphenator()
|
|
36
|
+
const hyphenator = new GeorgianHyphenator();
|
|
150
37
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
print(result) # საქართველო (with U+00AD soft hyphens)
|
|
38
|
+
// Basic hyphenation
|
|
39
|
+
console.log(hyphenator.hyphenate('საქართველო'));
|
|
40
|
+
// Output: საქართველო
|
|
155
41
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
42
|
+
// Get syllables as array
|
|
43
|
+
console.log(hyphenator.getSyllables('თბილისი'));
|
|
44
|
+
// Output: ['თბი', 'ლი', 'სი']
|
|
159
45
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
46
|
+
// Count syllables (NEW in v2.2.7)
|
|
47
|
+
console.log(hyphenator.countSyllables('გამარჯობა'));
|
|
48
|
+
// Output: 4
|
|
163
49
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
50
|
+
// Hyphenate HTML (NEW in v2.2.7)
|
|
51
|
+
const html = '<p>ქართული ენა <code>console.log()</code> პროგრამირება</p>';
|
|
52
|
+
console.log(hyphenator.hyphenateHTML(html));
|
|
53
|
+
// Code tags are preserved!
|
|
168
54
|
```
|
|
169
55
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
## 📚 JavaScript API (v2.2.4+)
|
|
56
|
+
### CommonJS (Node.js)
|
|
173
57
|
|
|
174
|
-
v2.2.4 ვერსია სრულად გადასულია **ES Modules (ESM)** სტანდარტზე, რაც უზრუნველყოფს საუკეთესო თავსებადობას თანამედროვე ხელსაწყოებთან (Vite, React, Vue, Next.js) და Node.js-ის ახალ ვერსიებთან.
|
|
175
|
-
|
|
176
|
-
### ⚙️ ინიციალიზაცია
|
|
177
58
|
```javascript
|
|
178
|
-
|
|
59
|
+
const GeorgianHyphenator = require('georgian-hyphenation');
|
|
179
60
|
|
|
180
|
-
// ნაგულისხმევი სიმბოლოა Soft-Hyphen (\u00AD)
|
|
181
61
|
const hyphenator = new GeorgianHyphenator();
|
|
182
|
-
|
|
183
|
-
// ტესტირებისთვის შეგიძლიათ გამოიყენოთ ხილული ტირე (-)
|
|
184
|
-
const visibleHyphenator = new GeorgianHyphenator('-');
|
|
62
|
+
console.log(hyphenator.hyphenate('კომპიუტერი'));
|
|
185
63
|
```
|
|
186
64
|
|
|
187
|
-
###
|
|
65
|
+
### Browser (CDN)
|
|
188
66
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
67
|
+
```html
|
|
68
|
+
<script type="module">
|
|
69
|
+
import GeorgianHyphenator from 'https://cdn.jsdelivr.net/npm/georgian-hyphenation@2.2.7/src/javascript/index.js';
|
|
70
|
+
|
|
71
|
+
const hyphenator = new GeorgianHyphenator();
|
|
72
|
+
console.log(hyphenator.hyphenate('პროგრამირება'));
|
|
73
|
+
</script>
|
|
193
74
|
```
|
|
194
75
|
|
|
195
|
-
|
|
196
|
-
```javascript
|
|
197
|
-
const longText = "გამარჯობა, საქართველო მშვენიერი ქვეყანაა!";
|
|
198
|
-
console.log(hyphenator.hyphenateText(longText));
|
|
199
|
-
```
|
|
76
|
+
## API Reference
|
|
200
77
|
|
|
201
|
-
|
|
202
|
-
```javascript
|
|
203
|
-
const syllables = hyphenator.getSyllables('უნივერსიტეტი');
|
|
204
|
-
console.log(syllables); // ["უ", "ნი", "ვერ", "სი", "ტე", "ტი"]
|
|
205
|
-
```
|
|
78
|
+
### Constructor
|
|
206
79
|
|
|
207
|
-
#### 4. `loadDefaultLibrary()` (Async)
|
|
208
80
|
```javascript
|
|
209
|
-
|
|
210
|
-
console.log('ლექსიკონი ჩაიტვირთა');
|
|
81
|
+
const hyphenator = new GeorgianHyphenator(hyphenChar = '\u00AD');
|
|
211
82
|
```
|
|
212
83
|
|
|
84
|
+
**Parameters:**
|
|
85
|
+
- `hyphenChar` (optional): Character to use for hyphenation. Default is soft hyphen (`\u00AD`)
|
|
86
|
+
|
|
213
87
|
---
|
|
214
88
|
|
|
215
|
-
##
|
|
216
|
-
```html
|
|
217
|
-
<p class="hyphenated" id="content"></p>
|
|
89
|
+
## Core Methods
|
|
218
90
|
|
|
219
|
-
|
|
220
|
-
import GeorgianHyphenator from 'https://cdn.jsdelivr.net/npm/georgian-hyphenation@2.2.4/src/javascript/index.js';
|
|
91
|
+
### `hyphenate(word)`
|
|
221
92
|
|
|
222
|
-
|
|
223
|
-
const hyphenator = new GeorgianHyphenator('\u00AD');
|
|
224
|
-
await hyphenator.loadDefaultLibrary();
|
|
93
|
+
Hyphenates a single word.
|
|
225
94
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
initializeHyphenator();
|
|
232
|
-
</script>
|
|
95
|
+
```javascript
|
|
96
|
+
hyphenator.hyphenate('საქართველო');
|
|
97
|
+
// Returns: 'საქართველო'
|
|
233
98
|
```
|
|
234
99
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
## 🎨 Export Formats / ექსპორტის ფორმატები
|
|
100
|
+
### `getSyllables(word)`
|
|
238
101
|
|
|
239
|
-
|
|
240
|
-
```python
|
|
241
|
-
from georgian_hyphenation import to_tex_pattern
|
|
102
|
+
Returns an array of syllables.
|
|
242
103
|
|
|
243
|
-
|
|
244
|
-
|
|
104
|
+
```javascript
|
|
105
|
+
hyphenator.getSyllables('თბილისი');
|
|
106
|
+
// Returns: ['თბი', 'ლი', 'სი']
|
|
245
107
|
```
|
|
246
108
|
|
|
247
|
-
|
|
248
|
-
```latex
|
|
249
|
-
\documentclass{article}
|
|
250
|
-
\usepackage{polyglossia}
|
|
251
|
-
\setmainlanguage{georgian}
|
|
252
|
-
\input{georgian-patterns.tex}
|
|
109
|
+
### `hyphenateText(text)`
|
|
253
110
|
|
|
254
|
-
|
|
255
|
-
საქართველო არის ძალიან ლამაზი ქვეყანა
|
|
256
|
-
\end{document}
|
|
257
|
-
```
|
|
111
|
+
Hyphenates all words in a text string.
|
|
258
112
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
print(to_hunspell_format('საქართველო'))
|
|
264
|
-
# Output: სა=ქარ=თვე=ლო
|
|
113
|
+
```javascript
|
|
114
|
+
hyphenator.hyphenateText('საქართველო არის ლამაზი ქვეყანა');
|
|
115
|
+
// Returns: 'საქართველო არის ლამაზი ქვეყანა'
|
|
265
116
|
```
|
|
266
117
|
|
|
267
118
|
---
|
|
268
|
-
## 📝 Microsoft Word Add-in / ვორდის დამატება
|
|
269
119
|
|
|
270
|
-
|
|
120
|
+
## New in v2.2.7: Utility Functions
|
|
271
121
|
|
|
272
|
-
###
|
|
273
|
-
* **აკადემიური სიზუსტე (v3.8.2)**: ალგორითმი ითვალისწინებს ქართული ენის რთულ კონსონანტურ ჯგუფებს და ფონეტიკურ წესებს.
|
|
274
|
-
* **უხილავი დამარცვლა (Soft Hyphens)**: იყენებს `\u00AD` სიმბოლოს, რაც უზრუნველყოფს ტექსტის სწორ გადანაწილებას ხაზებს შორის ისე, რომ დოკუმენტის სტრუქტურა და ძებნის ფუნქცია არ ზიანდება.
|
|
275
|
-
* **Task Pane ინტერფეისი**: მოსახერხებელი გვერდითა პანელი, რომელიც საშუალებას გაძლევთ ერთი დაწკაპუნებით დაამუშავოთ მონიშნული ტექსტი.
|
|
276
|
-
* **ფორმატირების შენარჩუნება**: Add-in მუშაობს Word-ის ობიექტურ მოდელთან, რაც გარანტიას იძლევა, რომ თქვენი ტექსტის სტილი, ფონტი და ზომა უცვლელი დარჩება.
|
|
122
|
+
### `countSyllables(word)`
|
|
277
123
|
|
|
124
|
+
Get the number of syllables in a word.
|
|
278
125
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
### Features:
|
|
126
|
+
```javascript
|
|
127
|
+
hyphenator.countSyllables('გამარჯობა');
|
|
128
|
+
// Returns: 4
|
|
129
|
+
```
|
|
284
130
|
|
|
285
|
-
|
|
286
|
-
* ✅ **Automatic hyphenation** on all Georgian websites
|
|
287
|
-
* ✅ **CSS Injection**: Properly hides soft hyphens until line break
|
|
288
|
-
* ✅ **Smart Skip Logic**: Balanced detection - skips navigation, headers, buttons
|
|
289
|
-
* ✅ **Smart Justify**: Optional text alignment (Firefox only)
|
|
290
|
-
* ✅ **Dictionary Support**: 150+ exception words from CDN
|
|
291
|
-
* ✅ **Works everywhere**: Facebook, Twitter, Wikipedia, News sites
|
|
292
|
-
* ✅ **Toggle on/off** per site
|
|
293
|
-
* ✅ **Real-time statistics**: Words processed & hyphenated count
|
|
294
|
-
* ✅ **Zero performance impact**: Efficient O(1) harmonic cluster lookup
|
|
295
|
-
* ✅ **Dynamic content support**: React, Vue, Angular, AJAX
|
|
296
|
-
* ✅ **Respects editable fields**: No interference with typing
|
|
297
|
-
* ✅ **MutationObserver**: Automatically processes new content
|
|
131
|
+
### `getHyphenationPoints(word)`
|
|
298
132
|
|
|
299
|
-
|
|
133
|
+
Get the number of hyphenation points (hyphens) in a word.
|
|
300
134
|
|
|
301
|
-
|
|
135
|
+
```javascript
|
|
136
|
+
hyphenator.getHyphenationPoints('გამარჯობა');
|
|
137
|
+
// Returns: 3 (four syllables = three hyphens)
|
|
138
|
+
```
|
|
302
139
|
|
|
303
|
-
|
|
304
|
-
2. Click "Add to Firefox"
|
|
305
|
-
3. Extension will auto-activate on Georgian websites
|
|
306
|
-
4. Click extension icon to toggle or view stats
|
|
140
|
+
### `isGeorgian(text)`
|
|
307
141
|
|
|
308
|
-
|
|
142
|
+
Check if text contains only Georgian characters.
|
|
309
143
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
6. Extension is ready! ✅
|
|
144
|
+
```javascript
|
|
145
|
+
hyphenator.isGeorgian('გამარჯობა'); // true
|
|
146
|
+
hyphenator.isGeorgian('hello'); // false
|
|
147
|
+
hyphenator.isGeorgian('გამარჯობა123'); // false
|
|
148
|
+
```
|
|
316
149
|
|
|
317
|
-
###
|
|
150
|
+
### `canHyphenate(word)`
|
|
318
151
|
|
|
319
|
-
|
|
320
|
-
- Fixed issue where soft hyphens were visible as dashes before line breaks
|
|
321
|
-
- Added CSS injection: `hyphens: manual`, `overflow-wrap: break-word`
|
|
322
|
-
- Properly hides `\u00AD` characters until browser line breaking
|
|
323
|
-
- Fixes font rendering issues across different websites
|
|
152
|
+
Check if a word meets minimum length requirements for hyphenation.
|
|
324
153
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
- Removed overly restrictive content container detection
|
|
154
|
+
```javascript
|
|
155
|
+
hyphenator.canHyphenate('გა'); // false (too short)
|
|
156
|
+
hyphenator.canHyphenate('გამარ'); // true
|
|
157
|
+
```
|
|
330
158
|
|
|
331
|
-
|
|
332
|
-
- Embedded NPM v2.2.4 library (no external dependencies)
|
|
333
|
-
- O(1) harmonic cluster lookup with Set structure
|
|
334
|
-
- Efficient DOM traversal with depth limits
|
|
335
|
-
- Throttled processing (1000ms cooldown)
|
|
159
|
+
### `unhyphenate(text)`
|
|
336
160
|
|
|
337
|
-
|
|
338
|
-
- Automatic sanitization of old hyphens
|
|
339
|
-
- CSS removal on extension disable
|
|
340
|
-
- Better console logging for debugging
|
|
341
|
-
- MutationObserver for dynamic content
|
|
161
|
+
Remove all hyphenation from text.
|
|
342
162
|
|
|
343
|
-
|
|
163
|
+
```javascript
|
|
164
|
+
const hyphenated = hyphenator.hyphenate('გამარჯობა');
|
|
165
|
+
hyphenator.unhyphenate(hyphenated);
|
|
166
|
+
// Returns: 'გამარჯობა'
|
|
167
|
+
```
|
|
344
168
|
|
|
345
|
-
|
|
346
|
-
* ✅ **Chrome** 88+ (Manifest v3)
|
|
169
|
+
### `hyphenateWords(words)`
|
|
347
170
|
|
|
348
|
-
|
|
171
|
+
Hyphenate multiple words at once (batch processing).
|
|
349
172
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
- Toggle Smart Justify (Firefox only)
|
|
356
|
-
- View statistics (words processed/hyphenated)
|
|
173
|
+
```javascript
|
|
174
|
+
const words = ['ქართული', 'ენა', 'მშვენიერია'];
|
|
175
|
+
hyphenator.hyphenateWords(words);
|
|
176
|
+
// Returns: ['ქართული', 'ენა', 'მშვენიერია']
|
|
177
|
+
```
|
|
357
178
|
|
|
358
|
-
|
|
359
|
-
- Open Browser Console (F12)
|
|
360
|
-
- Look for logs: `🇬🇪 GH v2.2.4: ...`
|
|
361
|
-
- Check processing stats and any errors
|
|
179
|
+
### `hyphenateHTML(html)` ⭐ Most Useful!
|
|
362
180
|
|
|
363
|
-
|
|
181
|
+
Hyphenate HTML content while preserving tags and skipping code blocks.
|
|
364
182
|
|
|
365
|
-
|
|
366
|
-
|
|
183
|
+
```javascript
|
|
184
|
+
const html = `
|
|
185
|
+
<article>
|
|
186
|
+
<h1>ქართული ენა</h1>
|
|
187
|
+
<p>პროგრამირება და კომპიუტერული მეცნიერება</p>
|
|
188
|
+
<code>console.log('skip me')</code>
|
|
189
|
+
<pre>this won't be hyphenated</pre>
|
|
190
|
+
</article>
|
|
191
|
+
`;
|
|
192
|
+
|
|
193
|
+
const result = hyphenator.hyphenateHTML(html);
|
|
194
|
+
// Only <p> content gets hyphenated
|
|
195
|
+
// <code>, <pre>, <script>, <style>, <textarea> are preserved
|
|
196
|
+
```
|
|
367
197
|
|
|
368
|
-
|
|
369
|
-
- Check Console (F12) for "Skipping blacklisted site" message
|
|
370
|
-
- Blacklisted: claude.ai, chat.openai.com, gemini.google.com
|
|
198
|
+
---
|
|
371
199
|
|
|
372
|
-
|
|
373
|
-
- Refresh page after installation
|
|
374
|
-
- Check extension is enabled in browser settings
|
|
375
|
-
- Review Console for error messages
|
|
200
|
+
## New in v2.2.7: Configuration Methods
|
|
376
201
|
|
|
377
|
-
|
|
202
|
+
All configuration methods support **method chaining**:
|
|
378
203
|
|
|
379
|
-
|
|
204
|
+
### `setLeftMin(value)`
|
|
380
205
|
|
|
381
|
-
|
|
206
|
+
Set minimum characters before the first hyphen (default: 2).
|
|
382
207
|
|
|
383
|
-
|
|
208
|
+
```javascript
|
|
209
|
+
hyphenator.setLeftMin(3);
|
|
210
|
+
// Now requires at least 3 characters before first hyphen
|
|
211
|
+
```
|
|
384
212
|
|
|
385
|
-
|
|
386
|
-
* ✅ **Dictionary Support**: 150+ exception words for edge cases (optional)
|
|
387
|
-
* ✅ **Automatic Sanitization**: Strips old hyphens before re-processing
|
|
388
|
-
* ✅ **Full Elementor support** with individual widget controls
|
|
389
|
-
* ✅ **Modern UI** with Red/Green switches
|
|
390
|
-
* ✅ **Smart Fallback** (automatically finds content)
|
|
391
|
-
* ✅ **Custom CSS selectors** with helper guide
|
|
392
|
-
* ✅ **Auto-justify option**
|
|
393
|
-
* ✅ **Real-time configuration preview**
|
|
394
|
-
* ✅ **Debug console logging**
|
|
395
|
-
* ✅ **MutationObserver** for dynamic content (AJAX, Load More)
|
|
396
|
-
* ✅ **Zero performance impact**
|
|
213
|
+
### `setRightMin(value)`
|
|
397
214
|
|
|
398
|
-
|
|
215
|
+
Set minimum characters after the last hyphen (default: 2).
|
|
399
216
|
|
|
400
|
-
|
|
217
|
+
```javascript
|
|
218
|
+
hyphenator.setRightMin(3);
|
|
219
|
+
// Now requires at least 3 characters after last hyphen
|
|
220
|
+
```
|
|
401
221
|
|
|
402
|
-
|
|
222
|
+
### `setHyphenChar(char)`
|
|
403
223
|
|
|
404
|
-
|
|
405
|
-
2. WordPress Admin → Plugins → Add New → Upload Plugin
|
|
406
|
-
3. Choose ZIP file and click "Install Now"
|
|
407
|
-
4. Activate the plugin
|
|
408
|
-
5. Go to **"Geo Hyphenation"** in the main left sidebar menu
|
|
224
|
+
Change the hyphen character.
|
|
409
225
|
|
|
410
|
-
|
|
226
|
+
```javascript
|
|
227
|
+
// Use visible hyphen for debugging
|
|
228
|
+
hyphenator.setHyphenChar('-');
|
|
229
|
+
console.log(hyphenator.hyphenate('გამარჯობა'));
|
|
230
|
+
// Output: 'გა-მარ-ჯო-ბა'
|
|
231
|
+
|
|
232
|
+
// Use custom separator
|
|
233
|
+
hyphenator.setHyphenChar('•');
|
|
234
|
+
console.log(hyphenator.hyphenate('საქართველო'));
|
|
235
|
+
// Output: 'სა•ქარ•თვე•ლო'
|
|
236
|
+
```
|
|
411
237
|
|
|
412
|
-
|
|
238
|
+
### Method Chaining
|
|
413
239
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
3
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
* Icon Box Widget (`.elementor-icon-box-description`)
|
|
420
|
-
* Testimonial Widget (`.elementor-testimonial-content`)
|
|
421
|
-
* Accordion/Tabs/Toggle (`.elementor-accordion-content`, etc.)
|
|
240
|
+
```javascript
|
|
241
|
+
const hyphenator = new GeorgianHyphenator()
|
|
242
|
+
.setLeftMin(3)
|
|
243
|
+
.setRightMin(3)
|
|
244
|
+
.setHyphenChar('-');
|
|
422
245
|
|
|
423
|
-
|
|
424
|
-
```
|
|
425
|
-
article p, .entry-content p, .my-custom-class
|
|
246
|
+
console.log(hyphenator.hyphenate('გამარჯობა'));
|
|
426
247
|
```
|
|
427
248
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
### Requirements:
|
|
249
|
+
---
|
|
431
250
|
|
|
432
|
-
|
|
433
|
-
* PHP 7.0+
|
|
434
|
-
* Works with or without Elementor
|
|
435
|
-
* Modern browser with ES Module support
|
|
251
|
+
## New in v2.2.7: Dictionary Management
|
|
436
252
|
|
|
437
|
-
###
|
|
253
|
+
### `loadLibrary(data)`
|
|
438
254
|
|
|
439
|
-
|
|
440
|
-
* ✅ All WordPress themes
|
|
441
|
-
* ✅ Page builders (Elementor, Gutenberg)
|
|
442
|
-
* ✅ Classic Editor
|
|
443
|
-
* ✅ WooCommerce
|
|
444
|
-
* ✅ Multisite
|
|
255
|
+
Load custom exception dictionary.
|
|
445
256
|
|
|
446
|
-
|
|
257
|
+
```javascript
|
|
258
|
+
const customWords = {
|
|
259
|
+
'განათლება': 'გა-ნათ-ლე-ბა',
|
|
260
|
+
'უნივერსიტეტი': 'უ-ნი-ვერ-სი-ტე-ტი'
|
|
261
|
+
};
|
|
447
262
|
|
|
448
|
-
|
|
449
|
-
```log
|
|
450
|
-
🇬🇪 GH v2.2.4: 🚀 Initializing...
|
|
451
|
-
🇬🇪 GH v2.2.4: 📋 Elements found: 12
|
|
452
|
-
🇬🇪 GH v2.2.4: 📚 Dictionary loaded
|
|
453
|
-
🇬🇪 GH v2.2.4: ✅ Processed 12 elements
|
|
263
|
+
hyphenator.loadLibrary(customWords);
|
|
454
264
|
```
|
|
455
265
|
|
|
456
|
-
###
|
|
266
|
+
### `async loadDefaultLibrary()`
|
|
457
267
|
|
|
458
|
-
|
|
459
|
-
* 📚 **Dictionary Support**: Optional CDN loading of 150+ exception words
|
|
460
|
-
* 🧹 **Auto Sanitization**: Built-in cleaning of old hyphens before processing
|
|
461
|
-
* ⚡ **Performance**: O(1) harmonic cluster lookup with Set structure
|
|
462
|
-
* 🎯 **Hybrid Engine**: Dictionary-first, algorithm fallback
|
|
268
|
+
Load the built-in exception dictionary (148 words).
|
|
463
269
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
270
|
+
```javascript
|
|
271
|
+
await hyphenator.loadDefaultLibrary();
|
|
272
|
+
// Dictionary loaded with tech terms, places, political terms
|
|
273
|
+
```
|
|
467
274
|
|
|
468
|
-
|
|
469
|
-
* Fixed visible soft hyphens issue - hyphens now properly hidden until line break
|
|
470
|
-
* Added comprehensive CSS injection for proper hyphenation rendering
|
|
471
|
-
* Fixed font-feature-settings conflicts
|
|
275
|
+
### `addException(word, hyphenated)`
|
|
472
276
|
|
|
473
|
-
|
|
474
|
-
* Optimized skip detection: fontSize > 20px (from 16px)
|
|
475
|
-
* 5-level ancestor check (optimized from 15 levels)
|
|
476
|
-
* Removed restrictive content container requirement
|
|
477
|
-
* Better navigation/header/button detection
|
|
277
|
+
Add a single custom hyphenation exception.
|
|
478
278
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
* O(1) harmonic cluster lookup
|
|
482
|
-
* Efficient DOM traversal
|
|
483
|
-
* Throttled processing
|
|
279
|
+
```javascript
|
|
280
|
+
hyphenator.addException('ტესტი', 'ტეს-ტი');
|
|
484
281
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
* CSS injection with ID for removal
|
|
489
|
-
* Works: formulanews.ge tested (514 words processed, 483 hyphenated)
|
|
282
|
+
console.log(hyphenator.hyphenate('ტესტი'));
|
|
283
|
+
// Returns: 'ტესტი' (uses your custom hyphenation)
|
|
284
|
+
```
|
|
490
285
|
|
|
491
|
-
|
|
492
|
-
* Manifest v2 with browser.* API
|
|
493
|
-
* Smart Justify toggle in UI
|
|
494
|
-
* browser.storage.sync for settings
|
|
495
|
-
* Auto-injection on page load
|
|
286
|
+
### `removeException(word)`
|
|
496
287
|
|
|
497
|
-
|
|
288
|
+
Remove an exception from the dictionary.
|
|
498
289
|
|
|
499
|
-
|
|
290
|
+
```javascript
|
|
291
|
+
hyphenator.removeException('ტესტი');
|
|
292
|
+
// Returns: true (if word was removed)
|
|
293
|
+
```
|
|
500
294
|
|
|
501
|
-
|
|
502
|
-
* 📚 **Dictionary Support**: Optional CDN loading of 150+ exception words
|
|
503
|
-
* 🧹 **Auto Sanitization**: Built-in cleaning of old hyphens before processing
|
|
504
|
-
* ⚡ **Performance**: O(1) harmonic cluster lookup with Set structure
|
|
295
|
+
### `exportDictionary()`
|
|
505
296
|
|
|
506
|
-
|
|
297
|
+
Export the entire dictionary as a JSON object.
|
|
507
298
|
|
|
508
|
-
|
|
299
|
+
```javascript
|
|
300
|
+
const dict = hyphenator.exportDictionary();
|
|
301
|
+
console.log(dict);
|
|
302
|
+
// { "გამარჯობა": "გა-მარ-ჯო-ბა", ... }
|
|
303
|
+
```
|
|
509
304
|
|
|
510
|
-
|
|
511
|
-
* 📚 **Python README**: განახლდა Python package-ის README სრული დოკუმენტაციით.
|
|
512
|
-
* ✅ **PyPI v2.2.2**: ხელახლა გამოქვეყნდა PyPI-ზე გასწორებული დოკუმენტაციით.
|
|
305
|
+
### `getDictionarySize()`
|
|
513
306
|
|
|
514
|
-
|
|
307
|
+
Get the number of words in the dictionary.
|
|
515
308
|
|
|
516
|
-
|
|
309
|
+
```javascript
|
|
310
|
+
await hyphenator.loadDefaultLibrary();
|
|
311
|
+
console.log(hyphenator.getDictionarySize());
|
|
312
|
+
// Output: 148
|
|
313
|
+
```
|
|
517
314
|
|
|
518
|
-
* 🧹 **Automatic Sanitization**: დაემატა `_stripHyphens` ფუნქციონალი
|
|
519
|
-
* 📦 **ES Modules (ESM)**: სრული ESM სტანდარტი
|
|
520
|
-
* 📚 **Async Dictionary Support**: `loadDefaultLibrary()` მეთოდი
|
|
521
|
-
* ⚡ **Optimization**: Set-based harmonic cluster lookup
|
|
522
|
-
* 🛠 **Package Improvements**: განახლებული package.json
|
|
523
315
|
---
|
|
524
316
|
|
|
525
|
-
##
|
|
317
|
+
## New in v2.2.7: Advanced Features
|
|
526
318
|
|
|
527
|
-
|
|
319
|
+
### Harmonic Cluster Management
|
|
528
320
|
|
|
529
|
-
|
|
321
|
+
For advanced users who need to customize consonant cluster recognition:
|
|
530
322
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
* View syllable breakdown
|
|
535
|
-
* Compare different output formats
|
|
536
|
-
|
|
537
|
-
---
|
|
323
|
+
```javascript
|
|
324
|
+
// Add a custom harmonic cluster
|
|
325
|
+
hyphenator.addHarmonicCluster('ტვ');
|
|
538
326
|
|
|
539
|
-
|
|
327
|
+
// Remove a cluster
|
|
328
|
+
hyphenator.removeHarmonicCluster('ტვ');
|
|
540
329
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
| ბლოკი | ბლო, კი | ბლო-კი | .ბლო1კი. |
|
|
547
|
-
| კრემი | კრე, მი | კრე-მი | .კრე1მი. |
|
|
548
|
-
| ტელევიზორი | ტე, ლე, ვი, ზო, რი | ტე-ლე-ვი-ზო-რი | .ტე1ლე1ვი1ზო1რი. |
|
|
549
|
-
| უნივერსიტეტი | უ, ნი, ვერ, სი, ტე, ტი | უ-ნი-ვერ-სი-ტე-ტი | .უ1ნი1ვერ1სი1ტე1ტი. |
|
|
330
|
+
// Get all clusters
|
|
331
|
+
const clusters = hyphenator.getHarmonicClusters();
|
|
332
|
+
console.log(clusters);
|
|
333
|
+
// ['ბლ', 'ბრ', 'ბღ', ... (70+ clusters)]
|
|
334
|
+
```
|
|
550
335
|
|
|
551
336
|
---
|
|
552
337
|
|
|
553
|
-
##
|
|
554
|
-
```bash
|
|
555
|
-
# Python tests
|
|
556
|
-
python test_python.py
|
|
338
|
+
## CSS Integration
|
|
557
339
|
|
|
558
|
-
|
|
559
|
-
node test_javascript.js
|
|
560
|
-
```
|
|
340
|
+
Use soft hyphens for automatic line breaking:
|
|
561
341
|
|
|
562
|
-
|
|
342
|
+
```css
|
|
343
|
+
.georgian-text {
|
|
344
|
+
hyphens: auto;
|
|
345
|
+
-webkit-hyphens: auto;
|
|
346
|
+
-ms-hyphens: auto;
|
|
347
|
+
}
|
|
348
|
+
```
|
|
563
349
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
350
|
+
```javascript
|
|
351
|
+
const hyphenator = new GeorgianHyphenator('\u00AD'); // soft hyphen
|
|
352
|
+
document.querySelector('.georgian-text').innerHTML =
|
|
353
|
+
hyphenator.hyphenateText('თქვენი ტექსტი აქ');
|
|
354
|
+
```
|
|
569
355
|
|
|
570
356
|
---
|
|
571
357
|
|
|
572
|
-
##
|
|
358
|
+
## Built-in Dictionary
|
|
573
359
|
|
|
574
|
-
|
|
360
|
+
The library includes 148 pre-hyphenated words including:
|
|
575
361
|
|
|
576
|
-
|
|
362
|
+
**Tech Terms:** კომპიუტერი, ფეისბუქი, იუთუბი, ინსტაგრამი
|
|
363
|
+
**Places:** საქართველო, თბილისი
|
|
364
|
+
**Political:** პარლამენტი, დემოკრატია, რესპუბლიკა
|
|
365
|
+
**Compound Words:** სახელმწიფო, გულმავიწყი, თავდადებული
|
|
577
366
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
367
|
+
```javascript
|
|
368
|
+
await hyphenator.loadDefaultLibrary();
|
|
369
|
+
console.log(hyphenator.hyphenate('კომპიუტერი'));
|
|
370
|
+
// Uses dictionary: 'კომპიუტერი'
|
|
371
|
+
```
|
|
583
372
|
|
|
584
373
|
---
|
|
585
374
|
|
|
586
|
-
##
|
|
375
|
+
## Algorithm
|
|
587
376
|
|
|
588
|
-
|
|
377
|
+
The library uses a phonetic algorithm based on Georgian syllable structure:
|
|
589
378
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
379
|
+
1. **Vowel Detection**: Identifies vowels (ა, ე, ი, ო, უ)
|
|
380
|
+
2. **Consonant Cluster Analysis**: Recognizes 70+ harmonic clusters
|
|
381
|
+
3. **Gemination Rules**: Splits double consonants (კკ → კკ)
|
|
382
|
+
4. **Orphan Prevention**: Ensures minimum syllable length (2 characters by default)
|
|
383
|
+
5. **Dictionary Lookup**: Checks exceptions first for accuracy
|
|
594
384
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
### Version 2.2.2 (Library) (2026-01-27) — Documentation Update 📝
|
|
385
|
+
### Supported Harmonic Clusters
|
|
598
386
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
387
|
+
```
|
|
388
|
+
ბლ, ბრ, ბღ, ბზ, გდ, გლ, გმ, გნ, გვ, გზ, გრ, დრ, თლ, თრ, თღ,
|
|
389
|
+
კლ, კმ, კნ, კრ, კვ, მტ, პლ, პრ, ჟღ, რგ, რლ, რმ, სწ, სხ, ტკ,
|
|
390
|
+
ტპ, ტრ, ფლ, ფრ, ფქ, ფშ, ქლ, ქნ, ქვ, ქრ, ღლ, ღრ, ყლ, ყრ, შთ,
|
|
391
|
+
შპ, ჩქ, ჩრ, ცლ, ცნ, ცრ, ცვ, ძგ, ძვ, ძღ, წლ, წრ, წნ, წკ, ჭკ,
|
|
392
|
+
ჭრ, ჭყ, ხლ, ხმ, ხნ, ხვ, ჯგ
|
|
393
|
+
```
|
|
602
394
|
|
|
603
395
|
---
|
|
604
396
|
|
|
605
|
-
|
|
397
|
+
## Use Cases & Examples
|
|
606
398
|
|
|
607
|
-
|
|
608
|
-
* 📦 **ES Modules (ESM)**: ბიბლიოთეკა სრულად გადავიდა თანამედროვე JavaScript სტანდარტზე (`import/export`).
|
|
609
|
-
* 📚 **Async Dictionary Support**: დაემატა `loadDefaultLibrary()` მეთოდი გამონაკლისების ლექსიკონის ავტომატური ჩატვირთვისთვის.
|
|
610
|
-
* ⚡ **Optimization**: ჰარმონიული ჯგუფების ძებნა გადავიდა `Set` სტრუქტურაზე სისწრაფისთვის.
|
|
611
|
-
* 🛠 **Package Improvements**: განახლდა `package.json` კონფიგურაცია (`exports`, `files` whitelist) NPM-ისთვის.
|
|
399
|
+
### E-book Reader
|
|
612
400
|
|
|
613
|
-
|
|
401
|
+
```javascript
|
|
402
|
+
const hyphenator = new GeorgianHyphenator();
|
|
403
|
+
await hyphenator.loadDefaultLibrary();
|
|
614
404
|
|
|
615
|
-
|
|
405
|
+
function formatBook(htmlContent) {
|
|
406
|
+
return hyphenator.hyphenateHTML(htmlContent);
|
|
407
|
+
}
|
|
616
408
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
* დაემატა თანამედროვე Red/Green UI გადამრთველები (Switches).
|
|
620
|
-
* **Smart Fallback**: დაემატა სელექტორების ავტომატური მოძებნის ლოგიკა.
|
|
621
|
-
* **Helper Text**: დაემატა დეტალური ინსტრუქციები Custom CSS სელექტორების გამოსაყენებლად.
|
|
409
|
+
document.getElementById('content').innerHTML = formatBook(bookHTML);
|
|
410
|
+
```
|
|
622
411
|
|
|
623
|
-
|
|
412
|
+
### Text Justification
|
|
624
413
|
|
|
625
|
-
|
|
414
|
+
```javascript
|
|
415
|
+
const hyphenator = new GeorgianHyphenator('\u00AD');
|
|
626
416
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
417
|
+
const justified = hyphenator.hyphenateText(
|
|
418
|
+
'საქართველო არის ერთ-ერთი უძველესი ქვეყანა მსოფლიოში'
|
|
419
|
+
);
|
|
420
|
+
```
|
|
630
421
|
|
|
631
|
-
|
|
422
|
+
### Blog/CMS Integration
|
|
632
423
|
|
|
633
|
-
|
|
424
|
+
```javascript
|
|
425
|
+
const hyphenator = new GeorgianHyphenator();
|
|
426
|
+
await hyphenator.loadDefaultLibrary();
|
|
634
427
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
* 🏗️ **Packaging**: დაემატა `pyproject.toml` მხარდაჭერა Python-ისთვის.
|
|
428
|
+
// Hyphenate all articles
|
|
429
|
+
document.querySelectorAll('article p').forEach(p => {
|
|
430
|
+
p.innerHTML = hyphenator.hyphenateHTML(p.innerHTML);
|
|
431
|
+
});
|
|
432
|
+
```
|
|
641
433
|
|
|
642
|
-
|
|
434
|
+
### Form Validation
|
|
643
435
|
|
|
644
|
-
|
|
436
|
+
```javascript
|
|
437
|
+
const hyphenator = new GeorgianHyphenator();
|
|
645
438
|
|
|
646
|
-
|
|
439
|
+
function validateGeorgianInput(text) {
|
|
440
|
+
if (!hyphenator.isGeorgian(text)) {
|
|
441
|
+
alert('გთხოვთ შეიყვანოთ მხოლოდ ქართული ტექსტი');
|
|
442
|
+
return false;
|
|
443
|
+
}
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
```
|
|
647
447
|
|
|
648
|
-
|
|
649
|
-
* ✅ PyPI v2.2.2 release - **DONE**
|
|
650
|
-
* ✅ NPM v2.2.4 release - **DONE**
|
|
651
|
-
* ✅ Firefox Extension v2.2.4 - **DONE**
|
|
652
|
-
* ✅ Chrome Extension v2.2.4 - **DONE**
|
|
653
|
-
* ✅ WordPress Plugin v2.2.4 - **DONE**
|
|
654
|
-
* 🔄 Chrome Web Store submission
|
|
448
|
+
### Syllable-based Animation
|
|
655
449
|
|
|
656
|
-
|
|
450
|
+
```javascript
|
|
451
|
+
const hyphenator = new GeorgianHyphenator();
|
|
452
|
+
const syllables = hyphenator.getSyllables('პროგრამირება');
|
|
453
|
+
|
|
454
|
+
syllables.forEach((syllable, i) => {
|
|
455
|
+
setTimeout(() => {
|
|
456
|
+
console.log(syllable);
|
|
457
|
+
}, i * 200);
|
|
458
|
+
});
|
|
459
|
+
// Displays: პრო... გრა... მი... რე... ბა
|
|
460
|
+
```
|
|
657
461
|
|
|
658
|
-
|
|
659
|
-
* 📚 Academic paper publication
|
|
660
|
-
* 🎨 Adobe InDesign plugin
|
|
661
|
-
* 📊 Microsoft Word add-in
|
|
462
|
+
---
|
|
662
463
|
|
|
663
|
-
|
|
464
|
+
## Browser Support
|
|
664
465
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
466
|
+
- ✅ Chrome/Edge 90+
|
|
467
|
+
- ✅ Firefox 88+
|
|
468
|
+
- ✅ Safari 14+
|
|
469
|
+
- ✅ Node.js 14+
|
|
669
470
|
|
|
670
471
|
---
|
|
671
472
|
|
|
672
|
-
##
|
|
473
|
+
## Performance
|
|
673
474
|
|
|
674
|
-
|
|
475
|
+
- Average hyphenation speed: **~0.05ms per word**
|
|
476
|
+
- HTML hyphenation: **~2ms for 1000 words**
|
|
477
|
+
- Memory usage: **~100KB with dictionary loaded**
|
|
478
|
+
- Optimized with `Set` for O(1) cluster lookups
|
|
675
479
|
|
|
676
480
|
---
|
|
677
481
|
|
|
678
|
-
##
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
482
|
+
## Changelog
|
|
483
|
+
|
|
484
|
+
### v2.2.7 (2025-02-13) 🎉
|
|
485
|
+
|
|
486
|
+
**New Features (17 functions added):**
|
|
487
|
+
|
|
488
|
+
✨ **Utility Functions:**
|
|
489
|
+
- `countSyllables(word)` - Get syllable count
|
|
490
|
+
- `getHyphenationPoints(word)` - Get hyphen count
|
|
491
|
+
- `isGeorgian(text)` - Validate Georgian text
|
|
492
|
+
- `canHyphenate(word)` - Check if word can be hyphenated
|
|
493
|
+
- `unhyphenate(text)` - Remove all hyphens
|
|
494
|
+
- `hyphenateWords(words)` - Batch processing
|
|
495
|
+
- `hyphenateHTML(html)` - HTML-aware hyphenation 🌟
|
|
496
|
+
|
|
497
|
+
✨ **Configuration (Chainable):**
|
|
498
|
+
- `setLeftMin(value)` - Configure left margin
|
|
499
|
+
- `setRightMin(value)` - Configure right margin
|
|
500
|
+
- `setHyphenChar(char)` - Change hyphen character
|
|
501
|
+
|
|
502
|
+
✨ **Dictionary Management:**
|
|
503
|
+
- `addException(word, hyphenated)` - Add custom word
|
|
504
|
+
- `removeException(word)` - Remove exception
|
|
505
|
+
- `exportDictionary()` - Export as JSON
|
|
506
|
+
- `getDictionarySize()` - Get word count
|
|
507
|
+
|
|
508
|
+
✨ **Advanced:**
|
|
509
|
+
- `addHarmonicCluster(cluster)` - Add custom cluster
|
|
510
|
+
- `removeHarmonicCluster(cluster)` - Remove cluster
|
|
511
|
+
- `getHarmonicClusters()` - List all clusters
|
|
512
|
+
|
|
513
|
+
**Improvements:**
|
|
514
|
+
- 🔧 All configuration methods support method chaining
|
|
515
|
+
- 📚 JSDoc documentation for all methods
|
|
516
|
+
- ✅ 100% backwards compatible
|
|
517
|
+
- 🎯 No breaking changes
|
|
518
|
+
|
|
519
|
+
### v2.2.6 (2026-01-30)
|
|
520
|
+
- ✨ Preserves regular hyphens in compound words
|
|
521
|
+
- 🐛 Fixed hyphen stripping to only remove soft hyphens and zero-width spaces
|
|
522
|
+
- 📝 Improved documentation
|
|
523
|
+
|
|
524
|
+
### v2.2.4 (2026-01-27)
|
|
525
|
+
- 🌐 **Browser Fix**: Fixed CDN URL for reliable dictionary loading
|
|
526
|
+
- 📦 **NPM Files**: Added `data/` folder to published package
|
|
527
|
+
- 🔧 **Error Handling**: Improved fallback when dictionary unavailable
|
|
528
|
+
- 📝 **Documentation**: Corrected examples
|
|
529
|
+
|
|
530
|
+
### v2.2.1 (2026-01-26)
|
|
531
|
+
- 🧹 **Sanitization**: Added `_stripHyphens` for automatic input cleaning
|
|
532
|
+
- ⚡ **Performance**: Converted `harmonicClusters` to `Set` (O(1) lookup)
|
|
533
|
+
- 📦 **ESM**: Full ES Modules support
|
|
534
|
+
- 📚 **Dictionary**: Added `loadDefaultLibrary()` method
|
|
535
|
+
|
|
536
|
+
### v2.0.1 (2026-01-22)
|
|
537
|
+
- 🎓 **Academic Rewrite**: Phonological distance analysis
|
|
538
|
+
- 🛡️ **Anti-Orphan**: Minimum 2 characters on each side
|
|
539
|
+
- 🎼 **Harmonic Clusters**: Georgian-specific consonant groups
|
|
685
540
|
|
|
686
541
|
---
|
|
687
542
|
|
|
688
|
-
##
|
|
543
|
+
## Contributing
|
|
689
544
|
|
|
690
|
-
|
|
691
|
-
* Inspired by TeX hyphenation algorithms (Liang, 1983)
|
|
692
|
-
* Thanks to the Georgian linguistic community
|
|
693
|
-
* Special thanks to early testers and contributors
|
|
545
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
694
546
|
|
|
695
|
-
|
|
547
|
+
## License
|
|
696
548
|
|
|
697
|
-
|
|
549
|
+
MIT © [Guram Zhgamadze](https://github.com/guramzhgamadze)
|
|
698
550
|
|
|
699
|
-
|
|
700
|
-
* TeX Hyphenation Algorithm (Liang, Franklin Mark. 1983)
|
|
701
|
-
* Hunspell Hyphenation Documentation
|
|
702
|
-
* Unicode Standard for Georgian Script (U+10A0–U+10FF)
|
|
703
|
-
* CLDR Language Data
|
|
551
|
+
## Author
|
|
704
552
|
|
|
705
|
-
|
|
553
|
+
**Guram Zhgamadze**
|
|
554
|
+
- GitHub: [@guramzhgamadze](https://github.com/guramzhgamadze)
|
|
555
|
+
- Email: guramzhgamadze@gmail.com
|
|
706
556
|
|
|
707
|
-
##
|
|
557
|
+
## Related
|
|
708
558
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
* 🦊 **Firefox:** https://addons.mozilla.org/firefox/addon/georgian-hyphenation/
|
|
712
|
-
* 🎨 **Demo:** https://guramzhgamadze.github.io/georgian-hyphenation/
|
|
713
|
-
* 📖 **Documentation:** [GitHub Wiki](https://github.com/guramzhgamadze/georgian-hyphenation/wiki)
|
|
559
|
+
- [Georgian Language Resources](https://www.omniglot.com/writing/georgian.htm)
|
|
560
|
+
- [Unicode Georgian Range](https://unicode.org/charts/PDF/U10A0.pdf)
|
|
714
561
|
|
|
715
562
|
---
|
|
716
563
|
|
|
717
|
-
Made with ❤️ for the Georgian language community
|
|
718
|
-
|
|
719
|
-
შექმნილია ❤️-ით ქართული ენის საზოგადოებისთვის
|
|
720
|
-
|
|
721
|
-
🇬🇪 **საქართველო** 🇬🇪
|
|
564
|
+
Made with ❤️ for the Georgian language community
|