Skip to main content

Georgian Language Hyphenation Library - ქართული ენის დამარცვლის ბიბლიოთეკა

Project description

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

License: MIT Python 3.7+ JavaScript

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

pip install georgian-hyphenation  # Coming soon
# Or clone this repository
git clone https://github.com/guramzhgamadze/georgian-hyphenation.git
cd georgian-hyphenation
python setup.py install

JavaScript

npm install georgian-hyphenation  # Coming soon
# Or include directly in HTML
<script src="georgian-hyphenation.js"></script>

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

Python

from georgian_hyphenation import GeorgianHyphenator

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

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

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

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

# Hyphenate entire text
text = "საქართველო არის ლამაზი ქვეყანა"
print(hyphenator.hyphenate_text(text))

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 / ტესტირება

# Python tests
python -m pytest tests/

# JavaScript tests
npm test

# Run demo
python georgian_hyphenation.py
# or open demo.html in browser

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-1.0.0.tar.gz (15.2 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-1.0.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for georgian_hyphenation-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0dadb7ee789a6257f8088ff0b16c093c376944380ce5e8aa6f2a082d46804d4e
MD5 313dbb95712886f635cff4a2beb1775a
BLAKE2b-256 b707783013f2f5e7b0bc402219c415f109a2949c1b698b313a04d9cb4c0ab8cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for georgian_hyphenation-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbf3f4e03438e19efee29ef6dd1664239e1eaf88e5aea4b16ee2066306e11c47
MD5 ae4951f80001bf50c1c5556a261f1187
BLAKE2b-256 d89b95737c963ba906826b97c703cb29f06bb8e22ed8c00cc87f03fc7a096075

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