eta.discourse.presubst

presubst(str)[source]

Prepare a string for calling the swap_duals function to avoid ungrammatical substitutions.

For example, in swapping dual pronouns, we want to avoid outputs such as “why do you say i are stupid”, while still correctly producing “why do you say your brothers are stupid”.

This function replaces “are” by “are2” when preceded or followed by “you”; similarly, it replaces

“were” by “were2” and “was” by “was2”.

It also replaces “you” by “you2” when it is the last word, or when it is not one of the first two

words and is not preceded by certain conjunctions (“and”, “or”, “but”, “that”, “because”, “if”,

“when”, “then”, “why”, …), or certain subordinating verbs (“think”, “believe”, “know”, …), or

when it follows “to”.

This is in preparation for replacement of “you2” by “me” (rather than “i”) when swap_duals is applied.