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())
|
||||
Reference in New Issue
Block a user