Skip to main content

Georgian Language Hyphenation Library v2.2.1 - Modernized & Optimized with Dictionary Support

Project description

๐Ÿ‡ฌ๐Ÿ‡ช Georgian Hyphenation - Python Library

PyPI version Python versions License: MIT

Georgian Language Hyphenation Library v2.2.1 - แƒฅแƒแƒ แƒ—แƒฃแƒšแƒ˜ แƒ”แƒœแƒ˜แƒก แƒ“แƒแƒ›แƒแƒ แƒชแƒ•แƒšแƒ˜แƒก แƒ‘แƒ˜แƒ‘แƒšแƒ˜แƒแƒ—แƒ”แƒ™แƒ

Automatic hyphenation (syllabification) for Georgian text with hybrid engine: Algorithm + Dictionary.


โœจ Features

v2.2.1 (Latest)

  • ๐ŸŽฏ Hybrid Engine: Algorithm + Dictionary (150+ exception words)
  • โšก Optimized Performance: Set-based harmonic cluster lookup (O(1))
  • ๐Ÿ”„ Strip & Re-hyphenate: Corrects old incorrect hyphenation
  • ๐ŸŽต Harmonic Clusters: Preserves natural Georgian sound clusters (แƒ‘แƒš, แƒ’แƒš, แƒ™แƒ , etc.)
  • ๐Ÿ’Ž Gemination Handling: Splits double consonants correctly (rare in Georgian)
  • ๐Ÿ›ก๏ธ Anti-Orphan Protection: Minimum 2 characters on each side
  • ๐Ÿ Pure Python: No external dependencies
  • ๐ŸŒ Unicode Support: Full Georgian script support

Core Algorithm

  • Phonological distance analysis
  • Vowel-based syllable detection
  • Contextual consonant cluster handling
  • Punctuation preservation

๐Ÿ“ฆ Installation

pip install georgian-hyphenation

Requirements

  • Python 3.7+
  • No external dependencies (uses only standard library)

๐Ÿš€ Quick Start

Basic Usage

from georgian_hyphenation import GeorgianHyphenator

# Initialize with visible hyphen
hyphenator = GeorgianHyphenator('-')

# Hyphenate single word
print(hyphenator.hyphenate('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ'))
# Output: แƒกแƒ-แƒฅแƒแƒ -แƒ—แƒ•แƒ”-แƒšแƒ

# Hyphenate text
text = 'แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ แƒแƒ แƒ˜แƒก แƒšแƒแƒ›แƒแƒ–แƒ˜ แƒฅแƒ•แƒ”แƒงแƒแƒœแƒ'
print(hyphenator.hyphenate_text(text))
# Output: แƒกแƒ-แƒฅแƒแƒ -แƒ—แƒ•แƒ”-แƒšแƒ แƒแƒ แƒ˜แƒก แƒšแƒ-แƒ›แƒ-แƒ–แƒ˜ แƒฅแƒ•แƒ”-แƒงแƒ-แƒœแƒ

# Get syllables as list
syllables = hyphenator.get_syllables('แƒ“แƒ”แƒ“แƒแƒฅแƒแƒšแƒแƒฅแƒ˜')
print(syllables)
# Output: ['แƒ“แƒ”', 'แƒ“แƒ', 'แƒฅแƒ', 'แƒšแƒ', 'แƒฅแƒ˜']

Using Dictionary (Recommended)

from georgian_hyphenation import GeorgianHyphenator

hyphenator = GeorgianHyphenator('-')

# Load default dictionary (150+ exception words)
hyphenator.load_default_library()

# Now hyphenation will use dictionary first, then algorithm
print(hyphenator.hyphenate('แƒ™แƒแƒ›แƒžแƒ˜แƒฃแƒขแƒ”แƒ แƒ˜'))
# Output: แƒ™แƒแƒ›-แƒžแƒ˜แƒฃ-แƒขแƒ”-แƒ แƒ˜ (from dictionary)

Convenience Functions

from georgian_hyphenation import hyphenate, get_syllables, hyphenate_text

# Quick hyphenation with default settings
print(hyphenate('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ'))
# Output: แƒกแƒยญแƒฅแƒแƒ ยญแƒ—แƒ•แƒ”ยญแƒšแƒ (with soft hyphens U+00AD)

# Get syllables
print(get_syllables('แƒ›แƒ—แƒแƒ•แƒ แƒแƒ‘แƒ'))
# Output: ['แƒ›แƒ—แƒแƒ•', 'แƒ แƒ', 'แƒ‘แƒ']

# Hyphenate entire text
text = 'แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ แƒแƒ แƒ˜แƒก แƒšแƒแƒ›แƒแƒ–แƒ˜ แƒฅแƒ•แƒ”แƒงแƒแƒœแƒ'
print(hyphenate_text(text))

๐ŸŽจ Hyphen Character Options

Soft Hyphen (Invisible, default)

# Soft hyphen (U+00AD) - invisible, only appears at line breaks
hyphenator = GeorgianHyphenator('\u00AD')
print(hyphenator.hyphenate('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ'))
# Output: แƒกแƒยญแƒฅแƒแƒ ยญแƒ—แƒ•แƒ”ยญแƒšแƒ (hyphens invisible until line wraps)

Visible Hyphen

# Regular hyphen - always visible
hyphenator = GeorgianHyphenator('-')
print(hyphenator.hyphenate('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ'))
# Output: แƒกแƒ-แƒฅแƒแƒ -แƒ—แƒ•แƒ”-แƒšแƒ

Middle Dot

# Middle dot - useful for visualization
hyphenator = GeorgianHyphenator('ยท')
print(hyphenator.hyphenate('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ'))
# Output: แƒกแƒยทแƒฅแƒแƒ ยทแƒ—แƒ•แƒ”ยทแƒšแƒ

Custom Character

# Any character you want
hyphenator = GeorgianHyphenator('|')
print(hyphenator.hyphenate('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ'))
# Output: แƒกแƒ|แƒฅแƒแƒ |แƒ—แƒ•แƒ”|แƒšแƒ

๐Ÿ“š Advanced Usage

Custom Dictionary

from georgian_hyphenation import GeorgianHyphenator

hyphenator = GeorgianHyphenator('-')

# Add your own exception words
custom_dict = {
    'แƒ™แƒแƒ›แƒžแƒ˜แƒฃแƒขแƒ”แƒ แƒ˜': 'แƒ™แƒแƒ›-แƒžแƒ˜แƒฃ-แƒขแƒ”-แƒ แƒ˜',
    'แƒžแƒ แƒแƒ’แƒ แƒแƒ›แƒ': 'แƒžแƒ แƒแƒ’-แƒ แƒ-แƒ›แƒ',
    'แƒ˜แƒœแƒขแƒ”แƒ แƒœแƒ”แƒขแƒ˜': 'แƒ˜แƒœ-แƒขแƒ”แƒ -แƒœแƒ”-แƒขแƒ˜'
}

hyphenator.load_library(custom_dict)

# Now these words will use your custom hyphenation
print(hyphenator.hyphenate('แƒ™แƒแƒ›แƒžแƒ˜แƒฃแƒขแƒ”แƒ แƒ˜'))
# Output: แƒ™แƒแƒ›-แƒžแƒ˜แƒฃ-แƒขแƒ”-แƒ แƒ˜

Combining Default + Custom Dictionary

hyphenator = GeorgianHyphenator('-')

# Load default dictionary first
hyphenator.load_default_library()

# Add your custom words
hyphenator.load_library({
    'แƒกแƒžแƒ”แƒชแƒ˜แƒแƒšแƒฃแƒ แƒ˜': 'แƒกแƒžแƒ”-แƒชแƒ˜-แƒ-แƒšแƒฃ-แƒ แƒ˜'
})

# Now has both default + custom exceptions

Export Formats

from georgian_hyphenation import to_tex_pattern, to_hunspell_format

# TeX hyphenation pattern
print(to_tex_pattern('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ'))
# Output: .แƒกแƒ1แƒฅแƒแƒ 1แƒ—แƒ•แƒ”1แƒšแƒ.

# Hunspell format
print(to_hunspell_format('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ'))
# Output: แƒกแƒ=แƒฅแƒแƒ =แƒ—แƒ•แƒ”=แƒšแƒ

Processing Files

from georgian_hyphenation import GeorgianHyphenator

hyphenator = GeorgianHyphenator('\u00AD')
hyphenator.load_default_library()

# Read file
with open('input.txt', 'r', encoding='utf-8') as f:
    text = f.read()

# Hyphenate
hyphenated = hyphenator.hyphenate_text(text)

# Write output
with open('output.txt', 'w', encoding='utf-8') as f:
    f.write(hyphenated)

๐Ÿ”ฌ How It Works

v2.2.1 Hybrid Engine

  1. Sanitization: Strip existing hyphens from input
  2. Dictionary Lookup: Check exception words first (if loaded)
  3. Algorithm Fallback: Apply phonological rules if not in dictionary

Algorithm Rules

1. Vowel Detection

แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ โ†’ vowels at positions: [1, 3, 5, 7]

2. Consonant Cluster Analysis

Between each vowel pair:

  • 0 consonants (V-V): Split between vowels
  'แƒ’แƒแƒแƒ™แƒ”แƒ—แƒ' โ†’ 'แƒ’แƒ-แƒ-แƒ™แƒ”-แƒ—แƒ'
  • 1 consonant (V-C-V): Split after first vowel
  'แƒ›แƒแƒ›แƒ' โ†’ 'แƒ›แƒ-แƒ›แƒ'
  • 2+ consonants (V-CC...C-V):
    1. Check for gemination (double consonants) - rare in Georgian
     'แƒกแƒแƒ›แƒ›แƒ' โ†’ 'แƒกแƒแƒ›-แƒ›แƒ'  # Split between double 'แƒ›' (if exists)
  1. Check for harmonic clusters
     'แƒ‘แƒšแƒแƒ™แƒ˜' โ†’ 'แƒ‘แƒšแƒ-แƒ™แƒ˜'  # Keep 'แƒ‘แƒš' together
  1. Default: Split after first consonant
     'แƒ‘แƒแƒ แƒ‘แƒแƒ แƒ”' โ†’ 'แƒ‘แƒแƒ -แƒ‘แƒ-แƒ แƒ”'

3. Harmonic Clusters (62 clusters)

These consonant pairs stay together:

แƒ‘แƒš, แƒ‘แƒ , แƒ‘แƒฆ, แƒ‘แƒ–, แƒ’แƒ“, แƒ’แƒš, แƒ’แƒ›, แƒ’แƒœ, แƒ’แƒ•, แƒ’แƒ–, แƒ’แƒ , แƒ“แƒ , แƒ—แƒš, แƒ—แƒ , แƒ—แƒฆ,
แƒ™แƒš, แƒ™แƒ›, แƒ™แƒœ, แƒ™แƒ , แƒ™แƒ•, แƒ›แƒข, แƒžแƒš, แƒžแƒ , แƒŸแƒฆ, แƒ แƒ’, แƒ แƒš, แƒ แƒ›, แƒกแƒฌ, แƒกแƒฎ, แƒขแƒ™, 
แƒขแƒž, แƒขแƒ , แƒคแƒš, แƒคแƒ , แƒคแƒฅ, แƒคแƒจ, แƒฅแƒš, แƒฅแƒœ, แƒฅแƒ•, แƒฅแƒ , แƒฆแƒš, แƒฆแƒ , แƒงแƒš, แƒงแƒ , แƒจแƒ—, 
แƒจแƒž, แƒฉแƒฅ, แƒฉแƒ , แƒชแƒš, แƒชแƒœ, แƒชแƒ , แƒชแƒ•, แƒซแƒ’, แƒซแƒ•, แƒซแƒฆ, แƒฌแƒš, แƒฌแƒ , แƒฌแƒœ, แƒฌแƒ™, แƒญแƒ™, 
แƒญแƒ , แƒญแƒง, แƒฎแƒš, แƒฎแƒ›, แƒฎแƒœ, แƒฎแƒ•, แƒฏแƒ’

4. Anti-Orphan Protection

Minimum 2 characters on each side:

'แƒแƒ แƒ' โ†’ 'แƒแƒ แƒ'  # Not split (would create 1-letter syllable)
'แƒแƒ แƒแƒ' โ†’ 'แƒ-แƒ แƒ-แƒ'  # OK to split

๐Ÿงช Examples

Basic Words

hyphenate('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ')   # โ†’ แƒกแƒ-แƒฅแƒแƒ -แƒ—แƒ•แƒ”-แƒšแƒ
hyphenate('แƒ›แƒ—แƒแƒ•แƒ แƒแƒ‘แƒ')      # โ†’ แƒ›แƒ—แƒแƒ•-แƒ แƒ-แƒ‘แƒ
hyphenate('แƒ“แƒ”แƒ“แƒแƒฅแƒแƒšแƒแƒฅแƒ˜')    # โ†’ แƒ“แƒ”-แƒ“แƒ-แƒฅแƒ-แƒšแƒ-แƒฅแƒ˜
hyphenate('แƒžแƒแƒ แƒšแƒแƒ›แƒ”แƒœแƒขแƒ˜')    # โ†’ แƒžแƒแƒ -แƒšแƒ-แƒ›แƒ”แƒœ-แƒขแƒ˜

V-C-V Pattern (Single Consonant)

hyphenate('แƒ™แƒšแƒแƒกแƒ˜')         # โ†’ แƒ™แƒšแƒ-แƒกแƒ˜
hyphenate('แƒ›แƒแƒกแƒ')          # โ†’ แƒ›แƒ-แƒกแƒ
hyphenate('แƒ›แƒแƒ›แƒ')          # โ†’ แƒ›แƒ-แƒ›แƒ
hyphenate('แƒ‘แƒแƒ‘แƒ')          # โ†’ แƒ‘แƒ-แƒ‘แƒ

Harmonic Clusters

hyphenate('แƒ‘แƒšแƒแƒ™แƒ˜')         # โ†’ แƒ‘แƒšแƒ-แƒ™แƒ˜  (keeps แƒ‘แƒš)
hyphenate('แƒ™แƒ แƒ”แƒ›แƒ˜')         # โ†’ แƒ™แƒ แƒ”-แƒ›แƒ˜  (keeps แƒ™แƒ )
hyphenate('แƒ’แƒšแƒ”แƒฎแƒ˜')         # โ†’ แƒ’แƒšแƒ”-แƒฎแƒ˜  (keeps แƒ’แƒš)
hyphenate('แƒขแƒ แƒแƒ›แƒ•แƒแƒ˜')       # โ†’ แƒขแƒ แƒแƒ›-แƒ•แƒ-แƒ˜ (keeps แƒขแƒ )
hyphenate('แƒžแƒ แƒแƒ’แƒ แƒแƒ›แƒ')     # โ†’ แƒžแƒ แƒแƒ’-แƒ แƒ-แƒ›แƒ (keeps แƒžแƒ  and แƒ’แƒ )

V-V Split

hyphenate('แƒ’แƒแƒแƒ™แƒ”แƒ—แƒ')       # โ†’ แƒ’แƒ-แƒ-แƒ™แƒ”-แƒ—แƒ
hyphenate('แƒ’แƒแƒ˜แƒแƒ แƒ')        # โ†’ แƒ’แƒ-แƒ˜-แƒ-แƒ แƒ
hyphenate('แƒแƒแƒจแƒ”แƒœแƒ')         # โ†’ แƒ-แƒ-แƒจแƒ”-แƒœแƒ
hyphenate('แƒ’แƒแƒแƒœแƒแƒšแƒ˜แƒ–แƒ')     # โ†’ แƒ’แƒ-แƒ-แƒœแƒ-แƒšแƒ˜-แƒ–แƒ

Complex Words

hyphenate('แƒ›แƒ—แƒแƒ•แƒ แƒแƒ‘แƒ')      # โ†’ แƒ›แƒ—แƒแƒ•-แƒ แƒ-แƒ‘แƒ
hyphenate('แƒกแƒแƒ›แƒ—แƒแƒ•แƒ แƒแƒ‘แƒ')    # โ†’ แƒกแƒแƒ›-แƒ—แƒแƒ•-แƒ แƒ-แƒ‘แƒ
hyphenate('แƒ‘แƒแƒ แƒ‘แƒแƒ แƒ”')       # โ†’ แƒ‘แƒแƒ -แƒ‘แƒ-แƒ แƒ”
hyphenate('แƒแƒกแƒขแƒ แƒแƒœแƒแƒ›แƒ˜แƒ')    # โ†’ แƒแƒก-แƒขแƒ แƒ-แƒœแƒ-แƒ›แƒ˜-แƒ

Text Processing

text = 'แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ แƒแƒ แƒ˜แƒก แƒšแƒแƒ›แƒแƒ–แƒ˜ แƒฅแƒ•แƒ”แƒงแƒแƒœแƒ'
hyphenate_text(text)
# โ†’ 'แƒกแƒยญแƒฅแƒแƒ ยญแƒ—แƒ•แƒ”ยญแƒšแƒ แƒแƒ แƒ˜แƒก แƒšแƒยญแƒ›แƒยญแƒ–แƒ˜ แƒฅแƒ•แƒ”ยญแƒงแƒยญแƒœแƒ'

# Preserves punctuation
text = 'แƒ›แƒ—แƒแƒ•แƒ แƒแƒ‘แƒ, แƒžแƒแƒ แƒšแƒแƒ›แƒ”แƒœแƒขแƒ˜ แƒ“แƒ แƒกแƒแƒกแƒแƒ›แƒแƒ แƒ—แƒšแƒ.'
hyphenate_text(text)
# โ†’ 'แƒ›แƒ—แƒแƒ•ยญแƒ แƒยญแƒ‘แƒ, แƒžแƒแƒ ยญแƒšแƒยญแƒ›แƒ”แƒœยญแƒขแƒ˜ แƒ“แƒ แƒกแƒยญแƒกแƒยญแƒ›แƒแƒ ยญแƒ—แƒšแƒ.'

# Preserves numbers and Latin text
text = 'แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒแƒจแƒ˜ 2025 แƒฌแƒ”แƒšแƒก'
hyphenate_text(text)
# โ†’ 'แƒกแƒยญแƒฅแƒแƒ ยญแƒ—แƒ•แƒ”ยญแƒšแƒยญแƒจแƒ˜ 2025 แƒฌแƒ”แƒšแƒก'

Get Syllables

get_syllables('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ')    # โ†’ ['แƒกแƒ', 'แƒฅแƒแƒ ', 'แƒ—แƒ•แƒ”', 'แƒšแƒ']
get_syllables('แƒ“แƒ”แƒ“แƒแƒฅแƒแƒšแƒแƒฅแƒ˜')     # โ†’ ['แƒ“แƒ”', 'แƒ“แƒ', 'แƒฅแƒ', 'แƒšแƒ', 'แƒฅแƒ˜']
get_syllables('แƒ›แƒ—แƒแƒ•แƒ แƒแƒ‘แƒ')       # โ†’ ['แƒ›แƒ—แƒแƒ•', 'แƒ แƒ', 'แƒ‘แƒ']
get_syllables('แƒ‘แƒšแƒแƒ™แƒ˜')          # โ†’ ['แƒ‘แƒšแƒ', 'แƒ™แƒ˜']

๐Ÿ“Š Dictionary

The library includes data/exceptions.json with 150+ Georgian words that require special hyphenation:

{
  "แƒ™แƒแƒ›แƒžแƒ˜แƒฃแƒขแƒ”แƒ แƒ˜": "แƒ™แƒแƒ›-แƒžแƒ˜แƒฃ-แƒขแƒ”-แƒ แƒ˜",
  "แƒ˜แƒœแƒขแƒ”แƒ แƒœแƒ”แƒขแƒ˜": "แƒ˜แƒœ-แƒขแƒ”แƒ -แƒœแƒ”-แƒขแƒ˜",
  "แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ": "แƒกแƒ-แƒฅแƒแƒ -แƒ—แƒ•แƒ”-แƒšแƒ",
  "แƒžแƒ แƒแƒ’แƒ แƒแƒ›แƒ": "แƒžแƒ แƒแƒ’-แƒ แƒ-แƒ›แƒ",
  "แƒ›แƒ—แƒแƒ•แƒ แƒแƒ‘แƒ": "แƒ›แƒ—แƒแƒ•-แƒ แƒ-แƒ‘แƒ"
}

Load it with:

hyphenator.load_default_library()

๐Ÿ”ง API Reference

Class: GeorgianHyphenator

class GeorgianHyphenator:
    def __init__(self, hyphen_char: str = '\u00AD')

Parameters:

  • hyphen_char (str): Character to use for hyphenation. Default: soft hyphen \u00AD

Methods

hyphenate(word: str) โ†’ str

Hyphenate a single Georgian word.

hyphenator = GeorgianHyphenator('-')
result = hyphenator.hyphenate('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ')
# Returns: 'แƒกแƒ-แƒฅแƒแƒ -แƒ—แƒ•แƒ”-แƒšแƒ'

hyphenate_text(text: str) โ†’ str

Hyphenate entire text (preserves punctuation and non-Georgian characters).

hyphenator = GeorgianHyphenator('-')
result = hyphenator.hyphenate_text('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ แƒแƒ แƒ˜แƒก แƒšแƒแƒ›แƒแƒ–แƒ˜')
# Returns: 'แƒกแƒ-แƒฅแƒแƒ -แƒ—แƒ•แƒ”-แƒšแƒ แƒแƒ แƒ˜แƒก แƒšแƒ-แƒ›แƒ-แƒ–แƒ˜'

get_syllables(word: str) โ†’ List[str]

Get syllables as a list.

hyphenator = GeorgianHyphenator('-')
syllables = hyphenator.get_syllables('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ')
# Returns: ['แƒกแƒ', 'แƒฅแƒแƒ ', 'แƒ—แƒ•แƒ”', 'แƒšแƒ']

load_library(data: Dict[str, str]) โ†’ None

Load custom dictionary.

hyphenator.load_library({
    'แƒกแƒ˜แƒขแƒงแƒ•แƒ': 'แƒกแƒ˜-แƒขแƒงแƒ•แƒ',
    'แƒ›แƒแƒ’แƒแƒšแƒ˜แƒ—แƒ˜': 'แƒ›แƒ-แƒ’แƒ-แƒšแƒ˜-แƒ—แƒ˜'
})

load_default_library() โ†’ None

Load default exception dictionary from data/exceptions.json.

hyphenator.load_default_library()

Convenience Functions

hyphenate(word: str, hyphen_char: str = '\u00AD') โ†’ str

from georgian_hyphenation import hyphenate
result = hyphenate('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ', '-')

get_syllables(word: str) โ†’ List[str]

from georgian_hyphenation import get_syllables
syllables = get_syllables('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ')

hyphenate_text(text: str, hyphen_char: str = '\u00AD') โ†’ str

from georgian_hyphenation import hyphenate_text
result = hyphenate_text('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ แƒแƒ แƒ˜แƒก แƒšแƒแƒ›แƒแƒ–แƒ˜')

to_tex_pattern(word: str) โ†’ str

from georgian_hyphenation import to_tex_pattern
pattern = to_tex_pattern('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ')
# Returns: '.แƒกแƒ1แƒฅแƒแƒ 1แƒ—แƒ•แƒ”1แƒšแƒ.'

to_hunspell_format(word: str) โ†’ str

from georgian_hyphenation import to_hunspell_format
hunspell = to_hunspell_format('แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ')
# Returns: 'แƒกแƒ=แƒฅแƒแƒ =แƒ—แƒ•แƒ”=แƒšแƒ'

๐Ÿงช Testing

Run the test suite:

python test_python.py

Expected output:

๐Ÿงช Georgian Hyphenation v2.2.1 - Python Tests

๐Ÿ“‹ Basic Hyphenation Tests:
โœ… Test 1: แƒกแƒแƒฅแƒแƒ แƒ—แƒ•แƒ”แƒšแƒ
   Result: แƒกแƒ-แƒฅแƒแƒ -แƒ—แƒ•แƒ”-แƒšแƒ
...
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
๐Ÿ“Š Test Results: 13 passed, 0 failed
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
๐ŸŽ‰ All tests passed!

๐Ÿ“ Project Structure

georgian-hyphenation/
โ”œโ”€โ”€ data/
โ”‚   โ””โ”€โ”€ exceptions.json          # Dictionary (150+ words)
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ georgian_hyphenation/
โ”‚       โ”œโ”€โ”€ __init__.py          # Package init
โ”‚       โ””โ”€โ”€ hyphenator.py        # Main code
โ”œโ”€โ”€ test_python.py               # Test suite
โ”œโ”€โ”€ pyproject.toml               # Package config
โ”œโ”€โ”€ MANIFEST.in                  # Data files manifest
โ”œโ”€โ”€ README.md                    # This file
โ””โ”€โ”€ LICENSE.txt                  # MIT License

๐Ÿ“œ Changelog

v2.2.1 (2025-01-27)

  • โœจ Optimized: Set-based harmonic cluster lookup (O(1) instead of O(n))
  • โœจ Added 12 new harmonic clusters: แƒ‘แƒ , แƒ’แƒ , แƒ“แƒ , แƒ—แƒฆ, แƒ›แƒข, แƒจแƒž, แƒฉแƒ , แƒฌแƒ™, แƒญแƒง
  • ๐Ÿ”„ Strip & Re-hyphenate: Always removes old hyphens and reapplies correctly
  • ๐Ÿ“ฆ Dictionary: 150+ exception words in data/exceptions.json
  • ๐ŸŽฏ Hybrid Engine: Dictionary-first, Algorithm fallback
  • ๐Ÿ“ Improved documentation with detailed API reference

v2.0.0 (2024)

  • Initial release
  • Phonological algorithm
  • Basic harmonic cluster handling
  • TeX and Hunspell export formats

๐Ÿค Contributing

Contributions are welcome! To contribute:

  1. Fork the repository: https://github.com/guramzhgamadze/georgian-hyphenation
  2. Create a feature branch: git checkout -b feature/new-feature
  3. Make your changes
  4. Run tests: python test_python.py
  5. Commit: git commit -m 'Add new feature'
  6. Push: git push origin feature/new-feature
  7. Open a Pull Request

Adding Exception Words

To add words to the dictionary:

  1. Edit data/exceptions.json
  2. Add your word in format: "แƒกแƒ˜แƒขแƒงแƒ•แƒ": "แƒกแƒ˜-แƒขแƒงแƒ•แƒ"
  3. Test: python test_python.py
  4. Submit PR

๐Ÿ› Bug Reports

Found a bug? Please open an issue: https://github.com/guramzhgamadze/georgian-hyphenation/issues

Include:

  • Python version
  • Code snippet that reproduces the issue
  • Expected vs actual output

๐Ÿ“„ License

MIT License

Copyright (c) 2025 Guram Zhgamadze

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


๐Ÿ‘จโ€๐Ÿ’ป Author

Guram Zhgamadze


๐Ÿ™ Acknowledgments

  • Georgian linguistic research on syllabification
  • TeX hyphenation algorithm inspiration
  • Python community for excellent packaging tools

๐Ÿ“š Related Projects


โญ Support

If you find this library useful, please:

  • โญ Star the repository on GitHub
  • ๐Ÿ“ข Share with others
  • ๐Ÿ› Report bugs
  • ๐Ÿ’ก Suggest improvements

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.2.2.tar.gz (23.0 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.2.2-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: georgian_hyphenation-2.2.2.tar.gz
  • Upload date:
  • Size: 23.0 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.2.2.tar.gz
Algorithm Hash digest
SHA256 0ba9cee7cc20ced528d4d3ecf7e9ba2988839bf926ae5bf857d79b84a8dbf237
MD5 b0ba54db2ffd637d418e70972d262806
BLAKE2b-256 fbd472353895c5427eef1afa50dfca0e047fb1b7fbb6be371575a126f78acaa0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for georgian_hyphenation-2.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d4682ffc25634657228890d0f17c52ff571bef0a23e3428e3bc8251dd909fa8f
MD5 89884321fec535df45d32d20a32514aa
BLAKE2b-256 99c9abb9b94e9897bd52206ccfdec147dd3015d2e384749db13c57fde69dd6fb

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