pub struct ForwardCenter {
pub entity_id: u64,
pub realization: String,
pub salience: f64,
pub grammatical_role: Option<GrammaticalRole>,
pub info_status: InformationStatus,
pub offset: usize,
}Expand description
A forward-looking center (member of Cf).
Represents an entity mentioned in an utterance, ranked by salience.
The Cf list for each utterance is sorted by effective_salience,
which combines the base salience with grammatical role and information status.
§Ranking Factors
Centering theory ranks Cf members by:
- Grammatical role: Subject > Object > Oblique (see
GrammaticalRole) - Information status: Evoked > Unused > Inferrable > New (see
InformationStatus) - Base salience: From external NER or mention detection scores
§Example
use anno::discourse::centering::{ForwardCenter, GrammaticalRole, InformationStatus};
let fc = ForwardCenter::new(1, "John", 0.9)
.with_role(GrammaticalRole::Subject)
.with_info_status(InformationStatus::Evoked);
// Effective salience combines all factors
assert!(fc.effective_salience() > 0.9);Fields§
§entity_id: u64Entity/cluster ID (links to coreference clusters).
realization: StringSurface realization (the mention text, e.g., “John”, “he”, “the CEO”).
salience: f64Base salience score (higher = more salient). Typically from NER confidence.
grammatical_role: Option<GrammaticalRole>Grammatical role in the utterance (affects Cf ranking).
info_status: InformationStatusInformation status (hearer-old vs hearer-new, affects Cf ranking).
offset: usizeCharacter offset in utterance (for span alignment).
Implementations§
Source§impl ForwardCenter
impl ForwardCenter
Sourcepub fn new(
entity_id: u64,
realization: impl Into<String>,
salience: f64,
) -> ForwardCenter
pub fn new( entity_id: u64, realization: impl Into<String>, salience: f64, ) -> ForwardCenter
Create a new forward center.
Sourcepub fn with_role(self, role: GrammaticalRole) -> ForwardCenter
pub fn with_role(self, role: GrammaticalRole) -> ForwardCenter
Set grammatical role.
Sourcepub fn with_info_status(self, status: InformationStatus) -> ForwardCenter
pub fn with_info_status(self, status: InformationStatus) -> ForwardCenter
Set information status.
Sourcepub fn at_offset(self, offset: usize) -> ForwardCenter
pub fn at_offset(self, offset: usize) -> ForwardCenter
Set character offset.
Sourcepub fn effective_salience(&self) -> f64
pub fn effective_salience(&self) -> f64
Compute effective salience including role and info status.
Trait Implementations§
Source§impl Clone for ForwardCenter
impl Clone for ForwardCenter
Source§fn clone(&self) -> ForwardCenter
fn clone(&self) -> ForwardCenter
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 ForwardCenter
impl Debug for ForwardCenter
Source§impl<'de> Deserialize<'de> for ForwardCenter
impl<'de> Deserialize<'de> for ForwardCenter
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ForwardCenter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ForwardCenter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ForwardCenter
impl PartialEq for ForwardCenter
Source§fn eq(&self, other: &ForwardCenter) -> bool
fn eq(&self, other: &ForwardCenter) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ForwardCenter
impl Serialize for ForwardCenter
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 StructuralPartialEq for ForwardCenter
Auto Trait Implementations§
impl Freeze for ForwardCenter
impl RefUnwindSafe for ForwardCenter
impl Send for ForwardCenter
impl Sync for ForwardCenter
impl Unpin for ForwardCenter
impl UnsafeUnpin for ForwardCenter
impl UnwindSafe for ForwardCenter
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