use crate::*;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Verb {
pub head: String, pub particle: Option<String>, }
impl Verb {
pub fn new(head: impl Into<String>) -> Self {
Verb {
head: head.into(),
particle: None,
}
}
pub fn with_particle(mut self, particle: impl Into<String>) -> Self {
self.particle = Some(particle.into());
self
}
}
impl English {
pub fn third_person<T: Into<Verb>>(wordish: T) -> String {
English::verb(
wordish,
&Person::Third,
&Number::Singular,
&Tense::Present,
&Form::Finite,
)
}
pub fn past<T: Into<Verb>>(wordish: T) -> String {
English::verb(
wordish,
&Person::Third, &Number::Singular, &Tense::Past,
&Form::Finite,
)
}
pub fn present_participle<T: Into<Verb>>(wordish: T) -> String {
English::verb(
wordish,
&Person::First, &Number::Singular, &Tense::Present,
&Form::Participle,
)
}
pub fn past_participle<T: Into<Verb>>(wordish: T) -> String {
English::verb(
wordish,
&Person::First, &Number::Singular, &Tense::Past,
&Form::Participle,
)
}
pub fn infinitive<T: Into<Verb>>(wordish: T) -> String {
English::verb(
wordish,
&Person::First, &Number::Singular, &Tense::Present, &Form::Infinitive,
)
}
}
impl From<String> for Verb {
fn from(s: String) -> Self {
Verb {
head: s,
particle: None,
}
}
}
impl From<&String> for Verb {
fn from(s: &String) -> Self {
Verb {
head: s.clone(),
particle: None,
}
}
}
impl From<&str> for Verb {
fn from(s: &str) -> Self {
Verb {
head: s.to_string(),
particle: None,
}
}
}
impl From<&Verb> for Verb {
fn from(s: &Verb) -> Self {
s.clone()
}
}