pub struct EventMention {
pub trigger: String,
pub trigger_start: usize,
pub trigger_end: usize,
pub trigger_type: Option<String>,
pub arguments: Vec<(String, String)>,
pub confidence: Confidence,
pub polarity: EventPolarity,
pub tense: Option<EventTense>,
}Expand description
An event mention extracted from text.
Events are a key type of abstract antecedent. They have:
- A trigger word/phrase (usually a verb or event noun)
- Arguments (agent, patient, location, time, etc.)
- Type classification (attack, movement, creation, etc.)
§Research Background
Event extraction is a well-studied task (ACE, TAC-KBP, etc.). We use a simplified model focused on what’s needed for anaphora resolution.
§Example
Text: “Russia invaded Ukraine in February 2022”
use anno::discourse::EventMention;
let event = EventMention::new("invaded", 7, 14)
.with_trigger_type("attack")
.with_arguments(vec![
("Agent", "Russia"),
("Patient", "Ukraine"),
("Time", "February 2022"),
]);
assert_eq!(event.trigger, "invaded");
assert_eq!(event.trigger_type.as_deref(), Some("attack"));Fields§
§trigger: StringThe trigger word/phrase (e.g., “invaded”, “announced”)
trigger_start: usizeStart character offset of trigger
trigger_end: usizeEnd character offset of trigger
trigger_type: Option<String>Event type (e.g., “attack”, “movement”, “communication”)
arguments: Vec<(String, String)>Event arguments (role -> entity text) Common roles: Agent, Patient, Location, Time, Instrument
confidence: ConfidenceConfidence score for this event extraction
polarity: EventPolarityEvent polarity (positive, negative, uncertain)
tense: Option<EventTense>Event tense/aspect
Implementations§
Source§impl EventMention
impl EventMention
Sourcepub fn new(trigger: impl Into<String>, start: usize, end: usize) -> EventMention
pub fn new(trigger: impl Into<String>, start: usize, end: usize) -> EventMention
Create a new event mention.
Sourcepub fn with_trigger_type(self, trigger_type: impl Into<String>) -> EventMention
pub fn with_trigger_type(self, trigger_type: impl Into<String>) -> EventMention
Set the trigger type (event classification).
Sourcepub fn with_arguments<S>(self, args: Vec<(&str, S)>) -> EventMention
pub fn with_arguments<S>(self, args: Vec<(&str, S)>) -> EventMention
Add arguments to this event.
Sourcepub fn with_confidence(self, confidence: f64) -> EventMention
pub fn with_confidence(self, confidence: f64) -> EventMention
Set confidence score.
Sourcepub fn with_polarity(self, polarity: EventPolarity) -> EventMention
pub fn with_polarity(self, polarity: EventPolarity) -> EventMention
Set polarity.
Sourcepub fn with_tense(self, tense: EventTense) -> EventMention
pub fn with_tense(self, tense: EventTense) -> EventMention
Set tense.
Sourcepub fn get_argument(&self, role: &str) -> Option<&str>
pub fn get_argument(&self, role: &str) -> Option<&str>
Get argument by role.
Trait Implementations§
Source§impl Clone for EventMention
impl Clone for EventMention
Source§fn clone(&self) -> EventMention
fn clone(&self) -> EventMention
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventMention
impl Debug for EventMention
Source§impl<'de> Deserialize<'de> for EventMention
impl<'de> Deserialize<'de> for EventMention
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EventMention, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EventMention, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for EventMention
impl Serialize for EventMention
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,
Auto Trait Implementations§
impl Freeze for EventMention
impl RefUnwindSafe for EventMention
impl Send for EventMention
impl Sync for EventMention
impl Unpin for EventMention
impl UnsafeUnpin for EventMention
impl UnwindSafe for EventMention
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
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 more