I had an idea about discovering, encoding and reusing patterns in languages that I would like to share with the group.
The following is rough-draft pseudocode for a function with which to generate sentences for the verb “to kick”. The function has generic parameters for voice and tense and parameters for context, agent and patient.
Clause kick<V, T>(Context context, Noun agent, Noun patient)
{
switch(V)
{
case voice::active:
switch(T)
{
case tense::past:
case tense::present:
return join(" ", [
agent,
conjugate_en(“kick”, V, T, …),
“the”,
patient
]);
case tense::future:
return join(" ", [
agent,
“will”,
conjugate_en(“kick”, V, T, …),
“the”,
patient
]);
…
}
case voice::passive:
switch(T)
{
case tense::past:
return join(" ", [
“the”,
patient,
“was”,
conjugate_en(“kick”, V, T, …),
“by”
agent
]);
case tense::present:
return join(" ", [
“the”,
patient,
“is”,
“being”,
conjugate_en(“kick”, V, T, …),
“by”
agent
]);
…
}
}
}
and
kick<voice::active, tense::past>(context, Bobby, ball) returns “Bobby kicked the ball”.
In English, most combinations of tense, aspect, mood and voice are expressed periphrastically, using constructions with auxiliary verbs. After implementing a number of these for similar verbs, per the above example, we would notice a pattern. That pattern could be expressed as something resembling:
Clause pattern123<V, T>(Context context, Verb verb, Noun agent, Noun patient)
{
switch(V)
{
case voice::active:
switch(T)
{
case tense::past:
case tense::present:
return join(" ", [
agent,
conjugate_en(verb, V, T, …),
“the”,
patient
]);
case tense::future:
return join(" ", [
agent,
“will”,
conjugate_en(verb, V, T, …),
“the”,
patient
]);
…
}
case voice::passive:
switch(T)
{
case tense::past:
return join(" ", [
“the”,
patient,
“was”,
conjugate_en(verb, V, T, …),
“by”
agent
]);
case tense::present:
return join(" ", [
“the”,
patient,
“is”,
“being”,
conjugate_en(verb, V, T, …),
“by”
agent
]);
…
}
}
}
We could then simply express that the verb “to kick” is an instance of pattern pattern123 with something resembling:
Clause kick<V, T>(Context context, Noun agent, Noun patient)
{
pattern123<V, T>(context, new Verb(“kick”, …), agent, patient);
}
or
Clause kick<V, T>(Context context, Noun agent, Noun patient)
{
pattern123<V, T>(context, getVerb(“https://%E2%80%A6#kick%E2%80%9D), agent, patient);
}
and this pattern could be reused for a large number of verbs.
This use of patterns should extend to scenarios where there are more parameters for other thematically-related nouns:
Clause kick<V, T>(Context context, Noun agent, Noun patient, Noun instrument)
{
pattern1234<V, T>(context, new Verb(“kick”, …), agent, patient, instrument);
}
For English, there might be more generic parameters than those for voice and tense; we could add those for aspect and mood (e.g. pattern1234<V, T, A, M>(…)).
In conclusion, with generic programming and functions for conjugation and declension, we have expressiveness with which to discover, encode and reuse language-specific patterns.
Best regards, Adam Sobieski