{"id":24922697,"url":"https://github.com/mattlianje/loquax","last_synced_at":"2025-04-09T19:15:46.406Z","repository":{"id":168179012,"uuid":"599883023","full_name":"mattlianje/loquax","owner":"mattlianje","description":"NLP framework for phonology","archived":false,"fork":false,"pushed_at":"2024-06-21T03:09:43.000Z","size":7983,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T19:15:37.722Z","etag":null,"topics":["digital-humanities","functional-programming","history","linguistics","nlp","nlp-library","nlp-parsing","phonological-features","phonology"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattlianje.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-10T04:43:34.000Z","updated_at":"2024-11-17T22:18:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"5314fe9a-9f93-42b6-a7d0-251fe047d87d","html_url":"https://github.com/mattlianje/loquax","commit_stats":{"total_commits":80,"total_committers":2,"mean_commits":40.0,"dds":"0.23750000000000004","last_synced_commit":"f265378eeb7f9be8f9f02678c9a832f5dd6f58aa"},"previous_names":["mattlianje/loquax"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattlianje%2Floquax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattlianje%2Floquax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattlianje%2Floquax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattlianje%2Floquax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattlianje","download_url":"https://codeload.github.com/mattlianje/loquax/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248094987,"owners_count":21046770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["digital-humanities","functional-programming","history","linguistics","nlp","nlp-library","nlp-parsing","phonological-features","phonology"],"created_at":"2025-02-02T11:33:15.647Z","updated_at":"2025-04-09T19:15:46.386Z","avatar_url":"https://github.com/mattlianje.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"pix/loquax_with_github.png\" width=\"400\"/\u003e\n\u003c/div\u003e\n\n# Loquax\nLoquax, (Latin for \"chatty\"), is an extensible, zero-dependency, FP-style Python library for phonological analysis. Eventually the python package will be soft-deprecated and this repo will house the compiler for the Loquax DSL. The [loquax web client](https://nargothrond.xyz/loquax).\n\n## Features\n- Define your own languages/accents/dialects and analyze texts\n- \"Out of the box\" Classical Latin support\n- Syllabification and tokenization of corpora\n- Phoneme analysis\n- Scansion (long/short only)\n- IPA transliteration\n\n## Languages\n| Language/Dialect       | IPA  | Syllabification | Scansion |\n|------------------------|------|-----------------|----------|\n| **Latin/Classical**    | ✓    | ✓               | ✓        |\n| **Greek/Classical**    | X    | X               | X        |\n\n## Quickstart\n```shell\npip install loquax\n``` \n\n```python\nfrom loquax import Document\nfrom loquax.languages import Latin\n\ncatilinarian_orations = Document(\"Quoūsque tandem abutēre, Catilīna, patientiā nostrā?\", Latin)\nprint(catilinarian_orations.to_string(ipa=True, scansion=True))\n\n# outputs:\n# kʷɔ.uːs.kʷɛ    tan.dɛm    a.bʊ.teː.rɛ    ka.tɪ.liː.na    pa.tɪ.ɛn.tɪ.aː    nɔs.traː\n#  u   -   u      -   u     u u   -  u     u  u   -  u     u  u  u  u  -      u   -\n\n```\n## Syllabification, Tokenization\n```python\nprint(catilinarian_orations.tokens)\n\n# outputs:\n# [kʷɔ.uːs.kʷɛ, tan.dɛm, a.bʊ.teː.rɛ, ka.tɪ.liː.na, pa.tɪ.ɛn.tɪ.aː, nɔs.traː]\n\nprint(catilinarian_orations.tokens[0].syllables)\n\n# outputs:\n# [quo, ūs, que]\n```\n\n## Phoneme Analysis\nUnderstand unique sounds and their roles within words relative to a `Language`\n```python\nfrom loquax.abstractions import Phoneme\nfrom loquax.languages import Latin\n\nr = Phoneme('r', Latin)\nprint(r.is_consonant and r.is_liquid)  # outputs: True\n```\n\n## Morphology\n**The central problem of phonology** is that linguistic units have changing features depending on their context and neighbours. \n\nLoquax allows users to tackle this by defining their own morphisms. \n\n```python\nfrom loquax.morphisms import Morphism, Rule, RuleSequence\nfrom loquax.syllables import Syllable\nfrom dataclasses import replace\n\nlong_position_morphism = Morphism[Syllable](\n    target=Rule[Syllable](check_fn=lambda s: s.nucleus and s.coda and len(s.coda) \u003e= 1),\n    transformation=lambda s: replace(s, is_long=True),\n    suffix=RuleSequence(\n        [Rule[Syllable](check_fn=lambda s: s.coda and len(s.onset) \u003e= 1)]\n    ),\n)\n```\n`MorphismStore` lets you organize your morphisms and to apply all transformations in your MorphismStore to a given syllable or phoneme sequence:\n```python\nfrom loquax.abstractions import MorphismStore\n\nmorphism_store = MorphismStore([morphism1, morphism2, morphism3])\nsyllables_sequence = [syllable1, syllable2, syllable3]\ntransformed_sequence = morphism_store.apply_all(syllables_sequence)\n```\n\n## Ipa\nTo convert text into the International Phonetic Alphabet for universal comprehension, \nyou can use the `to_string` function with `ipa=True`:\n```python\nprint(catilinarian_orations.to_string(ipa=True))\n\n# outputs:\n# kʷɔ.uːs.kʷɛ    tan.dɛm    a.bʊ.teː.rɛ    ka.tɪ.liː.na    pa.tɪ.ɛn.tɪ.aː    nɔs.traː\n```\n\n## Scansion\nScansion is the process of marking the stresses in a poem, and dividing the lines into feet. \nIt's a critical part of the study and enjoyment of classical verse, like in Latin and Ancient Greek poetry. \nLoquax makes it easy to integrate scansion into your language analysis pipeline.\n\nCurrently only differentiation between long and short syllables is made\n```python\nprint(catilinarian_orations.to_string(scansion=True))\n\n# outputs:\n# quo.ūs.que    tan.dem    a.bu.tē.re    ca.ti.lī.na    pa.ti.en.ti.ā    nos.trā\n#  u  -   u      -   u     u u  -  u     u  u  -  u     u  u  u  u  -     u   -\n```\n\n## Extensibility\nLoquax allows for extensibility, so you can build and customize your own language rules \nfor unique or theoretical languages. Here's an example of how to define custom rules and apply them:\n```python\nfrom loquax.languages import Latin\nfrom loquax.abstractions import (\n    PhonemeSyllabificationRuleStore, Language, \n    Constants, Tokenizer, MorphismStore, \n    Syllable, Morphism, Phoneme\n)\n\nsyllabification_rules = PhonemeSyllabificationRuleStore(...)\nconstants = Constants(...)\ntokenizer = Tokenizer(...)\nsyllable_morphisms = MorphismStore[Syllable]([...])\nphoneme_morphisms = MorphismStore[Phoneme]([...])\n\nmy_lang = Language(\n    language_name='MyLang',\n    iso_639_code='myl', \n    constants,\n    syllabification_rules,\n    syllable_morphisms,\n    phoneme_morphisms,\n    tokenizer,\n)\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattlianje%2Floquax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattlianje%2Floquax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattlianje%2Floquax/lists"}