Archived
Rename: nlg → elp (Engram Language Protocol)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// lang-ang.el - Old English NLG tests
|
||||
// Expected: "Se mann sihþ þone hund." / "Se mann is god."
|
||||
fn test_assert() -> String {
|
||||
return sem_realize(sem_frame_lang("assert", "se mann", "seon", "", "ang"))
|
||||
}
|
||||
fn test_question() -> String {
|
||||
return sem_realize(sem_frame_lang("query", "se mann", "seon", "", "ang"))
|
||||
}
|
||||
fn test_describe() -> String {
|
||||
return sem_realize(sem_frame_lang("describe", "se mann", "god", "", "ang"))
|
||||
}
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_describe())
|
||||
@@ -0,0 +1,56 @@
|
||||
// lang-ar.el - Arabic NLG tests: VSO assertion, intonation question.
|
||||
//
|
||||
// Arabic is VSO (Verb-Subject-Object), fusional, RTL script. The word order
|
||||
// test verifies that gram_order_constituents places the verb first for "ar".
|
||||
// Questions use the intonation strategy (statement word order + "?").
|
||||
//
|
||||
// Expected outputs (approximate):
|
||||
// assert: "يأكل القط السمكة." (VSO: verb-subject-object)
|
||||
// question: "يأكل القط السمكة?" (same VSO order, ? punctuation)
|
||||
|
||||
fn test_assert() -> String {
|
||||
// VSO order: verb يأكل (eats), subject القط (the cat), object السمكة (the fish)
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "assert")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "القط")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "يأكل")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "السمكة")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "ar")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
// Intonation question: same VSO order, ? punctuation
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "question")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "القط")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "يأكل")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "السمكة")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "ar")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
@@ -0,0 +1,30 @@
|
||||
// lang-de.el - German NLG tests: assertion, question inversion, description.
|
||||
//
|
||||
// German is profiled as SOV (base word order in subordinate clauses) with V2
|
||||
// in main clauses, and uses the "inversion" question strategy.
|
||||
// Cases: nominative subject "die Katze", accusative object "den Fisch".
|
||||
//
|
||||
// Expected outputs (approximate):
|
||||
// assert: "Die Katze isst den Fisch."
|
||||
// question: "Isst die Katze den Fisch?" (verb-subject inversion)
|
||||
// description: "Die Katze ist groß."
|
||||
|
||||
fn test_assert() -> String {
|
||||
let frame: [String] = sem_frame_lang("assert", "die Katze", "essen", "", "de")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
// German question: inversion — verb fronts before subject
|
||||
let frame: [String] = sem_frame_lang("query", "die Katze", "essen", "", "de")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
fn test_description() -> String {
|
||||
let frame: [String] = sem_frame_lang("describe", "die Katze", "groß", "", "de")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_description())
|
||||
@@ -0,0 +1,14 @@
|
||||
// lang-enm.el - Middle English NLG tests
|
||||
// Expected: "The man seeth the hound." / "The man is good."
|
||||
fn test_assert() -> String {
|
||||
return sem_realize(sem_frame_lang("assert", "the man", "seen", "", "enm"))
|
||||
}
|
||||
fn test_question() -> String {
|
||||
return sem_realize(sem_frame_lang("query", "the man", "seen", "", "enm"))
|
||||
}
|
||||
fn test_describe() -> String {
|
||||
return sem_realize(sem_frame_lang("describe", "the man", "good", "", "enm"))
|
||||
}
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_describe())
|
||||
@@ -0,0 +1,28 @@
|
||||
// lang-es.el - Spanish NLG tests: assertion, question, description.
|
||||
//
|
||||
// Tests SVO word order, fusional Spanish morphology, and intonation
|
||||
// question strategy (no auxiliary inversion in Spanish).
|
||||
//
|
||||
// Expected outputs (approximate — depends on morph tables loaded):
|
||||
// assert: "El gato come el pescado."
|
||||
// question: "El gato come el pescado?" (intonation — statement order + ?)
|
||||
// description: "El gato es grande."
|
||||
|
||||
fn test_assert() -> String {
|
||||
let frame: [String] = sem_frame_lang("assert", "el gato", "comer", "", "es")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
let frame: [String] = sem_frame_lang("query", "el gato", "comer", "", "es")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
fn test_description() -> String {
|
||||
let frame: [String] = sem_frame_lang("describe", "el gato", "grande", "", "es")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_description())
|
||||
@@ -0,0 +1,59 @@
|
||||
// lang-fi.el - Finnish NLG tests: assertion, question with -ko particle.
|
||||
//
|
||||
// Finnish is SOV, agglutinative, 15 grammatical cases. Questions use the
|
||||
// "particle" strategy: statement order with -ko/-kö suffix on the verb.
|
||||
// The realizer appends "-ko" for Finnish (see realize_question_lang).
|
||||
//
|
||||
// "kalaa" is the partitive form of kala (fish) — the engine produces the
|
||||
// base form unless morphology-fi.el is loaded with suffix tables.
|
||||
//
|
||||
// Expected outputs (approximate):
|
||||
// assert: "Kissa syö kalaa." (SOV order)
|
||||
// question: "Kissa syö kalaa-ko?" (SOV + -ko particle on verb or sentence end)
|
||||
|
||||
fn test_assert() -> String {
|
||||
// SOV: subject Kissa (cat), verb syö (eats), object kalaa (fish-PARTITIVE)
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "assert")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "kissa")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "syö")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "kalaa")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "fi")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
// Finnish question particle: statement order + -ko appended by realizer
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "question")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "kissa")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "syö")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "kalaa")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "fi")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
@@ -0,0 +1,37 @@
|
||||
// lang-fr-question.el - French question inversion test.
|
||||
//
|
||||
// Tests specifically that the French "inversion" question strategy works:
|
||||
// the verb fronts before the subject, producing Verb-Subject-Object order.
|
||||
//
|
||||
// "Parler" (to speak) is an -er verb; "français" is the patient (what is spoken).
|
||||
// Subject pronoun: "il" (he).
|
||||
//
|
||||
// Expected output (approximate):
|
||||
// "Parle il français?" (verb-subject-object inversion)
|
||||
//
|
||||
// Note: full French inversion includes a euphonic -t- between verb and pronoun
|
||||
// ("Parle-t-il") — this requires morphology-fr.el with inversion helpers.
|
||||
// Without that module the engine produces the bare inverted form.
|
||||
|
||||
fn run_test() -> String {
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "question")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "il")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "parler")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "français")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "fr")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
println(run_test())
|
||||
@@ -0,0 +1,29 @@
|
||||
// lang-fr.el - French NLG tests: assertion, question inversion, description.
|
||||
//
|
||||
// Tests SVO declarative order and subject-verb inversion for questions
|
||||
// (strategy="inversion" for French in gram_question_strategy).
|
||||
//
|
||||
// Expected outputs (approximate):
|
||||
// assert: "Le chat mange le poisson."
|
||||
// question: "Mange le chat le poisson?" (verb-subject inversion)
|
||||
// description: "Le chat est grand."
|
||||
|
||||
fn test_assert() -> String {
|
||||
let frame: [String] = sem_frame_lang("assert", "le chat", "manger", "", "fr")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
// French question: inversion strategy — verb fronts before subject
|
||||
let frame: [String] = sem_frame_lang("query", "le chat", "manger", "", "fr")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
fn test_description() -> String {
|
||||
let frame: [String] = sem_frame_lang("describe", "le chat", "grand", "", "fr")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_description())
|
||||
@@ -0,0 +1,14 @@
|
||||
// lang-got.el - Gothic NLG tests
|
||||
// Expected: "sa guma saihwiþ." / "sa guma ist waihs."
|
||||
fn test_assert() -> String {
|
||||
return sem_realize(sem_frame_lang("assert", "sa guma", "saihwan", "", "got"))
|
||||
}
|
||||
fn test_question() -> String {
|
||||
return sem_realize(sem_frame_lang("query", "sa guma", "saihwan", "", "got"))
|
||||
}
|
||||
fn test_describe() -> String {
|
||||
return sem_realize(sem_frame_lang("describe", "sa guma", "waihs", "", "got"))
|
||||
}
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_describe())
|
||||
@@ -0,0 +1,14 @@
|
||||
// lang-grc.el - Ancient Greek NLG tests
|
||||
// Expected: "ὁ ἄνθρωπος ὁράει τὸν κύνα." / "ὁ ἄνθρωπος ἐστί καλός."
|
||||
fn test_assert() -> String {
|
||||
return sem_realize(sem_frame_lang("assert", "ho anthropos", "horao", "", "grc"))
|
||||
}
|
||||
fn test_question() -> String {
|
||||
return sem_realize(sem_frame_lang("query", "ho anthropos", "horao", "", "grc"))
|
||||
}
|
||||
fn test_describe() -> String {
|
||||
return sem_realize(sem_frame_lang("describe", "ho anthropos", "kalos", "", "grc"))
|
||||
}
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_describe())
|
||||
@@ -0,0 +1,40 @@
|
||||
// lang-he.el - Hebrew NLG tests
|
||||
//
|
||||
// Hebrew SVO: "הכלב רואה את החתול" (ha-kelev ro'e et ha-xatul)
|
||||
// "the-dog sees ACC the-cat"
|
||||
//
|
||||
// Modern Hebrew uses:
|
||||
// - SVO word order
|
||||
// - Zero copula in present tense ("הוא גדול" = "he big" = "he is big")
|
||||
// - Rising intonation for questions (no morphological change; "?" added by realizer)
|
||||
// - Definite article ה (ha-) prefixed directly to the noun
|
||||
//
|
||||
// Note: Hebrew Unicode strings display as numeric hashes in the current El
|
||||
// runtime (UTF-8 output not yet implemented). The strings are semantically
|
||||
// correct internally and will display properly once the VM gains UTF-8 output.
|
||||
//
|
||||
// Transliterated inputs used below ("hu" = הוא he/him, "lir'ot" = to see,
|
||||
// "gadol" = big/large) are handled by sem_frame_lang and passed through
|
||||
// to he_conjugate / he_noun_phrase via the morphology dispatcher.
|
||||
//
|
||||
// Expected outputs (approximate, once UTF-8 output is live):
|
||||
// assert: "הוא רואה." (hu ro'e. — he sees.)
|
||||
// question: "הוא רואה?" (hu ro'e? — he sees?)
|
||||
// description: "הוא גדול." (hu gadol. — he [is] big.)
|
||||
// (zero copula: no verb in present description)
|
||||
|
||||
fn test_assert() -> String {
|
||||
return sem_realize(sem_frame_lang("assert", "hu", "lir'ot", "", "he"))
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
return sem_realize(sem_frame_lang("query", "hu", "lir'ot", "", "he"))
|
||||
}
|
||||
|
||||
fn test_description() -> String {
|
||||
return sem_realize(sem_frame_lang("describe", "hu", "gadol", "", "he"))
|
||||
}
|
||||
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_description())
|
||||
@@ -0,0 +1,60 @@
|
||||
// lang-hi.el - Hindi NLG tests: SOV assertion, question with क्या particle.
|
||||
//
|
||||
// Hindi is SOV, fusional (with postpositions), pro-drop. Questions use the
|
||||
// "particle" strategy: statement order + क्या (kya) appended at sentence end.
|
||||
// (See realize_question_lang: code="hi" appends " क्या".)
|
||||
//
|
||||
// The verb खाती है (khaati hai) is the feminine singular present form of खाना.
|
||||
// The base form supplied here is खाना; the engine will return base form
|
||||
// unless morphology-hi.el is loaded with full conjugation tables.
|
||||
//
|
||||
// Expected outputs (approximate):
|
||||
// assert: "बिल्ली खाना मछली." (SOV: subject-object-verb)
|
||||
// question: "बिल्ली खाना मछली क्या?" (SOV + क्या particle)
|
||||
|
||||
fn test_assert() -> String {
|
||||
// SOV: subject=बिल्ली (cat), verb=खाना (eat), patient=मछली (fish)
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "assert")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "बिल्ली")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "खाना")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "मछली")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "hi")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
// Hindi question: SOV statement order + क्या appended by realizer particle strategy
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "question")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "बिल्ली")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "खाना")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "मछली")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "hi")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
@@ -0,0 +1,73 @@
|
||||
// lang-ja.el - Japanese NLG tests: SOV assertion, question with か particle.
|
||||
//
|
||||
// Japanese is SOV, agglutinative, pro-drop. The realizer uses the "particle"
|
||||
// question strategy: statement order + sentence-final か.
|
||||
//
|
||||
// Grammatical relations are marked by postpositions embedded in the NP strings:
|
||||
// 猫が = cat (subject marker が)
|
||||
// 魚を = fish (object marker を)
|
||||
//
|
||||
// sem_to_spec maps: subject -> agent (GramSpec), object -> predicate or patient.
|
||||
// For "assert" with a transitive verb the object field carries the patient NP;
|
||||
// the predicate field carries the verb.
|
||||
//
|
||||
// Expected outputs (approximate):
|
||||
// assert: "猫が 食べる 魚を." — SOV order from gram_order_constituents
|
||||
// question: "猫が 食べる 魚を か?" — SOV + か particle
|
||||
|
||||
fn test_assert() -> String {
|
||||
// intent="assert", subject="猫が", obj="食べる" (verb in sem_to_spec predicate),
|
||||
// patient NP "魚を" passed as modifiers or encoded in subject.
|
||||
// Use the two-arg form: subject carries subject NP, obj carries the verb,
|
||||
// and we pass the object NP separately via a direct GramSpec build below.
|
||||
let frame: [String] = sem_frame_lang("assert", "猫が", "食べる", "", "ja")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
fn test_assert_with_object() -> String {
|
||||
// Build a GramSpec directly to supply subject, verb, and object NP together.
|
||||
// This mirrors how basic-sentence.el builds the form manually.
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "assert")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "猫が")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "食べる")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "魚を")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "ja")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
// Question: SOV order + か particle (realizer "particle" strategy for ja)
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "question")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "猫が")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "食べる")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "魚を")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "ja")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
println(test_assert_with_object())
|
||||
println(test_question())
|
||||
@@ -0,0 +1,14 @@
|
||||
// lang-la.el - Latin NLG tests
|
||||
// Expected: "Feles piscem edit." "Edit feles piscem?" "Feles magna est."
|
||||
fn test_assert() -> String {
|
||||
return sem_realize(sem_frame_lang("assert", "feles", "edere", "", "la"))
|
||||
}
|
||||
fn test_question() -> String {
|
||||
return sem_realize(sem_frame_lang("query", "feles", "edere", "", "la"))
|
||||
}
|
||||
fn test_description() -> String {
|
||||
return sem_realize(sem_frame_lang("describe", "feles", "magna", "", "la"))
|
||||
}
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_description())
|
||||
@@ -0,0 +1,14 @@
|
||||
// lang-non.el - Old Norse NLG tests
|
||||
// Expected: "maðr sér." / "maðr er sterkr."
|
||||
fn test_assert() -> String {
|
||||
return sem_realize(sem_frame_lang("assert", "madr", "sja", "", "non"))
|
||||
}
|
||||
fn test_question() -> String {
|
||||
return sem_realize(sem_frame_lang("query", "madr", "sja", "", "non"))
|
||||
}
|
||||
fn test_describe() -> String {
|
||||
return sem_realize(sem_frame_lang("describe", "madr", "sterkr", "", "non"))
|
||||
}
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_describe())
|
||||
@@ -0,0 +1,14 @@
|
||||
// lang-pi.el - Pali NLG tests
|
||||
// Expected: "puriso passati." / "puriso sundaro hoti."
|
||||
fn test_assert() -> String {
|
||||
return sem_realize(sem_frame_lang("assert", "puriso", "passati", "", "pi"))
|
||||
}
|
||||
fn test_question() -> String {
|
||||
return sem_realize(sem_frame_lang("query", "puriso", "passati", "", "pi"))
|
||||
}
|
||||
fn test_describe() -> String {
|
||||
return sem_realize(sem_frame_lang("describe", "puriso", "sundaro", "", "pi"))
|
||||
}
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_describe())
|
||||
@@ -0,0 +1,30 @@
|
||||
// lang-ru.el - Russian NLG tests: assertion, question (intonation), description.
|
||||
//
|
||||
// Russian has free word order (profiled as "free") and uses the intonation
|
||||
// question strategy — questions look identical to assertions except for "?".
|
||||
// Fusional morphology: кошка (nominative), рыбу (accusative).
|
||||
//
|
||||
// Expected outputs (approximate):
|
||||
// assert: "Кошка ест рыбу."
|
||||
// question: "Кошка ест рыбу?" (intonation — same order, different punctuation)
|
||||
// description: "Кошка большая."
|
||||
|
||||
fn test_assert() -> String {
|
||||
let frame: [String] = sem_frame_lang("assert", "кошка", "есть", "", "ru")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
// Russian intonation question: statement order + "?"
|
||||
let frame: [String] = sem_frame_lang("query", "кошка", "есть", "", "ru")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
fn test_description() -> String {
|
||||
let frame: [String] = sem_frame_lang("describe", "кошка", "большая", "", "ru")
|
||||
return sem_realize(frame)
|
||||
}
|
||||
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_description())
|
||||
@@ -0,0 +1,14 @@
|
||||
// lang-sa.el - Sanskrit NLG tests
|
||||
// Expected: "naraḥ paśyati." / "naraḥ sundaraḥ asti."
|
||||
fn test_assert() -> String {
|
||||
return sem_realize(sem_frame_lang("assert", "narah", "drs", "", "sa"))
|
||||
}
|
||||
fn test_question() -> String {
|
||||
return sem_realize(sem_frame_lang("query", "narah", "drs", "", "sa"))
|
||||
}
|
||||
fn test_describe() -> String {
|
||||
return sem_realize(sem_frame_lang("describe", "narah", "sundarah", "", "sa"))
|
||||
}
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
println(test_describe())
|
||||
@@ -0,0 +1,62 @@
|
||||
// lang-sw.el - Swahili NLG tests: SVO assertion with verb agreement prefix.
|
||||
//
|
||||
// Swahili is SVO, agglutinative, noun-class system. Subject agreement is
|
||||
// marked as a prefix on the verb: paka (cat, class M-WA) takes "a-" prefix.
|
||||
// "anakula" = a (3sg M-WA agreement) + na (present tense) + kula (eat).
|
||||
//
|
||||
// Questions use the intonation strategy — same SVO order with "?" punctuation.
|
||||
//
|
||||
// The verb surface form "anakula" is supplied as a pre-inflected form because
|
||||
// Swahili noun-class agreement is not yet in the morphology engine; when
|
||||
// morphology-sw.el loads full tables it will conjugate from "kula" + agreement.
|
||||
//
|
||||
// Expected outputs (approximate):
|
||||
// assert: "Paka anakula samaki." (SVO with verb agreement prefix)
|
||||
// question: "Paka anakula samaki?" (intonation — same order, ?)
|
||||
|
||||
fn test_assert() -> String {
|
||||
// SVO: subject=Paka (cat), verb=anakula (he/she-PRES-eat), object=samaki (fish)
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "assert")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "paka")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "anakula")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "samaki")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "sw")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
// Intonation question: SVO order unchanged, ? punctuation
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "question")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "paka")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "anakula")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "samaki")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "sw")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
@@ -0,0 +1,58 @@
|
||||
// lang-zh.el - Mandarin Chinese NLG tests: assertion, question with 吗.
|
||||
//
|
||||
// Mandarin is SVO, isolating (no morphological inflection). The verb surface
|
||||
// form is always the base form — morph_conjugate returns base for isolating
|
||||
// languages. Questions use the intonation strategy with "?" punctuation.
|
||||
//
|
||||
// Expected outputs (approximate):
|
||||
// assert: "猫 吃 鱼." (SVO, no inflection on verb 吃)
|
||||
// question: "猫 吃 鱼?" (intonation question — same order, ? instead of .)
|
||||
|
||||
fn test_assert() -> String {
|
||||
// Subject: 猫 (cat), verb: 吃 (eat), object: 鱼 (fish)
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "assert")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "猫")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "吃")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "鱼")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "zh")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
fn test_question() -> String {
|
||||
// Intonation question: same SVO order, ? punctuation
|
||||
// Note: 吗 (ma) is not appended by the engine in this version —
|
||||
// the intonation strategy simply adds "?" without a particle.
|
||||
let form: [String] = native_list_empty()
|
||||
let form = native_list_append(form, "intent")
|
||||
let form = native_list_append(form, "question")
|
||||
let form = native_list_append(form, "agent")
|
||||
let form = native_list_append(form, "猫")
|
||||
let form = native_list_append(form, "predicate")
|
||||
let form = native_list_append(form, "吃")
|
||||
let form = native_list_append(form, "patient")
|
||||
let form = native_list_append(form, "鱼")
|
||||
let form = native_list_append(form, "location")
|
||||
let form = native_list_append(form, "")
|
||||
let form = native_list_append(form, "tense")
|
||||
let form = native_list_append(form, "present")
|
||||
let form = native_list_append(form, "aspect")
|
||||
let form = native_list_append(form, "simple")
|
||||
let form = native_list_append(form, "lang")
|
||||
let form = native_list_append(form, "zh")
|
||||
return realize(form)
|
||||
}
|
||||
|
||||
println(test_assert())
|
||||
println(test_question())
|
||||
+46
-9
@@ -6,13 +6,16 @@
|
||||
# import system, the runner concatenates all NLG source modules above each
|
||||
# test file before handing it to elc.
|
||||
#
|
||||
# Module load order:
|
||||
# morphology.el (standalone)
|
||||
# vocabulary.el (standalone)
|
||||
# grammar.el (uses slot helpers)
|
||||
# realizer.el (uses morphology + grammar)
|
||||
# nlg.el (public API)
|
||||
# <test>.el (calls the above)
|
||||
# Module load order (mirrors manifest.el dependency order):
|
||||
# language-profile (no deps)
|
||||
# vocabulary (no deps)
|
||||
# morphology (depends on: language-profile)
|
||||
# morphology-XX (depends on: morphology) -- one per language
|
||||
# grammar (depends on: language-profile)
|
||||
# realizer (depends on: morphology, grammar, language-profile)
|
||||
# semantics (depends on: grammar, realizer, language-profile)
|
||||
# nlg (depends on: semantics, realizer)
|
||||
# <test>.el (calls the above)
|
||||
|
||||
set -uo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
@@ -27,10 +30,44 @@ if [ ! -x "${ELC}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# NLG source modules in dependency order
|
||||
# NLG source modules in manifest.el dependency order
|
||||
NLG_MODULES=(
|
||||
"${SRC_DIR}/morphology.el"
|
||||
"${SRC_DIR}/language-profile.el"
|
||||
"${SRC_DIR}/vocabulary.el"
|
||||
"${SRC_DIR}/morphology.el"
|
||||
# Living languages
|
||||
"${SRC_DIR}/morphology-es.el"
|
||||
"${SRC_DIR}/morphology-fr.el"
|
||||
"${SRC_DIR}/morphology-de.el"
|
||||
"${SRC_DIR}/morphology-ru.el"
|
||||
"${SRC_DIR}/morphology-ja.el"
|
||||
"${SRC_DIR}/morphology-fi.el"
|
||||
"${SRC_DIR}/morphology-ar.el"
|
||||
"${SRC_DIR}/morphology-hi.el"
|
||||
"${SRC_DIR}/morphology-sw.el"
|
||||
# Ancient / classical languages (still spoken or liturgical)
|
||||
"${SRC_DIR}/morphology-la.el"
|
||||
"${SRC_DIR}/morphology-he.el"
|
||||
# Dead languages
|
||||
"${SRC_DIR}/morphology-grc.el"
|
||||
"${SRC_DIR}/morphology-ang.el"
|
||||
"${SRC_DIR}/morphology-sa.el"
|
||||
"${SRC_DIR}/morphology-got.el"
|
||||
"${SRC_DIR}/morphology-non.el"
|
||||
"${SRC_DIR}/morphology-enm.el"
|
||||
"${SRC_DIR}/morphology-pi.el"
|
||||
"${SRC_DIR}/morphology-fro.el"
|
||||
"${SRC_DIR}/morphology-goh.el"
|
||||
"${SRC_DIR}/morphology-sga.el"
|
||||
"${SRC_DIR}/morphology-txb.el"
|
||||
"${SRC_DIR}/morphology-peo.el"
|
||||
"${SRC_DIR}/morphology-akk.el"
|
||||
"${SRC_DIR}/morphology-uga.el"
|
||||
"${SRC_DIR}/morphology-egy.el"
|
||||
"${SRC_DIR}/morphology-sux.el"
|
||||
"${SRC_DIR}/morphology-gez.el"
|
||||
"${SRC_DIR}/morphology-cop.el"
|
||||
# Higher layers
|
||||
"${SRC_DIR}/grammar.el"
|
||||
"${SRC_DIR}/realizer.el"
|
||||
"${SRC_DIR}/semantics.el"
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// test-akk.el - Akkadian morphology tests
|
||||
// Tests morph_conjugate dispatch for "akk", copula "bašû" (via "be"),
|
||||
// verb "alāku" (go), and morph_pluralize fallback.
|
||||
|
||||
fn test_akk() {
|
||||
let profile: [String] = lang_profile_akk()
|
||||
|
||||
// Copula "be" present 3sg -> "ibašši"
|
||||
let r1: String = morph_conjugate("be", "present", "third", "singular", profile)
|
||||
if !str_eq(r1, "ibašši") {
|
||||
println("FAIL: akk copula present 3sg: expected 'ibašši' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: akk copula present 3sg")
|
||||
}
|
||||
|
||||
// Copula "be" past 3sg -> "ibašši" (bašû has no separate past; present used)
|
||||
let r2: String = morph_conjugate("be", "past", "third", "singular", profile)
|
||||
if !str_eq(r2, "ibašši") {
|
||||
println("FAIL: akk copula past 3sg: expected 'ibašši' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: akk copula past 3sg")
|
||||
}
|
||||
|
||||
// "alāku" (to go) present 3sg -> "illak"
|
||||
let r3: String = morph_conjugate("alāku", "present", "third", "singular", profile)
|
||||
if !str_eq(r3, "illak") {
|
||||
println("FAIL: akk alaku present 3sg: expected 'illak' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: akk alaku present 3sg")
|
||||
}
|
||||
|
||||
// "alāku" past 1sg -> "allak" (no past/present distinction; present used)
|
||||
let r4: String = morph_conjugate("alāku", "past", "first", "singular", profile)
|
||||
if !str_eq(r4, "allak") {
|
||||
println("FAIL: akk alaku past 1sg: expected 'allak' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: akk alaku past 1sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: fusional fallback returns noun unchanged
|
||||
let r5: String = morph_pluralize("šarrum", profile)
|
||||
if !str_eq(r5, "šarrum") {
|
||||
println("FAIL: akk pluralize fallback: expected 'šarrum' got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: akk pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_akk()
|
||||
@@ -0,0 +1,51 @@
|
||||
// test-cop.el - Coptic (Sahidic) morphology tests
|
||||
// Tests morph_conjugate dispatch for "cop", copula "be" (zero copula in
|
||||
// present, ϣωπε otherwise), verb "bwk" (go), and morph_pluralize fallback.
|
||||
// NOTE: Coptic uses Greek + Demotic-derived letters; the El VM outputs
|
||||
// non-ASCII as numeric hashes. str_eq comparisons work correctly on UTF-8.
|
||||
|
||||
fn test_cop() {
|
||||
let profile: [String] = lang_profile_cop()
|
||||
|
||||
// Copula "be" present 3sg -> "" (zero copula — inherited from Egyptian)
|
||||
let r1: String = morph_conjugate("be", "present", "third", "singular", profile)
|
||||
if !str_eq(r1, "") {
|
||||
println("FAIL: cop copula present 3sg: expected '' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: cop copula present 3sg (zero copula)")
|
||||
}
|
||||
|
||||
// Copula "be" past 3sg -> "ⲁϥϣⲱⲡⲉ" (a-f-shwpe)
|
||||
let r2: String = morph_conjugate("be", "past", "third", "singular", profile)
|
||||
if !str_eq(r2, "ⲁϥϣⲱⲡⲉ") {
|
||||
println("FAIL: cop copula past 3sg: expected 'afshwpe' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: cop copula past 3sg")
|
||||
}
|
||||
|
||||
// "bwk" (to go) present 3sg -> "ϥⲃⲱⲕ" (f-bwk)
|
||||
let r3: String = morph_conjugate("bwk", "present", "third", "singular", profile)
|
||||
if !str_eq(r3, "ϥⲃⲱⲕ") {
|
||||
println("FAIL: cop bwk present 3sg: expected 'fbwk' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: cop bwk present 3sg")
|
||||
}
|
||||
|
||||
// "bwk" (to go) past 3sg -> "ⲁϥⲃⲱⲕ" (a-f-bwk)
|
||||
let r4: String = morph_conjugate("bwk", "past", "third", "singular", profile)
|
||||
if !str_eq(r4, "ⲁϥⲃⲱⲕ") {
|
||||
println("FAIL: cop bwk past 3sg: expected 'afbwk' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: cop bwk past 3sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: agglutinative fallback returns noun unchanged
|
||||
let r5: String = morph_pluralize("ⲣⲱⲙⲉ", profile)
|
||||
if !str_eq(r5, "ⲣⲱⲙⲉ") {
|
||||
println("FAIL: cop pluralize fallback: expected noun unchanged got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: cop pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_cop()
|
||||
@@ -0,0 +1,50 @@
|
||||
// test-egy.el - Ancient Egyptian (Middle Egyptian) morphology tests
|
||||
// Tests morph_conjugate dispatch for "egy", copula "wnn" (via "be"),
|
||||
// verb "mAA" (see), and morph_pluralize fallback.
|
||||
// NOTE: egy copula in present returns "" (zero copula).
|
||||
|
||||
fn test_egy() {
|
||||
let profile: [String] = lang_profile_egy()
|
||||
|
||||
// Copula "be" present 3sg -> "" (zero copula)
|
||||
let r1: String = morph_conjugate("be", "present", "third", "singular", profile)
|
||||
if !str_eq(r1, "") {
|
||||
println("FAIL: egy copula present 3sg: expected '' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: egy copula present 3sg (zero copula)")
|
||||
}
|
||||
|
||||
// Copula "be" past 3sg -> "wnn.n=f"
|
||||
let r2: String = morph_conjugate("be", "past", "third", "singular", profile)
|
||||
if !str_eq(r2, "wnn.n=f") {
|
||||
println("FAIL: egy copula past 3sg: expected 'wnn.n=f' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: egy copula past 3sg")
|
||||
}
|
||||
|
||||
// "mAA" (to see) present 3sg -> "mAA=f"
|
||||
let r3: String = morph_conjugate("mAA", "present", "third", "singular", profile)
|
||||
if !str_eq(r3, "mAA=f") {
|
||||
println("FAIL: egy mAA present 3sg: expected 'mAA=f' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: egy mAA present 3sg")
|
||||
}
|
||||
|
||||
// "mAA" past 3sg -> "mAA.n=f"
|
||||
let r4: String = morph_conjugate("mAA", "past", "third", "singular", profile)
|
||||
if !str_eq(r4, "mAA.n=f") {
|
||||
println("FAIL: egy mAA past 3sg: expected 'mAA.n=f' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: egy mAA past 3sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: agglutinative fallback returns noun unchanged
|
||||
let r5: String = morph_pluralize("nTr", profile)
|
||||
if !str_eq(r5, "nTr") {
|
||||
println("FAIL: egy pluralize fallback: expected 'nTr' got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: egy pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_egy()
|
||||
@@ -0,0 +1,49 @@
|
||||
// test-fro.el - Old French morphology tests
|
||||
// Tests morph_conjugate dispatch for "fro", copula "estre", verb "avoir",
|
||||
// and morph_pluralize fallback.
|
||||
|
||||
fn test_fro() {
|
||||
let profile: [String] = lang_profile_fro()
|
||||
|
||||
// Copula "be" present 3sg -> "est"
|
||||
let r1: String = morph_conjugate("be", "present", "third", "singular", profile)
|
||||
if !str_eq(r1, "est") {
|
||||
println("FAIL: fro copula present 3sg: expected 'est' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: fro copula present 3sg")
|
||||
}
|
||||
|
||||
// Copula "be" past 3sg -> "fu"
|
||||
let r2: String = morph_conjugate("be", "past", "third", "singular", profile)
|
||||
if !str_eq(r2, "fu") {
|
||||
println("FAIL: fro copula past 3sg: expected 'fu' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: fro copula past 3sg")
|
||||
}
|
||||
|
||||
// "avoir" (to have) present 1sg -> "ai"
|
||||
let r3: String = morph_conjugate("avoir", "present", "first", "singular", profile)
|
||||
if !str_eq(r3, "ai") {
|
||||
println("FAIL: fro avoir present 1sg: expected 'ai' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: fro avoir present 1sg")
|
||||
}
|
||||
|
||||
// "avoir" past 3sg -> "ot"
|
||||
let r4: String = morph_conjugate("avoir", "past", "third", "singular", profile)
|
||||
if !str_eq(r4, "ot") {
|
||||
println("FAIL: fro avoir past 3sg: expected 'ot' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: fro avoir past 3sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: fusional fallback returns noun unchanged
|
||||
let r5: String = morph_pluralize("mur", profile)
|
||||
if !str_eq(r5, "mur") {
|
||||
println("FAIL: fro pluralize fallback: expected 'mur' got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: fro pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_fro()
|
||||
@@ -0,0 +1,52 @@
|
||||
// test-gez.el - Ge'ez (Classical Ethiopic) morphology tests
|
||||
// Tests morph_conjugate dispatch for "gez", copula "be" (root kwn),
|
||||
// verb "hbl" (give), and morph_pluralize fallback.
|
||||
// NOTE: Ge'ez uses Ethiopic Fidel script; the El VM outputs non-ASCII as
|
||||
// numeric hashes, so str_eq comparisons are used internally (they work
|
||||
// correctly on UTF-8 byte equality).
|
||||
|
||||
fn test_gez() {
|
||||
let profile: [String] = lang_profile_gez()
|
||||
|
||||
// Copula "be" perfect 3sg m -> "ሆነ" (honä, base form)
|
||||
let r1: String = morph_conjugate("be", "perfect", "third", "singular", profile)
|
||||
if !str_eq(r1, "ሆነ") {
|
||||
println("FAIL: gez copula perfect 3sg: expected 'hona' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: gez copula perfect 3sg")
|
||||
}
|
||||
|
||||
// Copula "be" imperfect 3sg m -> "ይሆን" (yǝhon)
|
||||
let r2: String = morph_conjugate("be", "imperfect", "third", "singular", profile)
|
||||
if !str_eq(r2, "ይሆን") {
|
||||
println("FAIL: gez copula imperfect 3sg: expected 'yehon' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: gez copula imperfect 3sg")
|
||||
}
|
||||
|
||||
// "hbl" (to give) perfect 3sg m -> "ሰጠ" (säṭṭä)
|
||||
let r3: String = morph_conjugate("hbl", "perfect", "third", "singular", profile)
|
||||
if !str_eq(r3, "ሰጠ") {
|
||||
println("FAIL: gez hbl perfect 3sg: expected 'satta' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: gez hbl perfect 3sg")
|
||||
}
|
||||
|
||||
// "hbl" (to give) imperfect 3sg m -> "ይሰጥ" (yǝsäṭ)
|
||||
let r4: String = morph_conjugate("hbl", "imperfect", "third", "singular", profile)
|
||||
if !str_eq(r4, "ይሰጥ") {
|
||||
println("FAIL: gez hbl imperfect 3sg: expected 'yesat' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: gez hbl imperfect 3sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: semitic/agglutinative fallback returns noun unchanged
|
||||
let r5: String = morph_pluralize("ንጉሥ", profile)
|
||||
if !str_eq(r5, "ንጉሥ") {
|
||||
println("FAIL: gez pluralize fallback: expected noun unchanged got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: gez pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_gez()
|
||||
@@ -0,0 +1,49 @@
|
||||
// test-goh.el - Old High German morphology tests
|
||||
// Tests morph_conjugate dispatch for "goh", copula "wesan", verb "haben",
|
||||
// and morph_pluralize fallback.
|
||||
|
||||
fn test_goh() {
|
||||
let profile: [String] = lang_profile_goh()
|
||||
|
||||
// Copula "be" present 3sg -> "ist"
|
||||
let r1: String = morph_conjugate("be", "present", "third", "singular", profile)
|
||||
if !str_eq(r1, "ist") {
|
||||
println("FAIL: goh copula present 3sg: expected 'ist' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: goh copula present 3sg")
|
||||
}
|
||||
|
||||
// Copula "be" past 1sg -> "was"
|
||||
let r2: String = morph_conjugate("be", "past", "first", "singular", profile)
|
||||
if !str_eq(r2, "was") {
|
||||
println("FAIL: goh copula past 1sg: expected 'was' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: goh copula past 1sg")
|
||||
}
|
||||
|
||||
// "haben" present 3sg -> "habet"
|
||||
let r3: String = morph_conjugate("haben", "present", "third", "singular", profile)
|
||||
if !str_eq(r3, "habet") {
|
||||
println("FAIL: goh haben present 3sg: expected 'habet' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: goh haben present 3sg")
|
||||
}
|
||||
|
||||
// "haben" past 1sg -> "habeta"
|
||||
let r4: String = morph_conjugate("haben", "past", "first", "singular", profile)
|
||||
if !str_eq(r4, "habeta") {
|
||||
println("FAIL: goh haben past 1sg: expected 'habeta' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: goh haben past 1sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: fusional fallback returns noun unchanged
|
||||
let r5: String = morph_pluralize("tag", profile)
|
||||
if !str_eq(r5, "tag") {
|
||||
println("FAIL: goh pluralize fallback: expected 'tag' got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: goh pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_goh()
|
||||
@@ -0,0 +1,49 @@
|
||||
// test-peo.el - Old Persian morphology tests
|
||||
// Tests morph_conjugate dispatch for "peo", copula "ah-" (via "be"),
|
||||
// verb "kar" (do/make), and morph_pluralize fallback.
|
||||
|
||||
fn test_peo() {
|
||||
let profile: [String] = lang_profile_peo()
|
||||
|
||||
// Copula "be" present 3sg -> "astiy"
|
||||
let r1: String = morph_conjugate("be", "present", "third", "singular", profile)
|
||||
if !str_eq(r1, "astiy") {
|
||||
println("FAIL: peo copula present 3sg: expected 'astiy' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: peo copula present 3sg")
|
||||
}
|
||||
|
||||
// Copula "be" past 3sg -> "āha"
|
||||
let r2: String = morph_conjugate("be", "past", "third", "singular", profile)
|
||||
if !str_eq(r2, "āha") {
|
||||
println("FAIL: peo copula past 3sg: expected 'āha' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: peo copula past 3sg")
|
||||
}
|
||||
|
||||
// "kar" (to do) present 3sg -> "kunautiy"
|
||||
let r3: String = morph_conjugate("kar", "present", "third", "singular", profile)
|
||||
if !str_eq(r3, "kunautiy") {
|
||||
println("FAIL: peo kar present 3sg: expected 'kunautiy' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: peo kar present 3sg")
|
||||
}
|
||||
|
||||
// "kar" past 3sg -> "akunava"
|
||||
let r4: String = morph_conjugate("kar", "past", "third", "singular", profile)
|
||||
if !str_eq(r4, "akunava") {
|
||||
println("FAIL: peo kar past 3sg: expected 'akunava' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: peo kar past 3sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: fusional fallback returns noun unchanged
|
||||
let r5: String = morph_pluralize("martiya", profile)
|
||||
if !str_eq(r5, "martiya") {
|
||||
println("FAIL: peo pluralize fallback: expected 'martiya' got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: peo pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_peo()
|
||||
@@ -0,0 +1,49 @@
|
||||
// test-sga.el - Old Irish morphology tests
|
||||
// Tests morph_conjugate dispatch for "sga", copula "is" (via "be"),
|
||||
// verb "téit" (go), and morph_pluralize fallback.
|
||||
|
||||
fn test_sga() {
|
||||
let profile: [String] = lang_profile_sga()
|
||||
|
||||
// Copula "be" present 3sg -> "is"
|
||||
let r1: String = morph_conjugate("be", "present", "third", "singular", profile)
|
||||
if !str_eq(r1, "is") {
|
||||
println("FAIL: sga copula present 3sg: expected 'is' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: sga copula present 3sg")
|
||||
}
|
||||
|
||||
// Copula "be" past 3sg -> "ba"
|
||||
let r2: String = morph_conjugate("be", "past", "third", "singular", profile)
|
||||
if !str_eq(r2, "ba") {
|
||||
println("FAIL: sga copula past 3sg: expected 'ba' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: sga copula past 3sg")
|
||||
}
|
||||
|
||||
// "téit" (to go) present 3sg -> "téit"
|
||||
let r3: String = morph_conjugate("téit", "present", "third", "singular", profile)
|
||||
if !str_eq(r3, "téit") {
|
||||
println("FAIL: sga teit present 3sg: expected 'téit' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: sga teit present 3sg")
|
||||
}
|
||||
|
||||
// "téit" past 3sg -> "luid"
|
||||
let r4: String = morph_conjugate("téit", "past", "third", "singular", profile)
|
||||
if !str_eq(r4, "luid") {
|
||||
println("FAIL: sga teit past 3sg: expected 'luid' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: sga teit past 3sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: fusional fallback returns noun unchanged
|
||||
let r5: String = morph_pluralize("fer", profile)
|
||||
if !str_eq(r5, "fer") {
|
||||
println("FAIL: sga pluralize fallback: expected 'fer' got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: sga pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_sga()
|
||||
@@ -0,0 +1,50 @@
|
||||
// test-sux.el - Sumerian morphology tests
|
||||
// Tests morph_conjugate dispatch for "sux", copula "me" (via "be"),
|
||||
// verb "dug4" (say), and morph_pluralize fallback.
|
||||
// NOTE: sux copula 3sg present returns "" (zero copula).
|
||||
|
||||
fn test_sux() {
|
||||
let profile: [String] = lang_profile_sux()
|
||||
|
||||
// Copula "be" present 3sg -> "" (zero copula)
|
||||
let r1: String = morph_conjugate("be", "present", "third", "singular", profile)
|
||||
if !str_eq(r1, "") {
|
||||
println("FAIL: sux copula present 3sg: expected '' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: sux copula present 3sg (zero copula)")
|
||||
}
|
||||
|
||||
// Copula "be" present 1sg -> "me-en"
|
||||
let r2: String = morph_conjugate("be", "present", "first", "singular", profile)
|
||||
if !str_eq(r2, "me-en") {
|
||||
println("FAIL: sux copula present 1sg: expected 'me-en' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: sux copula present 1sg")
|
||||
}
|
||||
|
||||
// Copula "be" past 3sg -> "ba-me"
|
||||
let r3: String = morph_conjugate("be", "past", "third", "singular", profile)
|
||||
if !str_eq(r3, "ba-me") {
|
||||
println("FAIL: sux copula past 3sg: expected 'ba-me' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: sux copula past 3sg")
|
||||
}
|
||||
|
||||
// "dug4" (to say) present 3sg -> "e" (imperfective stem "e", no suffix for 3sg)
|
||||
let r4: String = morph_conjugate("dug4", "present", "third", "singular", profile)
|
||||
if !str_eq(r4, "e") {
|
||||
println("FAIL: sux dug4 present 3sg: expected 'e' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: sux dug4 present 3sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: agglutinative fallback returns noun unchanged
|
||||
let r5: String = morph_pluralize("lugal", profile)
|
||||
if !str_eq(r5, "lugal") {
|
||||
println("FAIL: sux pluralize fallback: expected 'lugal' got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: sux pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_sux()
|
||||
@@ -0,0 +1,49 @@
|
||||
// test-txb.el - Tocharian B morphology tests
|
||||
// Tests morph_conjugate dispatch for "txb", copula "wes",
|
||||
// verb "lyut" (see), and morph_pluralize fallback.
|
||||
|
||||
fn test_txb() {
|
||||
let profile: [String] = lang_profile_txb()
|
||||
|
||||
// Copula "be" present 3sg -> "ste"
|
||||
let r1: String = morph_conjugate("be", "present", "third", "singular", profile)
|
||||
if !str_eq(r1, "ste") {
|
||||
println("FAIL: txb copula present 3sg: expected 'ste' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: txb copula present 3sg")
|
||||
}
|
||||
|
||||
// Copula "be" present 1sg -> "wes"
|
||||
let r2: String = morph_conjugate("be", "present", "first", "singular", profile)
|
||||
if !str_eq(r2, "wes") {
|
||||
println("FAIL: txb copula present 1sg: expected 'wes' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: txb copula present 1sg")
|
||||
}
|
||||
|
||||
// Copula "be" past 3sg -> "wes" (txb only implements present; past returns stem)
|
||||
let r3: String = morph_conjugate("be", "past", "third", "singular", profile)
|
||||
if !str_eq(r3, "wes") {
|
||||
println("FAIL: txb copula past 3sg: expected 'wes' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: txb copula past 3sg")
|
||||
}
|
||||
|
||||
// "lyut" (to see) present 3sg -> "lyutem"
|
||||
let r4: String = morph_conjugate("lyut", "present", "third", "singular", profile)
|
||||
if !str_eq(r4, "lyutem") {
|
||||
println("FAIL: txb lyut present 3sg: expected 'lyutem' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: txb lyut present 3sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: fusional fallback returns noun unchanged
|
||||
let r5: String = morph_pluralize("walo", profile)
|
||||
if !str_eq(r5, "walo") {
|
||||
println("FAIL: txb pluralize fallback: expected 'walo' got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: txb pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_txb()
|
||||
@@ -0,0 +1,50 @@
|
||||
// test-uga.el - Ugaritic morphology tests
|
||||
// Tests morph_conjugate dispatch for "uga", copula "kn" (via "be"),
|
||||
// verb "hlk" (go), and morph_pluralize fallback.
|
||||
|
||||
fn test_uga() {
|
||||
let profile: [String] = lang_profile_uga()
|
||||
|
||||
// Copula "be" present 3sg -> "yakūnu" (imperfect, ya- prefix)
|
||||
let r1: String = morph_conjugate("be", "present", "third", "singular", profile)
|
||||
if !str_eq(r1, "yakūnu") {
|
||||
println("FAIL: uga copula present 3sg: expected 'yakūnu' got '" + r1 + "'")
|
||||
} else {
|
||||
println("PASS: uga copula present 3sg")
|
||||
}
|
||||
|
||||
// Copula "be" perfect 3sg -> "kāna"
|
||||
let r2: String = morph_conjugate("be", "perfect", "third", "singular", profile)
|
||||
if !str_eq(r2, "kāna") {
|
||||
println("FAIL: uga copula perfect 3sg: expected 'kāna' got '" + r2 + "'")
|
||||
} else {
|
||||
println("PASS: uga copula perfect 3sg")
|
||||
}
|
||||
|
||||
// "hlk" (to go) present 3sg -> "yahluku" (imperfect)
|
||||
let r3: String = morph_conjugate("hlk", "present", "third", "singular", profile)
|
||||
if !str_eq(r3, "yahluku") {
|
||||
println("FAIL: uga hlk present 3sg: expected 'yahluku' got '" + r3 + "'")
|
||||
} else {
|
||||
println("PASS: uga hlk present 3sg")
|
||||
}
|
||||
|
||||
// "hlk" perfect 3sg -> "halaka"
|
||||
let r4: String = morph_conjugate("hlk", "perfect", "third", "singular", profile)
|
||||
if !str_eq(r4, "halaka") {
|
||||
println("FAIL: uga hlk perfect 3sg: expected 'halaka' got '" + r4 + "'")
|
||||
} else {
|
||||
println("PASS: uga hlk perfect 3sg")
|
||||
}
|
||||
|
||||
// morph_pluralize: agglutinative fallback returns noun unchanged
|
||||
// (uga morph_type is "semitic" — falls through to unknown, returns noun)
|
||||
let r5: String = morph_pluralize("malku", profile)
|
||||
if !str_eq(r5, "malku") {
|
||||
println("FAIL: uga pluralize fallback: expected 'malku' got '" + r5 + "'")
|
||||
} else {
|
||||
println("PASS: uga pluralize fallback")
|
||||
}
|
||||
}
|
||||
|
||||
test_uga()
|
||||
Reference in New Issue
Block a user