pub struct DictWordMetadata {Show 17 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 determiner: Option<DeterminerData>,
pub affix: Option<AffixData>,
pub preposition: bool,
pub swear: Option<bool>,
pub abbreviation: Option<bool>,
pub dialects: DialectFlags,
pub orth_info: OrthFlags,
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>The main parts of speech which have extra data.
pronoun: Option<PronounData>§verb: Option<VerbData>§adjective: Option<AdjectiveData>§adverb: Option<AdverbData>§conjunction: Option<ConjunctionData>§determiner: Option<DeterminerData>§affix: Option<AffixData>§preposition: boolParts of speech which don’t have extra data. Whether the word is a preposition.
swear: Option<bool>Whether the word is an offensive word.
abbreviation: Option<bool>Whether the word is an abbreviation of any kind.
dialects: DialectFlagsThe 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: OrthFlagsOrthographic information: letter case, spaces, hyphens, etc.
common: boolWhether the word is considered especially common.
derived_from: Option<WordId>§np_member: Option<bool>Generated by a chunker. Declares whether the word is a member of a nominal phrase. Using
this should be preferred over the similarly named Pattern.
For more details, see the announcement blog post.
pos_tag: Option<UPOS>Generated by a POS tagger. Declares what it inferred the word’s part of speech to be.
Implementations§
Source§impl DictWordMetadata
impl DictWordMetadata
Sourcepub fn infer_pos_tag(&self) -> Option<UPOS>
pub fn infer_pos_tag(&self) -> Option<UPOS>
If there is only one possible interpretation of the metadata, infer its UPOS tag.
Sourcepub fn or(&self, other: &Self) -> Self
pub fn or(&self, other: &Self) -> Self
Produce a copy of self with the known properties of other set.
Sourcepub fn enforce_pos_exclusivity(&mut self, pos: &UPOS)
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.
pub fn is_likely_homograph(&self) -> bool
Sourcepub fn difference(&self, other: &Self) -> u32
pub fn difference(&self, other: &Self) -> u32
How different is this word from another?
Sourcepub fn is_proper_noun(&self) -> bool
pub fn is_proper_noun(&self) -> bool
Checks if the word is definitely a noun and more specifically is labeled as (a) proper.
Sourcepub fn is_non_proper_noun(&self) -> bool
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.
Sourcepub fn is_plural_noun(&self) -> bool
pub fn is_plural_noun(&self) -> bool
Checks if the word is definitely a noun and more specifically is labeled as (a) plural.
Sourcepub fn is_non_plural_noun(&self) -> bool
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.
Sourcepub fn is_mass_noun(&self) -> bool
pub fn is_mass_noun(&self) -> bool
Checks if the word is definitely a noun and more specifically is labeled as (a) mass.
Sourcepub fn is_non_mass_noun(&self) -> bool
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.
Sourcepub fn is_possessive_noun(&self) -> bool
pub fn is_possessive_noun(&self) -> bool
Checks if the word is definitely a noun and more specifically is labeled as (a) possessive.
Sourcepub fn is_non_possessive_noun(&self) -> bool
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.
Sourcepub fn is_pronoun(&self) -> bool
pub fn is_pronoun(&self) -> bool
Checks if the word is definitely a pronoun.
Sourcepub fn is_personal_pronoun(&self) -> bool
pub fn is_personal_pronoun(&self) -> bool
Checks if the word is definitely a pronoun and more specifically is labeled as (a) personal.
Sourcepub fn is_non_personal_pronoun(&self) -> bool
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.
Sourcepub fn is_singular_pronoun(&self) -> bool
pub fn is_singular_pronoun(&self) -> bool
Checks if the word is definitely a pronoun and more specifically is labeled as (a) singular.
Sourcepub fn is_non_singular_pronoun(&self) -> bool
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.
Sourcepub fn is_plural_pronoun(&self) -> bool
pub fn is_plural_pronoun(&self) -> bool
Checks if the word is definitely a pronoun and more specifically is labeled as (a) plural.
Sourcepub fn is_non_plural_pronoun(&self) -> bool
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.
Sourcepub fn is_possessive_pronoun(&self) -> bool
pub fn is_possessive_pronoun(&self) -> bool
Checks if the word is definitely a pronoun and more specifically is labeled as (a) possessive.
Sourcepub fn is_non_possessive_pronoun(&self) -> bool
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.
Sourcepub fn is_reflexive_pronoun(&self) -> bool
pub fn is_reflexive_pronoun(&self) -> bool
Checks if the word is definitely a pronoun and more specifically is labeled as (a) reflexive.
Sourcepub fn is_non_reflexive_pronoun(&self) -> bool
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.
Sourcepub fn is_subject_pronoun(&self) -> bool
pub fn is_subject_pronoun(&self) -> bool
Checks if the word is definitely a pronoun and more specifically is labeled as (a) subject.
Sourcepub fn is_non_subject_pronoun(&self) -> bool
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.
Sourcepub fn is_object_pronoun(&self) -> bool
pub fn is_object_pronoun(&self) -> bool
Checks if the word is definitely a pronoun and more specifically is labeled as (a) object.
Sourcepub fn is_non_object_pronoun(&self) -> bool
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.
Sourcepub fn is_determiner(&self) -> bool
pub fn is_determiner(&self) -> bool
Checks if the word is definitely a determiner.
Sourcepub fn is_demonstrative_determiner(&self) -> bool
pub fn is_demonstrative_determiner(&self) -> bool
Checks if the word is definitely a determiner and more specifically is labeled as (a) demonstrative.
Sourcepub fn is_non_demonstrative_determiner(&self) -> bool
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.
Sourcepub fn is_possessive_determiner(&self) -> bool
pub fn is_possessive_determiner(&self) -> bool
Checks if the word is definitely a determiner and more specifically is labeled as (a) possessive.
Sourcepub fn is_non_possessive_determiner(&self) -> bool
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.
Sourcepub fn is_quantifier_determiner(&self) -> bool
pub fn is_quantifier_determiner(&self) -> bool
Checks if the word is definitely a determiner and more specifically is labeled as (a) quantifier.
Sourcepub fn is_non_quantifier_determiner(&self) -> bool
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.
Sourcepub fn is_linking_verb(&self) -> bool
pub fn is_linking_verb(&self) -> bool
Checks if the word is definitely a verb and more specifically is labeled as (a) linking.
Sourcepub fn is_non_linking_verb(&self) -> bool
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.
Sourcepub fn is_auxiliary_verb(&self) -> bool
pub fn is_auxiliary_verb(&self) -> bool
Checks if the word is definitely a verb and more specifically is labeled as (a) auxiliary.
Sourcepub fn is_non_auxiliary_verb(&self) -> bool
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.
Sourcepub fn is_conjunction(&self) -> bool
pub fn is_conjunction(&self) -> bool
Checks if the word is definitely a conjunction.
Sourcepub fn is_adjective(&self) -> bool
pub fn is_adjective(&self) -> bool
Checks if the word is definitely a adjective.
Sourcepub fn is_manner_adverb(&self) -> bool
pub fn is_manner_adverb(&self) -> bool
Checks if the word is definitely a adverb and more specifically is labeled as (a) manner.
Sourcepub fn is_non_manner_adverb(&self) -> bool
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.
Sourcepub fn is_frequency_adverb(&self) -> bool
pub fn is_frequency_adverb(&self) -> bool
Checks if the word is definitely a adverb and more specifically is labeled as (a) frequency.
Sourcepub fn is_non_frequency_adverb(&self) -> bool
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.
Sourcepub fn is_degree_adverb(&self) -> bool
pub fn is_degree_adverb(&self) -> bool
Checks if the word is definitely a adverb and more specifically is labeled as (a) degree.
Sourcepub fn is_non_degree_adverb(&self) -> bool
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.
Sourcepub fn get_person(&self) -> Option<Person>
pub fn get_person(&self) -> Option<Person>
Returns the grammatical person for personal pronouns.
Sourcepub fn is_first_person_plural_pronoun(&self) -> bool
pub fn is_first_person_plural_pronoun(&self) -> bool
Checks if the pronoun is both first-person and plural (we/us).
Sourcepub fn is_first_person_singular_pronoun(&self) -> bool
pub fn is_first_person_singular_pronoun(&self) -> bool
Checks if the pronoun is both first-person and singular (I/me).
Sourcepub fn is_third_person_plural_pronoun(&self) -> bool
pub fn is_third_person_plural_pronoun(&self) -> bool
Checks if the pronoun is both third-person and plural (they/them).
Sourcepub fn is_third_person_singular_pronoun(&self) -> bool
pub fn is_third_person_singular_pronoun(&self) -> bool
Checks if the pronoun is both third-person and singular (he/him/she/her/it).
Sourcepub fn is_third_person_pronoun(&self) -> bool
pub fn is_third_person_pronoun(&self) -> bool
Checks if the pronoun is third-person (he/him/she/her/it/they/them).
Sourcepub fn is_second_person_pronoun(&self) -> bool
pub fn is_second_person_pronoun(&self) -> bool
Checks if the pronoun is second-person (you).
Sourcepub fn is_verb_lemma(&self) -> bool
pub fn is_verb_lemma(&self) -> bool
Lemma is default if no verb form is specified in the dictionary
Sourcepub fn is_verb_past_form(&self) -> bool
pub fn is_verb_past_form(&self) -> bool
WARNING! This is intended for regular verb past form used for both preterite and past participle. WARNING! But for now it’s a bit fuzzy and may be missing from some regular verbs and may be WARNING! misapplied to some irregular verbs that happen to have the same form for preterite and WARNING! past participle such as “bought”, “caught”,
Sourcepub fn is_verb_preterite_and_participle_form(&self) -> bool
pub fn is_verb_preterite_and_participle_form(&self) -> bool
WARNING! This method was formerly named is_verb_regular_past_form and seems to have been an
WARNING! attempt to make a new method that achieved what is_verb_past_form above was intended
WARNING! to to achieve. But it fell into the trap mentioned above of assuming that only regular
WARNING! verbs had the same form for preterite and past participle, overlooking “bought”, “caught”, etc.
Sourcepub fn is_verb_simple_past_form(&self) -> bool
pub fn is_verb_simple_past_form(&self) -> bool
Checks if the verb is a simple past form, technically known as the “preterite” form.
WARNING! This should be working for irregular verbs but may not be working for regular verbs.
WARNING! e.g., it is more likely to match ate than walked for now.
Sourcepub fn is_verb_past_participle_form(&self) -> bool
pub fn is_verb_past_participle_form(&self) -> bool
Checks if the verb is a past participle form.
WARNING! This should be working for irregular verbs but may not be working for regular verbs.
WARNING! e.g., it is more likely to match eaten than walked for now.
Sourcepub fn is_verb_simple_past_only(&self) -> bool
pub fn is_verb_simple_past_only(&self) -> bool
Checks if the verb is only the simple past aka preterite form and not also marked as
past or past participle.
Sourcepub fn is_verb_past_participle_only(&self) -> bool
pub fn is_verb_past_participle_only(&self) -> bool
Checks if the verb is only the past participle form and not also marked as
past or preterite (aka simple past).
Sourcepub fn is_verb_progressive_form(&self) -> bool
pub fn is_verb_progressive_form(&self) -> bool
Checks if the verb is a progressive/continuous form (e.g., ends in “-ing”).
Sourcepub fn is_verb_third_person_singular_present_form(&self) -> bool
pub fn is_verb_third_person_singular_present_form(&self) -> bool
Checks if the verb is a third-person singular present form (e.g., “walks”).
Sourcepub fn is_singular_noun(&self) -> bool
pub fn is_singular_noun(&self) -> bool
Matches a noun either specifically marked as singular or not marked for number since singular is the default. Note that this will also match nouns which are both singular and plural such as “aircraft” or “sheep”.
Sourcepub fn is_non_singular_noun(&self) -> bool
pub fn is_non_singular_noun(&self) -> bool
Matches a noun that is neither specifically marked as singular nor unmarked for number since singular is the default. This will not match nouns which are both plural and singular such as “aircraft” or “sheep”.
Sourcepub fn is_countable_noun(&self) -> bool
pub fn is_countable_noun(&self) -> bool
Matches a noun either specifically marked as a count noun or not marked for countability since count is the default. This will match nouns which are both count and mass nouns such as “beer” and “property”.
Sourcepub fn is_non_countable_noun(&self) -> bool
pub fn is_non_countable_noun(&self) -> bool
Matches a noun that is neither specifically marked as a count noun nor unmarked for countability since countable is the default. This will not match nouns which are both count nouns and mass nouns such as “beer” or “property”.
Sourcepub fn is_singular_noun_only(&self) -> bool
pub fn is_singular_noun_only(&self) -> bool
Matches a noun either specifically marked as singular or not marked for number since singular is the default, but only if it is not also marked as plural. This will match nouns which are singular only like “balloon” or “cow” but not both singular and plural such as “aircraft” or “sheep”.
Sourcepub fn is_plural_noun_only(&self) -> bool
pub fn is_plural_noun_only(&self) -> bool
Matches a noun specifically marked as plural, but only if it is not also marked as singular. This will match nouns which are plural only like “cars” or “men” but not both singular and plural such as “aircraft” or “sheep”.
Sourcepub fn is_mass_noun_only(&self) -> bool
pub fn is_mass_noun_only(&self) -> bool
Most mass nouns also have countable senses. Match those that are only mass nouns. This will match nouns like “information” and “furniture” but not ones like “beer” or “property”.
Sourcepub fn is_nominal(&self) -> bool
pub fn is_nominal(&self) -> bool
Checks if the word is definitely nominal.
Sourcepub fn is_singular_nominal(&self) -> bool
pub fn is_singular_nominal(&self) -> bool
Checks if the word is definitely a nominal and more specifically is labeled as (a) singular.
Sourcepub fn is_plural_nominal(&self) -> bool
pub fn is_plural_nominal(&self) -> bool
Checks if the word is definitely a nominal and more specifically is labeled as (a) plural.
Sourcepub fn is_possessive_nominal(&self) -> bool
pub fn is_possessive_nominal(&self) -> bool
Checks if the word is definitely a nominal and more specifically is labeled as (a) possessive.
NOTE: possessive pronouns are not qualifiers, but words like mine, yours, etc.
The terminology of possessive noun, possessive pronoun and possessive determiner only
tends to reinforce this confusion.
Sourcepub fn is_non_singular_nominal(&self) -> bool
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.
Sourcepub fn is_non_plural_nominal(&self) -> bool
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.
pub fn get_degree(&self) -> Option<Degree>
pub fn is_comparative_adjective(&self) -> bool
pub fn is_superlative_adjective(&self) -> bool
pub fn is_positive_adjective(&self) -> bool
pub fn is_quantifier(&self) -> bool
Sourcepub fn is_abbreviation(&self) -> bool
pub fn is_abbreviation(&self) -> bool
Abbreviation is orthogonal to POS
Sourcepub fn is_lowercase(&self) -> bool
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.
Sourcepub fn is_titlecase(&self) -> bool
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.
Sourcepub fn is_allcaps(&self) -> bool
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”
Sourcepub fn is_lower_camel(&self) -> bool
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).
Sourcepub fn is_upper_camel(&self) -> bool
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.
Sourcepub fn is_apostrophized(&self) -> bool
pub fn is_apostrophized(&self) -> bool
Does the metadata for this word cover an apostrophized variant? (e.g., “doesn’t”)
pub fn is_roman_numerals(&self) -> bool
Trait Implementations§
Source§impl Clone for DictWordMetadata
impl Clone for DictWordMetadata
Source§impl Debug for DictWordMetadata
impl Debug for DictWordMetadata
Source§impl Default for DictWordMetadata
impl Default for DictWordMetadata
Source§impl<'de> Deserialize<'de> for DictWordMetadata
impl<'de> Deserialize<'de> for DictWordMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for DictWordMetadata
Source§impl Hash for DictWordMetadata
impl Hash for DictWordMetadata
Source§impl PartialEq for DictWordMetadata
impl PartialEq for DictWordMetadata
Source§impl PartialOrd for DictWordMetadata
impl PartialOrd for DictWordMetadata
Source§impl Serialize for DictWordMetadata
impl Serialize for DictWordMetadata
impl StructuralPartialEq for DictWordMetadata
Auto Trait Implementations§
impl Freeze for DictWordMetadata
impl RefUnwindSafe for DictWordMetadata
impl Send for DictWordMetadata
impl Sync for DictWordMetadata
impl Unpin for DictWordMetadata
impl UnsafeUnpin for DictWordMetadata
impl UnwindSafe for DictWordMetadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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