The sentence engine consists of three static methods:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kyomega85/EnglishMatrix/llms.txt
Use this file to discover all available pages before exploring further.
GenerateSentence, BuildEnglishVerb, and BuildSpanishVerb. Together they take a randomly selected subject, verb, and compatible complement and produce a complete bilingual sentence pair with tense label. The engine is used by all sentence generation modes, both quiz modes, and the tense table mode.
The sentence engine is purely functional — it reads from the static vocabulary lists (
subjects, verbsForSentences, complements, verbList, conjugaciones, places, times) and returns strings. It has no side effects and does not mutate any state. The same inputs will always produce the same output.SentenceMode enum
Produces a declarative sentence in the form
Subject + verb phrase + complement + place + time.Example: She eats tacos at home every day. / Ella come tacos en casa todos los días.Produces an interrogative sentence by placing the appropriate English auxiliary verb before the subject and appending
?. The Spanish output mirrors the question form using the same conjugated verb preceded by ¿.Example: Does she eat tacos at home every day? / ¿Ella come tacos en casa todos los días?GenerateSentence
GenerateSentence is the main entry point for all output modes. It orchestrates subject, verb, complement, place, and time selection and delegates verb conjugation to BuildEnglishVerb and BuildSpanishVerb.
When
true, a place expression from the places list is appended to the sentence with 50% probability (a rnd.Next(2) == 0 coin flip). Set to false to always omit place expressions.When
true, a time expression from the times list is appended with 50% probability. Set to false to always omit time expressions.Controls the sentence structure.
Normal produces a declarative sentence; Question produces an interrogative sentence with auxiliary inversion.When
null, the tense is selected randomly: (Tense)rnd.Next(7), giving each of the 7 tenses equal probability. When set to a specific Tense value, every sentence produced by this call uses that tense.(string english, string spanish) tuple. Each string is prefixed with the Spanish tense label in brackets, e.g. [Presente simple] She eats tacos at home. and [Presente simple] Ella come tacos en casa.
Selection logic (step by step)
- Subject: A random entry is picked from
subjects(22 entries). - Verb: A random entry is picked from
verbsForSentences(79 entries). - Tense:
forcedTenseis used if set; otherwise(Tense)rnd.Next(7). - Complement: If
verb.Accepts != "none", thecomplementslist is filtered to entries whoseTypematchesverb.Accepts(see Complement compatibility). A random compatible complement is chosen from the filtered list. If the list is empty, no complement is added. - Place: If
includePlaceistrueandrnd.Next(2) == 0, a random entry fromplaces(31 entries) is appended. - Time: If
includeTimeistrueandrnd.Next(2) == 0, a random entry fromtimes(36 entries) is appended. - English verb form:
BuildEnglishVerb(subject, verb.English, tense)is called. - Spanish verb form:
BuildSpanishVerb(subject, verb.English, tense)is called. - Assembly: For
Normalmode:"Subject verbPhrase complement place time."ForQuestionmode: auxiliary inversion is applied (see below).
Question mode — auxiliary inversion
InQuestion mode, the correct English auxiliary is selected per tense and placed before the subject:
PresentContinuous, PastContinuous, PresentPerfect), where the auxiliary is already embedded in engVerb, the engine strips the auxiliary from engVerb and uses only the participle/gerund component as the question verb:
"Aux Subject qVerb complement place time?"
BuildEnglishVerb
The English subject string (e.g.,
"I", "She", "The teacher"). Used to determine person/number for auxiliary selection.The bare English infinitive (e.g.,
"eat", "run"). Irregular forms are looked up via GetPast(), GetParticiple(), and GetGerund().The tense to build. One of the 7
Tense enum values."eats", "is eating", "ate", "was eating", "will eat", "has eaten", "would eat".
Tense-by-tense formation
| Tense | Return value | Notes |
|---|---|---|
PresentSimple | ConjugateEnglishPresent(subject, verb) | Applies -s/-es/-ies for 3rd-person singular; bare verb for all others |
PresentContinuous | "{be} {GetGerund(verb)}" | be = am/is/are based on subject |
PastSimple | GetPast(verb) | Looks up VerbEntry.Past; falls back to verb + "ed" if not found |
PastContinuous | "{was} {GetGerund(verb)}" | was for I/she/he/it and 3rd-person; were for we/they/you |
FutureSimple | "will {verb}" | Uniform across all subjects |
PresentPerfect | "{has/have} {GetParticiple(verb)}" | has for 3rd-person singular; have for all others |
Conditional | "would {verb}" | Uniform across all subjects |
Auxiliary selection for be
Auxiliary selection for was/were
Irregular form lookup helpers
GetPast(verb)— returnsVerbEntry.Pastorverb + "ed"as fallbackGetParticiple(verb)— returnsVerbEntry.Participleorverb + "ed"as fallbackGetGerund(verb)— returnsVerbEntry.Gerundorverb + "ing"as fallback
BuildSpanishVerb
conjugaciones dictionary as the primary source and falls back to programmatic conjugation when an entry is missing.
The English subject string. Used to determine person mapping:
"I" → yo (first singular), "we" → nosotros (first plural), all others → él/ella (third singular).The bare English infinitive, used as the key to look up
conjugaciones.The tense to build.
"como", "estoy comiendo", "comí", "estaba comiendo", "voy a comer", "he comido", "comería".
Person mapping
The engine uses only two boolean flags, derived directly from the English subject string:| English subject(s) | Mapped person | Fields used |
|---|---|---|
"I" | yo (1st singular) | YoPres, YoPast |
"We" | nosotros (1st plural) | NosPres, NosPast |
All others — "She", "He", "They", "You", "My mom", "The teacher", etc. | él/ella (3rd singular) | ElPres, ElPast |
"They" and "You" are not isNos — they fall through to the default ElPres/ElPast branch alongside all other non-"I", non-"We" subjects.
Tense-by-tense formation (when verb is in conjugaciones)
| Tense | yo | él/ella | nosotros |
|---|---|---|---|
PresentSimple | c.YoPres | c.ElPres | c.NosPres |
PresentContinuous | "estoy {gerund}" | "está {gerund}" | "estamos {gerund}" |
PastSimple | c.YoPast | c.ElPast | c.NosPast |
PastContinuous | "estaba {gerund}" | "estaba {gerund}" | "estábamos {gerund}" |
FutureSimple | "voy a {inf}" | "va a {inf}" | "vamos a {inf}" |
PresentPerfect | "he {participle}" | "ha {participle}" | "hemos {participle}" |
Conditional | BuildConditional(inf, isYo, isNos, conditionalStems) | — | — |
gerund = GetSpanishGerund(verb), inf = GetSpanishInfinitive(verb), and participle = GetSpanishPastParticiple(verb).
Spanish gerund computation (GetSpanishGerund)
Spanish past participle computation (GetSpanishPastParticiple)
Applies regular -ado/-ido endings and handles common irregular participles:
Fallback for missing conjugations
When a verb is not found inconjugaciones, BuildSpanishVerb constructs approximate Spanish forms directly from the Spanish infinitive’s ending:
conjugaciones entry. 35 verbs in verbList are currently affected — see Verb coverage gap for the full list.
Conditional stem changes
TheconditionalStems dictionary inside BuildSpanishVerb maps Spanish infinitives to their irregular conditional stems before the -ía/-íamos ending is applied:
BuildConditional applies the irregular stem if found, then appends the appropriate ending: