// 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())
