Skip to main content

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

Project description

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

License: MIT Python 3.7+ JavaScript GitHub stars

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  # Coming soon to NPM
# For now, use directly from source

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

# 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.1.tar.gz (15.4 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.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: georgian_hyphenation-1.0.1.tar.gz
  • Upload date:
  • Size: 15.4 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.1.tar.gz
Algorithm Hash digest
SHA256 e4dd4f85b9dc5393c529dac74c3acb122d3afd768916662d4aa84143dc87b47a
MD5 660aa5b787bb963fe559b63bd0390f63
BLAKE2b-256 bfe4713271f52e97cc1ed0e287c1ed7ea32cb878bc5ba41d998d5aa264418733

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for georgian_hyphenation-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2711e5b7304ca8479cdd91c38e762f6493e3250b52ce1e5d3e9c3e6a27da6e43
MD5 0131886b2a957753b30c45b945067146
BLAKE2b-256 c6c44af45a80c3736394408d87bad71cc44249ac2897f0a166c166b1050e8f13

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