pub struct Word {
pub form: String,
pub lemma: String,
pub upostag: String,
pub xpostag: String,
pub feats: String,
pub deprel: String,
pub misc: String,
pub id: i32,
pub head: i32,
pub sentence_id: i32,
}Expand description
A parsed word from UDPipe with Universal Dependencies annotations.
Fields§
§form: StringThe surface form (actual text).
lemma: StringThe lemma (dictionary form).
upostag: StringUniversal POS tag (NOUN, VERB, ADJ, etc.).
xpostag: StringLanguage-specific POS tag.
feats: StringMorphological features (e.g., “VerbForm=Inf|Mood=Imp”).
deprel: StringDependency relation to head (root, nsubj, obj, etc.).
misc: StringMiscellaneous annotations (e.g., “SpaceAfter=No”).
id: i321-based index of this word within its sentence.
head: i32Index of the head word (0 = root).
sentence_id: i320-based index of the sentence this word belongs to.
Implementations§
Source§impl Word
impl Word
Sourcepub fn has_feature(&self, key: &str, value: &str) -> bool
pub fn has_feature(&self, key: &str, value: &str) -> bool
Returns true if this word has a specific morphological feature.
§Example
assert!(word.has_feature("Mood", "Imp"));Sourcepub fn get_feature(&self, key: &str) -> Option<&str>
pub fn get_feature(&self, key: &str) -> Option<&str>
Returns the value of a morphological feature, if present.
§Example
assert_eq!(word.get_feature("Mood"), Some("Imp"));Sourcepub fn is_adjective(&self) -> bool
pub fn is_adjective(&self) -> bool
Returns true if this word is an adjective (ADJ).
Sourcepub fn has_space_after(&self) -> bool
pub fn has_space_after(&self) -> bool
Returns true if there’s a space after this word.
In CoNLL-U format, SpaceAfter=No is only present when there’s no
space. This returns true (the default) when that annotation is
absent.