pub struct Sentence { /* private fields */ }Expand description
Builder for constructing sentences programmatically.
The verb is specified either by a simple tense (via .verb(word, Tense))
or a full verb form (via .form(VerbForm)). The latter unlocks richer
constructions like “has been renamed” (present perfect passive) or
“is being renamed” (present progressive passive).
Implementations§
Source§impl Sentence
impl Sentence
pub fn new() -> Self
Sourcepub fn verb(self, verb: &str, tense: Tense) -> Self
pub fn verb(self, verb: &str, tense: Tense) -> Self
Set the verb and its simple tense (Past / Present / Future).
Implies Aspect::Simple and Mood::Indicative. For richer forms
use Sentence::form.
Sourcepub fn form(self, form: VerbForm) -> Self
pub fn form(self, form: VerbForm) -> Self
Set the verb form (tense × aspect × mood) directly. Pair with
a verb set via Sentence::verb_word or a prior Sentence::verb.
Sourcepub fn verb_word(self, verb: &str) -> Self
pub fn verb_word(self, verb: &str) -> Self
Set just the verb word, leaving the existing form in place. Useful
when form(…) was used and a base verb is set separately.
Sourcepub fn voice(self, voice: Voice) -> Self
pub fn voice(self, voice: Voice) -> Self
Set the voice (default: Passive).
Voice::Passive: “The class Foo was renamed to Foobar”Voice::Active: “The class Foo renamed Foobar”
Sourcepub fn person(self, person: Person) -> Self
pub fn person(self, person: Person) -> Self
Set the grammatical person used to conjugate auxiliaries (default: Third).
Sourcepub fn preposition(self, prep: &str) -> Self
pub fn preposition(self, prep: &str) -> Self
Set the preposition connecting the verb to the object (default: “to” for passive).
e.g., .preposition("into") → “was converted into Bar”