pub enum MentionType {
Proper,
Nominal,
Pronominal,
Zero,
Unknown,
}Expand description
Type of referring expression in coreference.
This classification is fundamental to coreference resolution:
- Proper nouns are typically antecedents (first mention)
- Nominal mentions provide descriptive information
- Pronominal mentions require resolution to an antecedent
§Examples
use anno_core::types::MentionType;
let mention_type = MentionType::classify("John Smith");
assert_eq!(mention_type, MentionType::Proper);
let mention_type = MentionType::classify("the president");
assert_eq!(mention_type, MentionType::Nominal);
let mention_type = MentionType::classify("he");
assert_eq!(mention_type, MentionType::Pronominal);Variants§
Proper
Proper name (“John Smith”, “Microsoft”, “New York”)
Typically the first or canonical mention of an entity. Usually capitalized in English.
Also known as “Named” in NER terminology. Use MentionType::is_named()
or the MentionType::NAMED constant for compatibility with code
using that terminology.
Nominal
Common noun phrase (“the company”, “a dog”, “the president”)
Descriptive mentions that provide semantic information. May be definite (“the”) or indefinite (“a/an”).
Pronominal
Pronoun (“he”, “she”, “it”, “they”, “this”, “that”)
Anaphoric expressions that must be resolved to an antecedent. Includes personal, demonstrative, and relative pronouns.
Zero
Zero pronoun (pro-drop languages: Arabic, Spanish, Japanese, Korean, Chinese)
A dropped argument with no surface realization. The subject or object is grammatically required but omitted in the text. Common in:
- Arabic: verb conjugation encodes subject (“ذهب” = “[he] went”)
- Spanish: “Vino a casa” = “[He/She] came home”
- Japanese: topic/subject frequently omitted
- Chinese: arguments recoverable from context
Zero mentions have an anchor position (where they “would be”) but no text span. They carry phi-features (person, gender, number) from morphology or context.
Unknown
Unknown or unclassified mention type.
Implementations§
Source§impl MentionType
impl MentionType
Sourcepub const NAMED: MentionType = MentionType::Proper
pub const NAMED: MentionType = MentionType::Proper
Alias for MentionType::Proper using NER terminology.
In NER, “named entity” is the standard term. In coreference literature, “proper noun/name” is preferred. Both refer to the same concept.
Sourcepub fn is_named(&self) -> bool
pub fn is_named(&self) -> bool
Check if this is a named/proper mention.
Returns true for MentionType::Proper. This is an alias using
NER terminology for code that prefers “named” over “proper”.
Sourcepub fn classify(mention: &str) -> MentionType
pub fn classify(mention: &str) -> MentionType
Classify a mention string by its type.
Uses heuristics based on:
- Pronoun list matching
- Capitalization patterns
- Article presence
§Examples
use anno_core::types::MentionType;
assert_eq!(MentionType::classify("Barack Obama"), MentionType::Proper);
assert_eq!(MentionType::classify("the former president"), MentionType::Nominal);
assert_eq!(MentionType::classify("he"), MentionType::Pronominal);Sourcepub fn salience_weight(&self) -> f64
pub fn salience_weight(&self) -> f64
Get the typical salience weight for this mention type.
Proper nouns are most salient, pronouns and zeros least (they depend on context). Used in mention ranking algorithms.
Sourcepub fn can_introduce_entity(&self) -> bool
pub fn can_introduce_entity(&self) -> bool
Check if this mention type typically introduces new entities.
Proper nouns often introduce entities; pronouns and zeros almost never do.
Sourcepub fn requires_antecedent(&self) -> bool
pub fn requires_antecedent(&self) -> bool
Check if this mention type requires an antecedent.
Sourcepub fn has_surface_form(&self) -> bool
pub fn has_surface_form(&self) -> bool
Check if this mention type has a surface form in the text.
Returns false for zero pronouns (pro-drop).
Trait Implementations§
Source§impl Clone for MentionType
impl Clone for MentionType
Source§fn clone(&self) -> MentionType
fn clone(&self) -> MentionType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MentionType
impl Debug for MentionType
Source§impl Default for MentionType
impl Default for MentionType
Source§fn default() -> MentionType
fn default() -> MentionType
Source§impl<'de> Deserialize<'de> for MentionType
impl<'de> Deserialize<'de> for MentionType
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MentionType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MentionType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for MentionType
impl Display for MentionType
Source§impl FromStr for MentionType
impl FromStr for MentionType
Source§impl Hash for MentionType
impl Hash for MentionType
Source§impl Ord for MentionType
impl Ord for MentionType
Source§fn cmp(&self, other: &MentionType) -> Ordering
fn cmp(&self, other: &MentionType) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for MentionType
impl PartialEq for MentionType
Source§impl PartialOrd for MentionType
Ordering for MentionType based on canonical selection priority.
impl PartialOrd for MentionType
Ordering for MentionType based on canonical selection priority.
Order: Zero < Pronominal < Unknown < Nominal < Proper
This ordering is useful for canonical mention selection: when choosing a representative mention from a cluster, higher-ranked types are preferred. Proper nouns are most informative, zeros are least.
Source§impl Serialize for MentionType
impl Serialize for MentionType
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for MentionType
impl Eq for MentionType
impl StructuralPartialEq for MentionType
Auto Trait Implementations§
impl Freeze for MentionType
impl RefUnwindSafe for MentionType
impl Send for MentionType
impl Sync for MentionType
impl Unpin for MentionType
impl UnsafeUnpin for MentionType
impl UnwindSafe for MentionType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.