Skip to main content

Georgian Language Hyphenation Library v2.0 - Academic Logic

Project description

Georgian Language Hyphenation / ქართული ენის დამარცვლა

License: MIT Python 3.7+ JavaScript GitHub stars PyPI version npm version Downloads

A comprehensive hyphenation library for the Georgian language, supporting multiple output formats including TeX, Hunspell, and web standards.

ქართული ენის სრული დამარცვლის ბიბლიოთეკა, რომელიც მხარს უჭერს მრავალ ფორმატს: TeX, Hunspell და ვებ სტანდარტები.

Features / ფუნქციები

  • Accurate syllabification based on Georgian phonological rules
  • Multiple output formats: Soft hyphens (U+00AD), TeX patterns, Hunspell dictionary
  • Python and JavaScript implementations for maximum compatibility
  • Web-ready with HTML/CSS/JS demo
  • Export capabilities: JSON, CSV, TeX, Hunspell
  • Well-tested with comprehensive Georgian word corpus

Installation / ინსტალაცია

Python

# Install from PyPI
pip install georgian-hyphenation

# Or install from source
git clone https://github.com/guramzhgamadze/georgian-hyphenation.git
cd georgian-hyphenation
pip install -e .

JavaScript

npm install georgian-hyphenation

Browser Extension / ბრაუზერის გაფართოება

Firefox 🦊

Firefox Add-ons

Install from Firefox Add-ons

Chrome/Edge 🌐

Chrome Web Store (Coming soon)

Or install manually:

  1. Download latest release
  2. Extract browser-extension-chrome.zip
  3. Chrome → chrome://extensions/
  4. Enable "Developer mode"
  5. Click "Load unpacked"
  6. Select browser-extension-chrome folder

Features

  • ✅ Automatic hyphenation on all Georgian websites
  • ✅ Toggle on/off per site
  • ✅ Real-time statistics

Usage / გამოყენება

Python

from georgian_hyphenation import GeorgianHyphenator

# Initialize with soft hyphen (default)
hyphenator = GeorgianHyphenator()

# Hyphenate a word
word = "საქართველო"
result = hyphenator.hyphenate(word)
print(result)  # სა­ქარ­თვე­ლო (with U+00AD soft hyphens)

# Get syllables as a list
syllables = hyphenator.getSyllables(word)
print(syllables)  # ['სა', 'ქარ', 'თვე', 'ლო']

# Use visible hyphens for display
visible = GeorgianHyphenator('-')
print(visible.hyphenate(word))  # სა-ქარ-თვე-ლო

# Hyphenate entire text (if you add this method)
text = "საქართველო არის ლამაზი ქვეყანა"
words = text.split()
hyphenated = ' '.join([hyphenator.hyphenate(w) for w in words])
print(hyphenated)

JavaScript

// Initialize hyphenator
const hyphenator = new GeorgianHyphenator();

// Hyphenate a word
const word = "საქართველო";
const result = hyphenator.hyphenate(word);
console.log(result);  // სა­ქარ­თვე­ლო (with U+00AD)

// Get syllables
const syllables = hyphenator.getSyllables(word);
console.log(syllables);  // ['სა', 'ქარ', 'თვე', 'ლო']

// Use visible hyphens
const visible = new GeorgianHyphenator('-');
console.log(visible.hyphenate(word));  // სა-ქარ-თვე-ლო

// Hyphenate text
const text = "საქართველო არის ლამაზი ქვეყანა";
console.log(hyphenator.hyphenateText(text));

HTML/CSS Integration

<!DOCTYPE html>
<html lang="ka">
<head>
    <style>
        .hyphenated {
            hyphens: manual;
            text-align: justify;
        }
    </style>
</head>
<body>
    <p class="hyphenated" id="text"></p>
    
    <script src="georgian-hyphenation.js"></script>
    <script>
        const hyphenator = new GeorgianHyphenator('\u00AD');
        const text = "საქართველო არის ძალიან ლამაზი ქვეყანა";
        document.getElementById('text').textContent = 
            hyphenator.hyphenateText(text);
    </script>
</body>
</html>

Export Formats / ექსპორტის ფორმატები

TeX Patterns

from georgian_hyphenation import TeXPatternGenerator

hyphenator = GeorgianHyphenator()
tex_gen = TeXPatternGenerator(hyphenator)

words = ["საქართველო", "მთავრობა", "დედაქალაქი"]
tex_gen.generate_patterns_file(words, "hyph-ka.tex")

Output (hyph-ka.tex):

% Georgian hyphenation patterns
\patterns{
  .სა1ქარ1თვე1ლო
  .მთავ1რო1ბა
  .დე1და1ქა1ლა1ქი
}

Hunspell Dictionary

from georgian_hyphenation import HunspellDictionaryGenerator

hunspell_gen = HunspellDictionaryGenerator(hyphenator)
words = ["საქართველო", "მთავრობა"]
hunspell_gen.generate_dictionary(words, "hyph_ka_GE")

Output (hyph_ka_GE.dic):

UTF-8
2
სა=ქარ=თვე=ლო
მთავ=რო=ბა

JSON Export

from georgian_hyphenation import HyphenationExporter

exporter = HyphenationExporter(hyphenator)
words = ["საქართველო", "მთავრობა"]
exporter.export_json(words, "georgian_hyphenation.json")

Output:

{
  "საქართველო": {
    "syllables": ["სა", "ქარ", "თვე", "ლო"],
    "hyphenated": "სა­ქარ­თვე­ლო"
  },
  "მთავრობა": {
    "syllables": ["მთავ", "რო", "ბა"],
    "hyphenated": "მთავ­რო­ბა"
  }
}

Hyphenation Rules / დამარცვლის წესები

The library implements Georgian syllabification rules based on phonological patterns:

ბიბლიოთეკა იყენებს ქართული ფონოლოგიის წესებზე დაფუძნებულ მარცვლების გამოყოფას:

  1. V+C+C+V → VC|CV (ხმოვანი + თანხმოვანი + თანხმოვნები + ხმოვანი)
  2. V+C+V+C+V → VCV|CV
  3. C+V+C+V → CV|CV
  4. V+V+V → VV|V (სამი ხმოვანი ზედიზედ)
  5. Special rules for word boundaries (სიტყვის საზღვრების სპეციალური წესები)

Where:

  • V = vowel (ხმოვანი): ა, ე, ი, ო, უ
  • C = consonant (თანხმოვანი): ბ, გ, დ, ვ, ზ, თ, კ, ლ, მ, ნ, პ, ჟ, რ, ს, ტ, ფ, ქ, ღ, ყ, შ, ჩ, ც, ძ, წ, ჭ, ხ, ჯ, ჰ

Examples / მაგალითები

Word (სიტყვა) Syllables (მარცვლები) Pattern
საქართველო სა-ქარ-თვე-ლო .სა1ქარ1თვე1ლო
მთავრობა მთავ-რო-ბა .მთავ1რო1ბა
დედაქალაქი დე-და-ქა-ლა-ქი .დე1და1ქა1ლა1ქი
ტელევიზორი ტე-ლე-ვი-ზო-რი .ტე1ლე1ვი1ზო1რი
კომპიუტერი კომ-პი-უ-ტე-რი .კომ1პი1უ1ტე1რი
უნივერსიტეტი უ-ნი-ვერ-სი-ტე-ტი .უ1ნი1ვერ1სი1ტე1ტი

Testing / ტესტირება

Run Tests

python -m pytest tests/    # Python tests
npm test                    # JavaScript tests

Try the Demo

🌐 Online: https://guramzhgamadze.github.io/georgian-hyphenation/

💻 Local: Open examples/demo.html in your browser

🐍 Python:

from georgian_hyphenation import GeorgianHyphenator
print(GeorgianHyphenator('-').hyphenate("საქართველო"))

📦 Node.js:

const { GeorgianHyphenator } = require('georgian-hyphenation');
console.log(new GeorgianHyphenator('-').hyphenate("საქართველო"));

Contributing / წვლილის შეტანა

Contributions are welcome! Please feel free to submit a Pull Request.

მოხარული ვიქნებით თქვენი წვლილით! გთხოვთ გამოგზავნოთ Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Integration with Popular Tools / ინტეგრაცია პოპულარულ ხელსაწყოებთან

LibreOffice / OpenOffice

  1. Generate Hunspell dictionary files
  2. Copy to extensions directory:
    • Linux: ~/.config/libreoffice/4/user/uno_packages/cache/
    • Windows: %APPDATA%\LibreOffice\4\user\uno_packages\cache\
    • macOS: ~/Library/Application Support/LibreOffice/4/user/uno_packages/cache/

LaTeX / XeLaTeX

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{georgian}
\usepackage{hyphenat}

% Include generated patterns
\input{hyph-ka.tex}

\begin{document}
საქართველო არის ძალიან ლამაზი ქვეყანა
\end{document}

Web Browsers (CSS)

html {
    lang: ka;
}

p {
    hyphens: manual;  /* Use with soft hyphens */
    /* or */
    hyphens: auto;    /* If browser supports Georgian */
    text-align: justify;
}

Roadmap / სამომავლო გეგმები

  • PyPI package release ✅
  • NPM package release ✅
  • Browser extension (Chrome, Firefox)
  • InDesign plugin
  • MS Word add-in
  • Submit to TeX Live hyphenation database
  • Submit to Unicode CLDR
  • Mobile apps (iOS, Android)
  • API service

License / ლიცენზია

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments / მადლობა

  • Based on Georgian phonological research
  • Inspired by TeX hyphenation patterns
  • Thanks to the Georgian linguistic community

Contact / კონტაქტი

References / ლიტერატურა

  • Georgian Language Phonology and Syllable Structure
  • TeX Hyphenation Algorithm (Liang, 1983)
  • Hunspell Hyphenation Documentation
  • Unicode Standard for Georgian Script

Made with ❤️ for the Georgian language community

შექმნილია ❤️-ით ქართული ენის საზოგადოებისთვის

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

georgian_hyphenation-2.0.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

georgian_hyphenation-2.0.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file georgian_hyphenation-2.0.0.tar.gz.

File metadata

  • Download URL: georgian_hyphenation-2.0.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for georgian_hyphenation-2.0.0.tar.gz
Algorithm Hash digest
SHA256 dcdacac16adc35c0862871be9cf6a562633f37090bf3ca81bf3973f812a682b8
MD5 3cf6fc976f7587f8ef4bb94caca3b9c2
BLAKE2b-256 7a2a248339a93679fb7851a70a8dccd88219d08ea653de08f780ac2dcc2bd570

See more details on using hashes here.

File details

Details for the file georgian_hyphenation-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for georgian_hyphenation-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5333a24a76fa0b3188b52186861d97e9aa148d3a362cae6f76880ff8be51fb2
MD5 1d2e3413cc132c844f27bf0e44ad6f79
BLAKE2b-256 8ec1512a95f2e276566fa267bb01a9b25271b788cc967ae738a47650b37dae58

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page