A Scala 3 port of the Gramadán Irish-language morphology library.
Gramadán inflects Irish nouns, adjectives, verbs, prepositions, and noun/verbal phrases according to the grammar rules of Modern Irish, and can serialise the results to NEID-compatible XML.
- Phonology engine — character-level predicates for Irish vowels, consonants, broad/slender distinction, and vowel cluster detection
- Initial mutations — all 13 mutation types (lenition variants Len1–Len3D, eclipsis variants Ecl1–Ecl3, PrefT, PrefH) applied via
Mutations.mutate - Stem operations — slenderisation, broadening, syncope, prefix attachment, and emphasizer attachment (
StemOps) - Noun inflection — five-declension paradigm with singular nominative/genitive/vocative/dative and plural nominative/genitive/vocative slots, plus counting forms; BuNaMo XML import
- Adjective inflection — gender-differentiated singular genitive/vocative, shared plural nominative, graded form, abstract noun, and all four comparative/superlative surface forms
- Verb inflection — full tense × dependency × person grid (past, past-continuous, present, present-continuous, future, conditional — independent and dependent), imperative and subjunctive moods, verbal noun and verbal adjective
- Personal prepositions — seven-cell paradigm (sg1/sg2/sg3masc/sg3fem/pl1/pl2/pl3)
- Noun phrases — head noun ± postpositive or prefixed adjective ± possessive pronoun; unarticulated and articulated forms (including northern/southern dative-with-article variants)
- Verbal phrases — tense-rule–driven surface forms across tense, person, shape (declarative/interrogative), and polarity
- Prepositional phrases — combination of preposition and noun phrase with articled variants
- NEID XML output —
Printerobject serialises any inflected type to the NEID XML format used by Foclóir.ie and related tools
src/main/scala/gramadan/
├── phonology/
│ ├── Phonology.scala # Character-level predicates and constants
│ ├── MutationType.scala # Enum of all 13 Irish initial mutations
│ ├── StemOps.scala # Slenderisation, broadening, syncope, prefix ops
│ └── EmphasizerType.scala # Emphatic suffix enum
├── inflection/
│ ├── Grammar.scala # Core grammatical enumerations (Gender, Case, etc.)
│ ├── Forms.scala # Form, FormSg, FormPlGen value types
│ ├── SingularInfo.scala # Strategy objects for singular paradigm derivation
│ ├── PluralInfo.scala # Strategy objects for plural paradigm derivation
│ ├── Noun.scala # Noun class + apply / fromForms / fromXml constructors
│ ├── Adjective.scala # Adjective class + fromForms / fromXml constructors
│ ├── Verb.scala # Verb class with full tense/mood grid
│ ├── Preposition.scala # Personal preposition class
│ └── Possessive.scala # Possessive pronoun class
├── phrase/
│ ├── NounPhrase.scala # Noun phrase builder (head, adjective, possessive)
│ └── VerbalPhrase.scala # Verbal phrase builder
└── output/
└── Printer.scala # NEID XML serialiser for all types
- Scala 3.3.x
- sbt 1.x
- JVM 11+
sbt compile
sbt testimport gramadan.inflection.*
val sing = SingularInfo.First("bád") // 1st declension strategy
val plur = PluralInfo.Slender("báid") // slender plural strategy
val noun = Noun("bád", Gender.Masc, declension = 1, sing, plur)
println(noun.sgNom.head.value) // bád
println(noun.sgGen.head.value) // báid
println(noun.plNom.head.value) // báidimport gramadan.phrase.NounPhrase
val np = NounPhrase(noun, isDefinite = true)
println(np.sgNomArt.head.value) // an bádimport gramadan.inflection.Noun
import scala.xml.XML
val xml = XML.loadFile("bád.xml")
val noun = Noun.fromXml(xml.head.asInstanceOf[scala.xml.Elem])import gramadan.output.Printer
println(Printer.noun(noun))
println(Printer.nounPhrase(np))The original Gramadán library is a C# project by Michal Měchura. This port targets Scala 3 and follows the same domain model (BuNaMo XML input, NEID XML output) while using idiomatic Scala 3 features: opaque enums, case classes, extension methods, and pattern matching.
See the original Gramadán project for licensing context. This port is a derivative work.