pub struct AgreementFeatures {
pub gender: Gender,
pub number: Number,
pub case: Case,
pub definiteness: Definiteness,
pub animacy: Animacy,
pub person: AgreementPerson,
}Expand description
A bundle of grammatical agreement features for a named entity.
All fields default to their “unknown” / most-neutral variant so that English callers can ignore the struct entirely while non-English grammars consult it for gender, number, case, definiteness, animacy, and person.
§Example
use prosaic_core::agreement::{AgreementFeatures, Gender, Number, Definiteness};
let f = AgreementFeatures::new()
.with_gender(Gender::Fem)
.with_number(Number::Singular)
.with_definiteness(Definiteness::Definite);
assert_eq!(f.gender, Gender::Fem);
assert_eq!(f.number, Number::Singular);
assert_eq!(f.definiteness, Definiteness::Definite);Fields§
§gender: Gender§number: Number§case: Case§definiteness: Definiteness§animacy: Animacy§person: AgreementPersonImplementations§
Source§impl AgreementFeatures
impl AgreementFeatures
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new AgreementFeatures with all fields set to their defaults
(all Unknown / Third person). Equivalent to Default::default().
Sourcepub fn with_gender(self, g: Gender) -> Self
pub fn with_gender(self, g: Gender) -> Self
Set the gender axis.
Sourcepub fn with_number(self, n: Number) -> Self
pub fn with_number(self, n: Number) -> Self
Set the number axis.
Sourcepub fn with_definiteness(self, d: Definiteness) -> Self
pub fn with_definiteness(self, d: Definiteness) -> Self
Set the definiteness axis.
Sourcepub fn with_animacy(self, a: Animacy) -> Self
pub fn with_animacy(self, a: Animacy) -> Self
Set the animacy axis.
Sourcepub fn with_person(self, p: AgreementPerson) -> Self
pub fn with_person(self, p: AgreementPerson) -> Self
Set the person axis.
Trait Implementations§
Source§impl Clone for AgreementFeatures
impl Clone for AgreementFeatures
Source§fn clone(&self) -> AgreementFeatures
fn clone(&self) -> AgreementFeatures
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AgreementFeatures
impl Debug for AgreementFeatures
Source§impl Default for AgreementFeatures
impl Default for AgreementFeatures
Source§fn default() -> AgreementFeatures
fn default() -> AgreementFeatures
Returns the “default value” for a type. Read more
Source§impl PartialEq for AgreementFeatures
impl PartialEq for AgreementFeatures
Source§fn eq(&self, other: &AgreementFeatures) -> bool
fn eq(&self, other: &AgreementFeatures) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for AgreementFeatures
impl Eq for AgreementFeatures
impl StructuralPartialEq for AgreementFeatures
Auto Trait Implementations§
impl Freeze for AgreementFeatures
impl RefUnwindSafe for AgreementFeatures
impl Send for AgreementFeatures
impl Sync for AgreementFeatures
impl Unpin for AgreementFeatures
impl UnsafeUnpin for AgreementFeatures
impl UnwindSafe for AgreementFeatures
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more