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 CHANGED
@@ -1,721 +1,564 @@
1
- # Georgian Language Hyphenation / ქართული ენის დამარცვლა
1
+ # Georgian Language Hyphenation
2
2
 
3
- [![PyPI version](https://img.shields.io/pypi/v/georgian-hyphenation.svg)](https://pypi.org/project/georgian-hyphenation/)
4
3
  [![NPM version](https://img.shields.io/npm/v/georgian-hyphenation.svg)](https://www.npmjs.com/package/georgian-hyphenation)
5
- [![Python 3.7+](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
6
- [![JavaScript ES6+](https://img.shields.io/badge/javascript-ES6+-yellow.svg)](https://www.ecma-international.org/)
7
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
8
- [![Firefox Add-on](https://img.shields.io/amo/v/georgian-hyphenation?label=Firefox)](https://addons.mozilla.org/firefox/addon/georgian-hyphenation/)
5
+ [![JavaScript](https://img.shields.io/badge/javascript-ESM-yellow.svg)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
6
+ [![Downloads](https://img.shields.io/npm/dm/georgian-hyphenation.svg)](https://www.npmjs.com/package/georgian-hyphenation)
9
7
 
10
- **Version 2.2.4** (Library) / **2.2.4** (WordPress Plugin)
8
+ Georgian Language Hyphenation Library - Fast, accurate syllabification for Georgian (ქართული) text with support for both browser and Node.js environments.
11
9
 
12
- A comprehensive hyphenation library for the Georgian language, using advanced linguistic algorithms for accurate syllabification.
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
- ### Browser Extension
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
- ვინაიდან Add-in ჯერ დეველოპმენტის ფაზაშია, მის ჩასართავად გამოიყენეთ "Sideloading" მეთოდი:
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
- ## 📚 Documentation / დოკუმენტაცია
143
-
144
- ### Python API
145
- ```python
146
- from georgian_hyphenation import GeorgianHyphenator
33
+ ```javascript
34
+ import GeorgianHyphenator from 'georgian-hyphenation';
147
35
 
148
- # Initialize with soft hyphen (default: U+00AD)
149
- hyphenator = GeorgianHyphenator()
36
+ const hyphenator = new GeorgianHyphenator();
150
37
 
151
- # Hyphenate a word
152
- word = "საქართველო"
153
- result = hyphenator.hyphenate(word)
154
- print(result) # სა­ქარ­თვე­ლო (with U+00AD soft hyphens)
38
+ // Basic hyphenation
39
+ console.log(hyphenator.hyphenate('საქართველო'));
40
+ // Output: სა­ქარ­თვე­ლო
155
41
 
156
- # Get syllables as a list
157
- syllables = hyphenator.get_syllables(word)
158
- print(syllables) # ['სა', 'ქარ', 'თვე', 'ლო']
42
+ // Get syllables as array
43
+ console.log(hyphenator.getSyllables('თბილისი'));
44
+ // Output: ['თბი', 'ლი', 'სი']
159
45
 
160
- # Use visible hyphens for display
161
- visible = GeorgianHyphenator('-')
162
- print(visible.hyphenate(word)) # სა-ქარ-თვე-ლო
46
+ // Count syllables (NEW in v2.2.7)
47
+ console.log(hyphenator.countSyllables('გამარჯობა'));
48
+ // Output: 4
163
49
 
164
- # Hyphenate entire text (preserves punctuation)
165
- text = "საქართველო არის ლამაზი ქვეყანა."
166
- print(hyphenator.hyphenate_text(text))
167
- # Output: სა­ქარ­თვე­ლო არის ლა­მა­ზი ქვე­ყა­ნა.
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
- import GeorgianHyphenator from 'georgian-hyphenation';
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
- #### 1. `hyphenate(word)`
190
- ```javascript
191
- const result = hyphenator.hyphenate('საქართველო');
192
- console.log(result); // "სა-ქარ-თვე-ლო"
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
- #### 2. `hyphenateText(text)`
196
- ```javascript
197
- const longText = "გამარჯობა, საქართველო მშვენიერი ქვეყანაა!";
198
- console.log(hyphenator.hyphenateText(longText));
199
- ```
76
+ ## API Reference
200
77
 
201
- #### 3. `getSyllables(word)`
202
- ```javascript
203
- const syllables = hyphenator.getSyllables('უნივერსიტეტი');
204
- console.log(syllables); // ["უ", "ნი", "ვერ", "სი", "ტე", "ტი"]
205
- ```
78
+ ### Constructor
206
79
 
207
- #### 4. `loadDefaultLibrary()` (Async)
208
80
  ```javascript
209
- await hyphenator.loadDefaultLibrary();
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
- ## 🌐 Browser Usage (CDN / ESM)
216
- ```html
217
- <p class="hyphenated" id="content"></p>
89
+ ## Core Methods
218
90
 
219
- <script type="module">
220
- import GeorgianHyphenator from 'https://cdn.jsdelivr.net/npm/georgian-hyphenation@2.2.4/src/javascript/index.js';
91
+ ### `hyphenate(word)`
221
92
 
222
- async function initializeHyphenator() {
223
- const hyphenator = new GeorgianHyphenator('\u00AD');
224
- await hyphenator.loadDefaultLibrary();
93
+ Hyphenates a single word.
225
94
 
226
- const text = "საქართველო არის ძალიან ლამაზი ქვეყანა, სადაც ბევრი ისტორიული ძეგლია.";
227
-
228
- document.getElementById('content').textContent = hyphenator.hyphenateText(text);
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
- ### TeX Patterns
240
- ```python
241
- from georgian_hyphenation import to_tex_pattern
102
+ Returns an array of syllables.
242
103
 
243
- print(to_tex_pattern('საქართველო'))
244
- # Output: .სა1ქარ1თვე1ლო.
104
+ ```javascript
105
+ hyphenator.getSyllables('თბილისი');
106
+ // Returns: ['თბი', 'ლი', 'სი']
245
107
  ```
246
108
 
247
- Use in LaTeX:
248
- ```latex
249
- \documentclass{article}
250
- \usepackage{polyglossia}
251
- \setmainlanguage{georgian}
252
- \input{georgian-patterns.tex}
109
+ ### `hyphenateText(text)`
253
110
 
254
- \begin{document}
255
- საქართველო არის ძალიან ლამაზი ქვეყანა
256
- \end{document}
257
- ```
111
+ Hyphenates all words in a text string.
258
112
 
259
- ### Hunspell Dictionary
260
- ```python
261
- from georgian_hyphenation import to_hunspell_format
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
- ეს დამატება საშუალებას გაძლევთ გამოიყენოთ ქართული ენის დამარცვლის აკადემიური სტანდარტი პირდაპირ Microsoft Word-ში.
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
- ### 🌐 Browser Extension / ბრაუზერის გაფართოება
280
-
281
- **Current Version: v2.2.4**
282
-
283
- ### Features:
126
+ ```javascript
127
+ hyphenator.countSyllables('გამარჯობა');
128
+ // Returns: 4
129
+ ```
284
130
 
285
- * ✅ **v2.2.4 Update**: Critical CSS fix for visible soft hyphens
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
- ### Installation:
133
+ Get the number of hyphenation points (hyphens) in a word.
300
134
 
301
- **🦊 Firefox (Recommended):**
135
+ ```javascript
136
+ hyphenator.getHyphenationPoints('გამარჯობა');
137
+ // Returns: 3 (four syllables = three hyphens)
138
+ ```
302
139
 
303
- 1. Visit [Firefox Add-ons](https://addons.mozilla.org/firefox/addon/georgian-hyphenation/)
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
- **🌐 Chrome (Manual Install):**
142
+ Check if text contains only Georgian characters.
309
143
 
310
- 1. Download [`georgian-hyphenation-chrome-v2.2.4.zip`](https://github.com/guramzhgamadze/georgian-hyphenation/releases)
311
- 2. Extract ZIP file
312
- 3. Open Chrome → `chrome://extensions/`
313
- 4. Enable "Developer mode" (top-right toggle)
314
- 5. Click "Load unpacked" → Select extracted folder
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
- ### What's New in v2.2.4:
150
+ ### `canHyphenate(word)`
318
151
 
319
- **🎨 Critical CSS Fix:**
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
- **🎯 Balanced Skip Logic:**
326
- - Skips: `<nav>`, `<header>`, `<footer>`, `<h1-h6>`, `<button>`, large fonts (>20px)
327
- - Processes: Paragraph text, article content, descriptions
328
- - 5-level ancestor check (optimized from 15 levels)
329
- - Removed overly restrictive content container detection
154
+ ```javascript
155
+ hyphenator.canHyphenate('გა'); // false (too short)
156
+ hyphenator.canHyphenate('გამარ'); // true
157
+ ```
330
158
 
331
- **⚡ Performance:**
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
- **🧹 Other Improvements:**
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
- ### Browser Compatibility:
163
+ ```javascript
164
+ const hyphenated = hyphenator.hyphenate('გამარჯობა');
165
+ hyphenator.unhyphenate(hyphenated);
166
+ // Returns: 'გამარჯობა'
167
+ ```
344
168
 
345
- * ✅ **Firefox** 109+ (Manifest v2)
346
- * ✅ **Chrome** 88+ (Manifest v3)
169
+ ### `hyphenateWords(words)`
347
170
 
348
- ### Usage:
171
+ Hyphenate multiple words at once (batch processing).
349
172
 
350
- **After Installation:**
351
- 1. Visit any Georgian website (e.g., formulanews.ge, interpressnews.ge)
352
- 2. Extension auto-processes text content
353
- 3. Click extension icon to:
354
- - Toggle hyphenation on/off
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
- **Debug Mode:**
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
- ### Troubleshooting:
181
+ Hyphenate HTML content while preserving tags and skipping code blocks.
364
182
 
365
- **Problem: Soft hyphens visible as dashes**
366
- - Solution: v2.2.4 fixes this! Update to latest version.
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
- **Problem: Not hyphenating on some sites**
369
- - Check Console (F12) for "Skipping blacklisted site" message
370
- - Blacklisted: claude.ai, chat.openai.com, gemini.google.com
198
+ ---
371
199
 
372
- **Problem: Extension not loading**
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
- ## 🔌 WordPress Plugin
204
+ ### `setLeftMin(value)`
380
205
 
381
- **Current Version: v2.2.4**
206
+ Set minimum characters before the first hyphen (default: 2).
382
207
 
383
- ### Features:
208
+ ```javascript
209
+ hyphenator.setLeftMin(3);
210
+ // Now requires at least 3 characters before first hyphen
211
+ ```
384
212
 
385
- * ✅ **v2.2.4 Update**: Browser-compatible ESM module loading with type="module"
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
- ### Installation:
215
+ Set minimum characters after the last hyphen (default: 2).
399
216
 
400
- **From WordPress.org:** *(Coming soon)*
217
+ ```javascript
218
+ hyphenator.setRightMin(3);
219
+ // Now requires at least 3 characters after last hyphen
220
+ ```
401
221
 
402
- **Manual Installation:**
222
+ ### `setHyphenChar(char)`
403
223
 
404
- 1. Download **`georgian-hyphenation-wp-2.2.4.zip`**
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
- ### Configuration:
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
- **Admin Menu → Geo Hyphenation**
238
+ ### Method Chaining
413
239
 
414
- 1. **Enable Hyphenation** - Main on/off toggle
415
- 2. **Dictionary Support** (NEW) - Load 150+ exception words from CDN
416
- 3. **Elementor Widgets** - Individual controls:
417
- * Text Editor Widget (`.elementor-text-editor`, `.elementor-widget-container p`)
418
- * Heading Widget (`.elementor-heading-title`)
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
- 4. **Additional CSS Selectors** - Add custom selectors:
424
- ```
425
- article p, .entry-content p, .my-custom-class
246
+ console.log(hyphenator.hyphenate('გამარჯობა'));
426
247
  ```
427
248
 
428
- 5. **Auto Justify Text** - Apply `text-align: justify` for better effect
429
-
430
- ### Requirements:
249
+ ---
431
250
 
432
- * WordPress 5.0+
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
- ### Compatibility:
253
+ ### `loadLibrary(data)`
438
254
 
439
- * Elementor Free & Pro
440
- * ✅ All WordPress themes
441
- * ✅ Page builders (Elementor, Gutenberg)
442
- * ✅ Classic Editor
443
- * ✅ WooCommerce
444
- * ✅ Multisite
255
+ Load custom exception dictionary.
445
256
 
446
- ### Debugging:
257
+ ```javascript
258
+ const customWords = {
259
+ 'განათლება': 'გა-ნათ-ლე-ბა',
260
+ 'უნივერსიტეტი': 'უ-ნი-ვერ-სი-ტე-ტი'
261
+ };
447
262
 
448
- Open browser console (F12) to see detailed logs:
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
- ### What's New in v2.2.4:
266
+ ### `async loadDefaultLibrary()`
457
267
 
458
- * 🌐 **ESM Module Loading**: Fixed browser compatibility with proper `type="module"` injection
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
- ## 📝 Changelog
465
-
466
- ### Version 2.2.4 (Browser Extensions) (2026-01-29) CSS Fix & Optimization 🎨
270
+ ```javascript
271
+ await hyphenator.loadDefaultLibrary();
272
+ // Dictionary loaded with tech terms, places, political terms
273
+ ```
467
274
 
468
- **🎨 Critical CSS Fix:**
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
- **🎯 Balanced Skip Logic:**
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
- **⚡ Performance:**
480
- * Embedded NPM v2.2.4 library code
481
- * O(1) harmonic cluster lookup
482
- * Efficient DOM traversal
483
- * Throttled processing
279
+ ```javascript
280
+ hyphenator.addException('ტესტი', 'ტეს-ტი');
484
281
 
485
- **Chrome Extension v2.2.4:**
486
- * Manifest v3 compliance
487
- * Service worker background script
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
- **Firefox Extension v2.2.4:**
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
- ### Version 2.2.4 (WordPress Plugin) (2026-01-27)
290
+ ```javascript
291
+ hyphenator.removeException('ტესტი');
292
+ // Returns: true (if word was removed)
293
+ ```
500
294
 
501
- * 🌐 **ESM Module Loading**: Fixed browser compatibility with proper `type="module"` injection
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
- ### Version 2.2.2 (Library) (2026-01-27) — Documentation Update 📝
299
+ ```javascript
300
+ const dict = hyphenator.exportDictionary();
301
+ console.log(dict);
302
+ // { "გამარჯობა": "გა-მარ-ჯო-ბა", ... }
303
+ ```
509
304
 
510
- * 📝 **README Corrections**: გამოსწორდა არასწორი მაგალითები (მაგ: "კლასსი" → წაშლილია).
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
- ### Version 2.2.1 (Library) (2026-01-26) — The Modernization Update 🚀
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
- ## 🎨 Live Demo
317
+ ## New in v2.2.7: Advanced Features
526
318
 
527
- **Interactive Demo:** https://guramzhgamadze.github.io/georgian-hyphenation/
319
+ ### Harmonic Cluster Management
528
320
 
529
- Try it yourself:
321
+ For advanced users who need to customize consonant cluster recognition:
530
322
 
531
- * Test with your own Georgian text
532
- * See before/after comparison
533
- * Adjust browser width to see automatic line breaking
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
- ## 📊 Examples / მაგალითები
327
+ // Remove a cluster
328
+ hyphenator.removeHarmonicCluster('ტვ');
540
329
 
541
- | Word (სიტყვა) | Syllables (მარცვლები) | Hyphenated | TeX Pattern |
542
- | --- | --- | --- | --- |
543
- | საქართველო | სა, ქარ, თვე, ლო | სა-ქარ-თვე-ლო | .სა1ქარ1თვე1ლო. |
544
- | მთავრობა | მთავ, რო, ბა | მთავ-რო-ბა | .მთავ1რო1ბა. |
545
- | დედაქალაქი | დე, და, ქა, ლა, ქი | დე-და-ქა-ლა-ქი | .დე1და1ქა1ლა1ქი. |
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
- ## 🧪 Testing / ტესტირება
554
- ```bash
555
- # Python tests
556
- python test_python.py
338
+ ## CSS Integration
557
339
 
558
- # JavaScript tests
559
- node test_javascript.js
560
- ```
340
+ Use soft hyphens for automatic line breaking:
561
341
 
562
- **Test Coverage:**
342
+ ```css
343
+ .georgian-text {
344
+ hyphens: auto;
345
+ -webkit-hyphens: auto;
346
+ -ms-hyphens: auto;
347
+ }
348
+ ```
563
349
 
564
- * ✅ 10,000+ Georgian words validated
565
- * Edge cases (V-V, consonant clusters, short words)
566
- * Unicode handling
567
- * Punctuation preservation
568
- * ✅ Performance benchmarks
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
- ## 🤝 Contributing / წვლილის შეტანა
358
+ ## Built-in Dictionary
573
359
 
574
- Contributions are welcome! Please feel free to submit a Pull Request.
360
+ The library includes 148 pre-hyphenated words including:
575
361
 
576
- მოხარული ვიქნებით თქვენი წვლილით! გთხოვთ გამოგზავნოთ Pull Request.
362
+ **Tech Terms:** კომპიუტერი, ფეისბუქი, იუთუბი, ინსტაგრამი
363
+ **Places:** საქართველო, თბილისი
364
+ **Political:** პარლამენტი, დემოკრატია, რესპუბლიკა
365
+ **Compound Words:** სახელმწიფო, გულმავიწყი, თავდადებული
577
366
 
578
- 1. Fork the repository
579
- 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
580
- 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
581
- 4. Push to the branch (`git push origin feature/AmazingFeature`)
582
- 5. Open a Pull Request
367
+ ```javascript
368
+ await hyphenator.loadDefaultLibrary();
369
+ console.log(hyphenator.hyphenate('კომპიუტერი'));
370
+ // Uses dictionary: 'კომ­პიუ­ტე­რი'
371
+ ```
583
372
 
584
373
  ---
585
374
 
586
- ## 📝 Changelog
375
+ ## Algorithm
587
376
 
588
- ### Version 2.2.4 (WordPress Plugin) (2026-01-27)
377
+ The library uses a phonetic algorithm based on Georgian syllable structure:
589
378
 
590
- * 🌐 **ESM Module Loading**: Fixed browser compatibility with proper `type="module"` injection
591
- * 📚 **Dictionary Support**: Optional CDN loading of 150+ exception words
592
- * 🧹 **Auto Sanitization**: Built-in cleaning of old hyphens before processing
593
- * **Performance**: O(1) harmonic cluster lookup with Set structure
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
- * 📝 **README Corrections**: გამოსწორდა არასწორი მაგალითები (მაგ: "კლასსი" → წაშლილია, რადგან არ არსებობს ქართულში).
600
- * 📚 **Python README**: განახლდა Python package-ის README სრული დოკუმენტაციით და გასწორებული მაგალითებით.
601
- * **PyPI v2.2.2**: ხელახლა გამოქვეყნდა PyPI-ზე გასწორებული დოკუმენტაციით.
387
+ ```
388
+ ბლ, ბრ, ბღ, ბზ, გდ, გლ, გმ, გნ, გვ, გზ, გრ, დრ, თლ, თრ, თღ,
389
+ კლ, კმ, კნ, კრ, კვ, მტ, პლ, პრ, ჟღ, რგ, რლ, რმ, სწ, სხ, ტკ,
390
+ ტპ, ტრ, ფლ, ფრ, ფქ, ფშ, ქლ, ქნ, ქვ, ქრ, ღლ, ღრ, ყლ, ყრ, შთ,
391
+ შპ, ჩქ, ჩრ, ცლ, ცნ, ცრ, ცვ, ძგ, ძვ, ძღ, წლ, წრ, წნ, წკ, ჭკ,
392
+ ჭრ, ჭყ, ხლ, ხმ, ხნ, ხვ, ჯგ
393
+ ```
602
394
 
603
395
  ---
604
396
 
605
- ### Version 2.2.1 (Library) (2026-01-26) — The Modernization Update 🚀
397
+ ## Use Cases & Examples
606
398
 
607
- * 🧹 **Automatic Sanitization**: დაემატა `_stripHyphens` ფუნქციონალი, რომელიც ავტომატურად ასუფთავებს ტექსტს ძველი დამარცვლის სიმბოლოებისგან.
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
- ### Version 2.0.8 (WordPress Plugin) (2026-01-23)
405
+ function formatBook(htmlContent) {
406
+ return hyphenator.hyphenateHTML(htmlContent);
407
+ }
616
408
 
617
- * 🔌 **WP UI/UX Update**:
618
- * პარამეტრები გადავიდა მთავარ მენიუში (Top-Level Menu) შესაბამისი აიკონით.
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
- ### Version 2.0.1 (2026-01-22)
414
+ ```javascript
415
+ const hyphenator = new GeorgianHyphenator('\u00AD');
626
416
 
627
- * 📦 **NPM Deployment**: ბიბლიოთეკა ოფიციალურად გამოქვეყნდა NPM-ზე ცალკეული `README-NPM.md` დოკუმენტაციით.
628
- * 📝 **Docs**: გაუმჯობესდა საინსტალაციო და გამოყენების ინსტრუქციები.
629
- * 🐛 **Bug Fixes**: გამოსწორდა მცირე ხარვეზები სიმბოლოების დამუშავებისას.
417
+ const justified = hyphenator.hyphenateText(
418
+ 'საქართველო არის ერთ-ერთი უძველესი ქვეყანა მსოფლიოში'
419
+ );
420
+ ```
630
421
 
631
- ---
422
+ ### Blog/CMS Integration
632
423
 
633
- ### Version 2.0.0 (2026-01-21) — Academic Logic v2.0 🎉
424
+ ```javascript
425
+ const hyphenator = new GeorgianHyphenator();
426
+ await hyphenator.loadDefaultLibrary();
634
427
 
635
- * **Major Algorithm Rewrite**: დაინერგა აკადემიური ფონოლოგიური დისტანციის ანალიზი.
636
- * 🛡️ **Anti-Orphan Protection**: მინიმუმ 2 სიმბოლოს შენარჩუნება მარცვლის ორივე მხარეს.
637
- * 🎼 **'R' Rule**: სპეციალური ლოგიკა 'რ' თანხმოვნის შემცველი ჯგუფებისთვის.
638
- * 🔄 **Hiatus Detection**: ხმოვანთშერწყმის (V-V) სწორი დამარცვლა.
639
- * 📈 **Accuracy**: სიზუსტე გაიზარდა **98%+**-მდე (ვალიდირებულია 10,000+ სიტყვაზე).
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
- ## 🗺️ Roadmap / სამომავლო გეგმები
436
+ ```javascript
437
+ const hyphenator = new GeorgianHyphenator();
645
438
 
646
- ### Short-term (2026 Q1)
439
+ function validateGeorgianInput(text) {
440
+ if (!hyphenator.isGeorgian(text)) {
441
+ alert('გთხოვთ შეიყვანოთ მხოლოდ ქართული ტექსტი');
442
+ return false;
443
+ }
444
+ return true;
445
+ }
446
+ ```
647
447
 
648
- * ✅ v2.0 Academic Logic - **DONE**
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
- ### Mid-term (2026 Q3-Q4)
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
- * 📄 Submit to TeX Live hyphenation database
659
- * 📚 Academic paper publication
660
- * 🎨 Adobe InDesign plugin
661
- * 📊 Microsoft Word add-in
462
+ ---
662
463
 
663
- ### Long-term (2027+)
464
+ ## Browser Support
664
465
 
665
- * 🌍 Unicode CLDR proposal
666
- * 🏛️ Official endorsement (Georgian Language Institute)
667
- * 🤖 Integration into major OS (Windows, macOS, iOS, Android)
668
- * 🌐 Browser native support proposal
466
+ - Chrome/Edge 90+
467
+ - Firefox 88+
468
+ - Safari 14+
469
+ - Node.js 14+
669
470
 
670
471
  ---
671
472
 
672
- ## 📄 License / ლიცენზია
473
+ ## Performance
673
474
 
674
- This project is licensed under the MIT License - see the LICENSE file for details.
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
- ## 📧 Contact / კონტაქტი
679
-
680
- **Guram Zhgamadze**
681
-
682
- * 🐙 GitHub: [@guramzhgamadze](https://github.com/guramzhgamadze)
683
- * 📧 Email: guramzhgamadze@gmail.com
684
- * 🐛 Issues: [Report bugs or request features](https://github.com/guramzhgamadze/georgian-hyphenation/issues)
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
- ## 🙏 Acknowledgments / მადლობა
543
+ ## Contributing
689
544
 
690
- * Based on Georgian phonological research
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
- ## 📚 References / ლიტერატურა
549
+ MIT © [Guram Zhgamadze](https://github.com/guramzhgamadze)
698
550
 
699
- * Georgian Language Phonology and Syllable Structure
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
- ## 🔗 Links / ლინკები
557
+ ## Related
708
558
 
709
- * 🐍 **PyPI:** https://pypi.org/project/georgian-hyphenation/
710
- * 📦 **NPM:** https://www.npmjs.com/package/georgian-hyphenation
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