Skip to main content

Akana (Turkish NLP Toolkit)

PyPI Version License: MIT / Apache-2.0 Rust: >= 1.75 Python: >= 3.8

Akana (named after Ak Ana, the primordial creator goddess in Turkic mythology) is a modern, blazingly fast Turkish Natural Language Processing toolkit written in Rust with seamless Python bindings via PyO3 and native hardware SIMD acceleration via StringZilla.

Repository: https://github.com/altaidevorg/akana


Key Features

  • Phonology & Orthography Engine:
    • Turkish alphabet characteristics and locale-aware casing (ı $\leftrightarrow$ I, i $\leftrightarrow$ İ).
    • Major (2-way A/E) and Minor (4-way I/İ/U/Ü) Vowel Harmony validation.
    • Consonant softening / mutation ($p \rightarrow b$, $ç \rightarrow c$, $t \rightarrow d$, $k \rightarrow \check{g}/g$).
    • Epenthetic vowel drop (burun $\rightarrow$ burnu, akıl $\rightarrow$ aklı).
    • Consonant doubling / gemination (hak $\rightarrow$ hakkı, his $\rightarrow$ hissi).
  • Tokenization & Sentence Segmentation:
    • Zero-allocation, rule-based Turkish tokenizer handling proper nouns with apostrophes (İstanbul'da), abbreviations (Prof., Dr., vb.), currencies, URLs, emails, hashtags, dates, and times.
    • Sentence Boundary Detector with Turkish quotation and abbreviation lookahead.
  • Normalization & Spell Checking:
    • Asciifier & De-asciifier for Turkish diacritics restoration.
    • SIMD Spell Checker: Accelerated with StringZilla hardware instructions for ultra-fast Levenshtein / edit distance candidate scoring.
    • Informal Text Normalizer: Spoken Turkish colloquialisms reduction (yapcam $\rightarrow$ yapacağım, geliyom $\rightarrow$ geliyorum, noldu $\rightarrow$ ne oldu) and letter elongation deduping (çooook $\rightarrow$ çok).
  • Dual-Engine Morphology Suite:
    1. Standard Morphology (akana.Morphology):
      • 93,167 Root Lexicon: Broad-coverage Turkish vocabulary ingested from Zemberek, TDK, location gazetteers, and modern corpus lexicons.
      • Multi-tier morphotactic graph: nominal cases, plurals, possessives, verbal tenses, compound copulas, voices (passive/causative), participles, diminutives, relative -ki chains, and derivations.
      • Compound Word Decomposer: Deconstructs compound nouns (denizaltı $\rightarrow$ deniz + altı, akbaba $\rightarrow$ ak + baba).
      • Morphological Generator (generate("kitap", ["Noun", "A3sg", "P1sg", "Dat"]) $\rightarrow$ "kitabıma").
      • Context-aware Disambiguator for best-parse selection.
    2. Syntactic Expressive Morphology (akana.SyntacticMorphology) (Google FSMNLP 2019 Architecture):
      • Inflectional Groups (IG): Hierarchical derivational tiers with Universal Dependencies (UD) category-value feature maps.
      • Zero-Derivation Elimination: Cross-categorized lexical entries (e.g. güzel, hızlı, soğuk) eliminating phantom +^DB morphemes.
      • Dedicated, isolated 47,202 gold-standard root lexicon.
  • Modern & Classic Turkish Readability Suite:
    • Kalyoncu (2025) Formula Suite: Multi-regression equations (Formulas 1–4, $R^2$ up to 0.99) with embedded 4,600-word familiarity lexicon and exact grade-level mapping (3. Sınıf Öncesi to Lisansüstü).
    • Classical Formulas: Ateşman (1997), Çetinkaya-Uzun (2010), and Bezirci-Yılmaz (2010).
  • Turkish AI Writing Style Auditor & Humanizer Engine:
    • Detects LLM writing signatures: punctuation anomalies (excessive em-dashes, semicolons with conjunctions, colons), predicate tense repetition (-mektedir ratio), rhythm monotony ($CV = \sigma / \mu$), bureaucratic connectors, translationese calques, tricolon lists, and hypophora questions.
    • Actionable prompt generation across 5 registers (hukuki-idari, akademik-kurumsal, analitik-gazetecilik, deneme-blog, edebi-yaratıcı).
  • Syntax & Universal Dependencies:
    • Transition-based parser outputting Universal Dependencies (UD) format and CoNLL-U trees.
  • High-Level NLP Primitives:
    • Turkish Syllabification & Hyphenation.
    • Number to Words Converter (Cardinals, Ordinals, Currency).
    • Named Entity Recognition (PER, LOC, ORG, DATE, MONEY, PERCENT).
    • Keyword Extraction (Turkish RAKE) & Extractive Summarization (TextRank).
  • High-Performance Architecture:
    • Pure Rust core with zero JVM dependency.
    • Python package via pyo3 and maturin (compatible with uv).
    • Command Line Interface (CLI) for shell workflows.

Performance Benchmarks (Akana vs Zeyrek / Zemberek & StringZilla SIMD)

Tested on real Turkish text corpora and 10,500 morphological queries (benchmarks/):

Benchmark Metric Zeyrek (Python Zemberek Port) Akana (Rust + StringZilla SIMD) Performance / Throughput
Active Root Lexicon ~90,000 roots 93,167 roots Full Coverage
Startup / Lexicon Init 2,733.8 ms (~2.7s) 200.2 ms 13.6x faster
Morphological Parse (10.5k words) 55,349.7 ms (55.3s) 989.7 ms (0.98s) 55.9x faster (10,609 words/sec)
Tokenization (Zero-Allocation) ~230 words/sec 949,991 tokens/sec >4,000x faster (<21 ms for 19.5k tokens)
Informal Normalization N/A 36,222 words/sec High Throughput (Zero-Regex Suffix Matching)
AI Writing Style Audit N/A 27,179 words/sec StringZilla SIMD (10.2k words in 375 ms)
Named Entity Recognition (NER) N/A 1.14 MB/sec Linear Token Stream (1,500 entities in 37 ms)
Hardware Acceleration Pure Python loops StringZilla AVX-512 / AVX2 / NEON Native SIMD Instructions

Python Quickstart

Installation

# Using uv
uv pip install akana

# Using pip
pip install akana

Usage in Python

import akana

# 1. Standard Morphological Analysis (Zemberek-Compatible Format)
morph = akana.Morphology()
parses = morph.analyze("kitabıma")
for parse in parses:
    print(parse["lemma"], parse["primary_pos"], parse["morphemes"])
# -> kitap Noun ['Noun', 'P1sg', 'Dat']

# 2. Google-Style Syntactic Expressive Morphology (Inflectional Groups & UD)
syn_parses = akana.syntactic_analyze("geldiğimizde")
for p in syn_parses:
    print(p.formatted)
    # Output: (gel[VB]+[Polarity=Pos])([NOMP]-PastNom+[Case=Loc]+[PersonNumber=A3sg]+[Possessive=P1pl])+[Proper=False]
    for ig in p.inflectional_groups:
        print(f"  • IG [{ig.pos}] Deriv: {ig.derivation} -> {ig.features}")

# 3. Morphological Generation
surface = morph.generate("kitap", ["Noun", "A3sg", "P1sg", "Dat"])
print(surface)  # -> kitabıma

# 4. Spell Checking with StringZilla SIMD
spell = akana.SpellChecker()
print("Is 'kitap' correct?", spell.is_correct("kitap"))
suggestions = spell.suggest("ktap", max_distance=2, max_suggestions=3)
print("Suggestions for 'ktap':", [s["word"] for s in suggestions])

# 5. De-asciification & Normalization
print(akana.deasciify("turkce nlp cok hizli calisiyor"))
# -> türkçe nlp çok hızlı çalışıyor

print(akana.normalize_informal("nooldu ya yapcam dedim"))
# -> ne oldu ya yapacağım dedim

# 6. Compound Word Decomposition
compounds = akana.decompose_compound("denizaltı")
print(compounds)
# -> [{'surface': 'denizaltı', 'part1': 'deniz', 'part2': 'altı', ...}]

# 7. Modern Turkish Readability Analysis (Kalyoncu 2025 & Classic)
report = akana.analyze_readability("Küçük çocuk bahçede neşeyle koşuyordu.")
print(f"Kalyoncu F1: {report.kalyoncu_formula1.score} ({report.kalyoncu_formula1.grade_level})")
print(f"Ateşman: {report.atesman.score} ({report.atesman.grade_level})")

# 8. Turkish AI Writing Style Auditor & Actionable Humanizer Prompt
audit = akana.audit_ai_style("Yapay zeka teknolojileri, modern dünyada kritik bir rol oynamaktadır. Bu bağlamda —özellikle veri alanında— hayati önem taşımaktadır.")
print(f"AI Score: {audit.ai_score}/100 ({audit.verdict})")

prompt = akana.humanize_prompt("Bu doğrultuda hayati önem taşımaktadır.", register="blog")
print(prompt)

# 9. High-Level Turkish NLP Suite
# Syllabification & Hyphenation
print(akana.syllabify("Türkçe"))     # -> ['Türk', 'çe']
print(akana.hyphenate("bilgisayar")) # -> 'bil-gi-sa-yar'

# Number to Words Converter
print(akana.number_to_words(1923))            # -> 'bin dokuz yüz yirmi üç'
print(akana.currency_to_words(1250.50, "TL"))  # -> 'bin iki yüz elli lira elli kuruş'

# Named Entity Recognition (NER)
entities = akana.extract_entities("Prof. Dr. Ahmet Yılmaz 16 Ağustos 2026 tarihinde 500 TL ödeme yaptı.")
for e in entities:
    print(f"[{e.label}] {e.text}")

# Keyword Extraction (Turkish RAKE) & Extractive Summarization (TextRank)
keywords = akana.extract_keywords("Doğal dil işleme ve morfolojik analiz...", top_k=5)
summary = akana.summarize("Uzun metin...", max_sentences=2)

CLI Usage

The akana CLI supports direct text arguments or reading from file via -f, --file:

# AI style auditing
akana ai-audit "Bu bağlamda kritik bir rol oynamaktadır."
akana ai-audit -f article.txt

# Generate humanizer rewrite prompt
akana humanize-prompt "Bu doğrultuda hayati önem taşımaktadır." --register blog

# Syntactic morphological analysis (Google FSMNLP format)
akana syntactic-analyze "geldiğimizde"

# Standard morphological analysis
akana analyze "evlerimizde"

# Readability analysis
akana readability "Küçük çocuk bahçede neşeyle koşuyordu."

# Syllabification & Number conversion
akana syllabify "bilgisayar"
akana number 1923

# De-asciification & Normalization
akana deasciify "turkce nlp"
akana normalize "yapcam"

# Universal Dependencies Parsing
akana parse "Ali güzel kitabı okudu."

Rust Crate Usage (akana-core)

Add to Cargo.toml:

[dependencies]
akana-core = { version = "0.1", default-features = true }
use akana_core::morphology::TurkishMorphology;
use akana_core::syntactic_morphology::TurkishSyntacticMorphology;
use akana_core::phonology::to_turkish_lower;

fn main() {
    let lower = to_turkish_lower("İSTANBUL");
    println!("Lower: {}", lower);

    // Standard Morphology
    let morph = TurkishMorphology::new();
    let parses = morph.analyze("kitabım");
    for p in parses {
        println!("{}", p.formatted);
    }

    // Syntactic Expressive Morphology (Inflectional Groups)
    let syn_morph = TurkishSyntacticMorphology::new();
    let syn_parses = syn_morph.analyze("geldiğimizde");
    for p in syn_parses {
        println!("{}", p.formatted);
    }
}

Building & Publishing with uv & maturin

Akana is structured as a dual-language workspace (Rust workspace + PyO3 Python package) built using maturin and uv.

1. Local Development Build

# Install maturin in your uv environment
uv pip install maturin

# Build and install release package in editable mode
uv run maturin develop --release

# Run unit tests
uv run pytest
uv run cargo test -p akana-core -p akana-cli

2. Build Python Wheels (for PyPI distribution)

# Build multi-platform abi3 wheels into dist/
uv run maturin build --release --out dist/

3. Publish to PyPI

# Set your PyPI token (or use ~/.pypirc)
export MATURIN_PYPI_TOKEN="pypi-..."

# Publish via maturin
uv run maturin publish --out dist/

# Or publish via uv publish
uv publish dist/*

4. Publish Rust Crates to crates.io

cargo publish -p akana-core
cargo publish -p akana-cli

Acknowledgements & Academic Citations

Akana builds upon decades of pioneering linguistic and natural language processing research in Turkish. We gratefully acknowledge and credit:

  • Kemal Oflazer: Foundational two-level Turkish morphological analysis (1994) and the Inflectional Group (IG) representation (2003) for Turkish dependency syntax.
  • Ahmet A. Akın & The Zemberek Team: Open-source Turkish morphology, phonotactics, and extensive root vocabulary database.
  • Oğuzhan Güngör & Zeyrek Contributors: The pure-Python Zemberek port that inspired modern open Turkish NLP tooling.
  • Google Research (Adnan Öztürel, Tolga Kayadelen, Işın Demirşahin): "A Syntactically Expressive Morphological Analyzer for Turkish" (FSMNLP 2019), introducing zero-derivation elimination and two-level inflectional group FSTs.
  • Mustafa Kalyoncu & Co-authors (2025): Development of modern Turkish readability formulas (Formulas 1–4) and the empirical 4,600-word grade-level familiarity corpus.
  • Ender Ateşman (1997), Çetinkaya-Uzun (2010), Bezirci-Yılmaz (2010): Classical readability research for the Turkish education system.
  • Ash Vardanian & Unum Cloud: StringZilla, providing hardware-accelerated SIMD vector search and edit distance algorithms.
  • Bushra Beg (Turkce-Humanizer): Research into Turkish AI writing style signatures, calques, and stylistic heuristics.

License

Licensed under either of:

at your option.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

akana-0.1.0-cp38-abi3-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8+Windows x86-64

File details

Details for the file akana-0.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: akana-0.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for akana-0.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 044120e04a4f4b739bf54024273c062840547d4032bd8849b48fde4483e348a3
MD5 00cd0eedbf0eb54ab5846f1c457d20a1
BLAKE2b-256 52de473e6c3c947295bef14c7267568e8cf95d6c3e3d967fd47b0ba457d5bd32

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

4 files

0.2.3

4 files

0.1.2

3 files

This release

0.1.0 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page