DictWordMetadata

Struct DictWordMetadata 

Source
pub struct DictWordMetadata {
Show 15 fields pub noun: Option<NounData>, pub pronoun: Option<PronounData>, pub verb: Option<VerbData>, pub adjective: Option<AdjectiveData>, pub adverb: Option<AdverbData>, pub conjunction: Option<ConjunctionData>, pub swear: Option<bool>, pub dialects: DialectFlags, pub orth_info: OrthFlags, pub determiner: Option<DeterminerData>, pub preposition: bool, pub common: bool, pub derived_from: Option<WordId>, pub np_member: Option<bool>, pub pos_tag: Option<UPOS>,
}
Expand description

This represents a “lexeme” or “headword” which is case-folded but affix-expanded. So not only lemmata but also inflected forms are stored here, with “horn” and “horns” each having their own lexeme, but “Ivy” and “ivy” sharing the same lexeme.

Fields§

§noun: Option<NounData>§pronoun: Option<PronounData>§verb: Option<VerbData>§adjective: Option<AdjectiveData>§adverb: Option<AdverbData>§conjunction: Option<ConjunctionData>§swear: Option<bool>§dialects: DialectFlags

The dialects this word belongs to. If no dialects are defined, it can be assumed that the word is valid in all dialects of English.

§orth_info: OrthFlags

Orthographic information: letter case, spaces, hyphens, etc.

§determiner: Option<DeterminerData>

Whether the word is a determiner.

§preposition: bool

Whether the word is a preposition.

§common: bool

Whether the word is considered especially common.

§derived_from: Option<WordId>§np_member: Option<bool>

Generated by a chunker

§pos_tag: Option<UPOS>

Generated by a POS tagger

Implementations§

Source§

impl DictWordMetadata

Source

pub fn infer_pos_tag(&self) -> Option<UPOS>

If there is only one possible interpretation of the metadata, infer its UPOS tag.

Source

pub fn or(&self, other: &Self) -> Self

Produce a copy of self with the known properties of other set.

Source

pub fn enforce_pos_exclusivity(&mut self, pos: &UPOS)

Given a UPOS tag, discard any metadata that would disagree with the given POS tag. For example, if the metadata suggests a word could either be a noun or an adjective, and we provide a UPOS::NOUN, this function will remove the adjective data.

Additionally, if the metadata does not currently declare the potential of the word to be the specific POS, it becomes so. That means if we provide a UPOS::ADJ to the function for a metadata whose Self::adjective = None, it will become Some.

Source

pub fn is_likely_homograph(&self) -> bool

Source

pub fn is_noun(&self) -> bool

Checks if the word is definitely a noun.

Source

pub fn is_proper_noun(&self) -> bool

Checks if the word is definitely a noun and more specifically is labeled as (a) proper.

Source

pub fn is_non_proper_noun(&self) -> bool

Checks if the word is definitely a noun and more specifically is labeled as not (a) proper.

Source

pub fn is_plural_noun(&self) -> bool

Checks if the word is definitely a noun and more specifically is labeled as (a) plural.

Source

pub fn is_non_plural_noun(&self) -> bool

Checks if the word is definitely a noun and more specifically is labeled as not (a) plural.

Source

pub fn is_mass_noun(&self) -> bool

Checks if the word is definitely a noun and more specifically is labeled as (a) mass.

Source

pub fn is_non_mass_noun(&self) -> bool

Checks if the word is definitely a noun and more specifically is labeled as not (a) mass.

Source

pub fn is_possessive_noun(&self) -> bool

Checks if the word is definitely a noun and more specifically is labeled as (a) possessive.

Source

pub fn is_non_possessive_noun(&self) -> bool

Checks if the word is definitely a noun and more specifically is labeled as not (a) possessive.

Source

pub fn is_pronoun(&self) -> bool

Checks if the word is definitely a pronoun.

Source

pub fn is_personal_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as (a) personal.

Source

pub fn is_non_personal_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as not (a) personal.

Source

pub fn is_singular_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as (a) singular.

Source

pub fn is_non_singular_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as not (a) singular.

Source

pub fn is_plural_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as (a) plural.

Source

pub fn is_non_plural_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as not (a) plural.

Source

pub fn is_possessive_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as (a) possessive.

Source

pub fn is_non_possessive_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as not (a) possessive.

Source

pub fn is_reflexive_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as (a) reflexive.

Source

pub fn is_non_reflexive_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as not (a) reflexive.

Source

pub fn is_subject_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as (a) subject.

Source

pub fn is_non_subject_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as not (a) subject.

Source

pub fn is_object_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as (a) object.

Source

pub fn is_non_object_pronoun(&self) -> bool

Checks if the word is definitely a pronoun and more specifically is labeled as not (a) object.

Source

pub fn is_determiner(&self) -> bool

Checks if the word is definitely a determiner.

Source

pub fn is_demonstrative_determiner(&self) -> bool

Checks if the word is definitely a determiner and more specifically is labeled as (a) demonstrative.

Source

pub fn is_non_demonstrative_determiner(&self) -> bool

Checks if the word is definitely a determiner and more specifically is labeled as not (a) demonstrative.

Source

pub fn is_possessive_determiner(&self) -> bool

Checks if the word is definitely a determiner and more specifically is labeled as (a) possessive.

Source

pub fn is_non_possessive_determiner(&self) -> bool

Checks if the word is definitely a determiner and more specifically is labeled as not (a) possessive.

Source

pub fn is_quantifier_determiner(&self) -> bool

Checks if the word is definitely a determiner and more specifically is labeled as (a) quantifier.

Source

pub fn is_non_quantifier_determiner(&self) -> bool

Checks if the word is definitely a determiner and more specifically is labeled as not (a) quantifier.

Source

pub fn is_verb(&self) -> bool

Checks if the word is definitely a verb.

Source

pub fn is_linking_verb(&self) -> bool

Checks if the word is definitely a verb and more specifically is labeled as (a) linking.

Source

pub fn is_non_linking_verb(&self) -> bool

Checks if the word is definitely a verb and more specifically is labeled as not (a) linking.

Source

pub fn is_auxiliary_verb(&self) -> bool

Checks if the word is definitely a verb and more specifically is labeled as (a) auxiliary.

Source

pub fn is_non_auxiliary_verb(&self) -> bool

Checks if the word is definitely a verb and more specifically is labeled as not (a) auxiliary.

Source

pub fn is_conjunction(&self) -> bool

Checks if the word is definitely a conjunction.

Source

pub fn is_adjective(&self) -> bool

Checks if the word is definitely a adjective.

Source

pub fn is_adverb(&self) -> bool

Checks if the word is definitely a adverb.

Source

pub fn is_manner_adverb(&self) -> bool

Checks if the word is definitely a adverb and more specifically is labeled as (a) manner.

Source

pub fn is_non_manner_adverb(&self) -> bool

Checks if the word is definitely a adverb and more specifically is labeled as not (a) manner.

Source

pub fn is_frequency_adverb(&self) -> bool

Checks if the word is definitely a adverb and more specifically is labeled as (a) frequency.

Source

pub fn is_non_frequency_adverb(&self) -> bool

Checks if the word is definitely a adverb and more specifically is labeled as not (a) frequency.

Source

pub fn is_degree_adverb(&self) -> bool

Checks if the word is definitely a adverb and more specifically is labeled as (a) degree.

Source

pub fn is_non_degree_adverb(&self) -> bool

Checks if the word is definitely a adverb and more specifically is labeled as not (a) degree.

Source

pub fn get_person(&self) -> Option<Person>

Source

pub fn is_first_person_plural_pronoun(&self) -> bool

Source

pub fn is_first_person_singular_pronoun(&self) -> bool

Source

pub fn is_third_person_plural_pronoun(&self) -> bool

Source

pub fn is_third_person_singular_pronoun(&self) -> bool

Source

pub fn is_third_person_pronoun(&self) -> bool

Source

pub fn is_second_person_pronoun(&self) -> bool

Source

pub fn is_verb_lemma(&self) -> bool

Source

pub fn is_verb_past_form(&self) -> bool

Source

pub fn is_verb_simple_past_form(&self) -> bool

Source

pub fn is_verb_past_participle_form(&self) -> bool

Source

pub fn is_verb_progressive_form(&self) -> bool

Source

pub fn is_verb_third_person_singular_present_form(&self) -> bool

Source

pub fn is_singular_noun(&self) -> bool

Source

pub fn is_non_singular_noun(&self) -> bool

Source

pub fn is_countable_noun(&self) -> bool

Source

pub fn is_non_countable_noun(&self) -> bool

Source

pub fn is_mass_noun_only(&self) -> bool

Source

pub fn is_nominal(&self) -> bool

Checks if the word is definitely nominal.

Source

pub fn is_singular_nominal(&self) -> bool

Checks if the word is definitely a nominal and more specifically is labeled as (a) singular.

Source

pub fn is_plural_nominal(&self) -> bool

Checks if the word is definitely a nominal and more specifically is labeled as (a) plural.

Source

pub fn is_possessive_nominal(&self) -> bool

Checks if the word is definitely a nominal and more specifically is labeled as (a) possessive.

Source

pub fn is_non_singular_nominal(&self) -> bool

Checks if the word is definitely a nominal and more specifically is labeled as not (a) singular.

Source

pub fn is_non_plural_nominal(&self) -> bool

Checks if the word is definitely a nominal and more specifically is labeled as not (a) plural.

Source

pub fn is_non_possessive_nominal(&self) -> bool

Checks if the word is definitely a nominal and more specifically is labeled as not (a) possessive.

Source

pub fn get_degree(&self) -> Option<Degree>

Source

pub fn is_comparative_adjective(&self) -> bool

Source

pub fn is_superlative_adjective(&self) -> bool

Source

pub fn is_positive_adjective(&self) -> bool

Source

pub fn is_quantifier(&self) -> bool

Source

pub fn is_swear(&self) -> bool

Checks whether a word is definitely a swear.

Source

pub fn is_lowercase(&self) -> bool

Does the metadata for this word cover an all-lowercase variant? (e.g., “hello”)

This returns true if all letters in the word are lowercase. Words containing non-letter characters (like numbers or symbols) are only considered if all letter characters are lowercase.

Source

pub fn is_titlecase(&self) -> bool

Does the metadata for this word cover a titlecase variant? (e.g., “Hello”)

This returns true if the word is in titlecase form, which means:

  • The first letter is uppercase
  • All other letters are lowercase
  • The word is at least 2 characters long

Examples: “Hello”, “World”

Note: Words with internal capital letters (like “McDonald”) or apostrophes (like “O’Reilly”) are not considered titlecase - they are classified as UPPER_CAMEL instead.

Source

pub fn is_allcaps(&self) -> bool

Does the metadata for this word cover an all-uppercase variant? (e.g., “HELLO”)

This returns true if all letters in the word are uppercase. Words containing non-letter characters (like numbers or symbols) are only considered if all letter characters are uppercase.

Examples: “HELLO”, “NASA”, “I”

Source

pub fn is_lower_camel(&self) -> bool

Does the metadata for this word cover a lower camel case variant? (e.g., “helloWorld”)

This returns true if the word is in lower camel case, which means:

  • The first letter is lowercase
  • There is at least one uppercase letter after the first character
  • The word must be at least 2 characters long

Examples: “helloWorld”, “getHTTPResponse”, “eBay”

Note: Single words that are all lowercase will return false. Words starting with an uppercase letter will return false (those would be UpperCamel).

Source

pub fn is_upper_camel(&self) -> bool

Does the metadata for this word cover an upper camel case / pascal case variant? (e.g., “HelloWorld”)

This returns true if the word is in upper camel case (also known as Pascal case), which means:

  • The first letter is uppercase
  • There is at least one other uppercase letter after the first character
  • There is at least one lowercase letter after the first uppercase letter
  • The word must be at least 3 characters long

Examples:

  • “HelloWorld” (standard Pascal case)
  • “McDonald” (name with internal caps)
  • “O’Reilly” (name with apostrophe and internal caps)
  • “HttpRequest” (initialism followed by word)

Note: Single words that are titlecase (like “Hello”) will return false. Words that are all uppercase (like “NASA”) will also return false.

Source

pub fn is_apostrophized(&self) -> bool

Does the metadata for this word cover an apostrophized variant? (e.g., “doesn’t”)

Source

pub fn is_roman_numerals(&self) -> bool

Source

pub fn append(&mut self, other: &Self) -> &mut Self

Same thing as Self::or, except in-place rather than a clone.

Trait Implementations§

Source§

impl Clone for DictWordMetadata

Source§

fn clone(&self) -> DictWordMetadata

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DictWordMetadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DictWordMetadata

Source§

fn default() -> DictWordMetadata

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DictWordMetadata

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for DictWordMetadata

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for DictWordMetadata

Source§

fn eq(&self, other: &DictWordMetadata) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for DictWordMetadata

Source§

fn partial_cmp(&self, other: &DictWordMetadata) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for DictWordMetadata

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for DictWordMetadata

Source§

impl StructuralPartialEq for DictWordMetadata

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> LSend for T
where T: ?Sized,