pub enum ResolutionStrategy {
Greedy,
Deferred,
Probabilistic,
Confident(u8),
}Expand description
Strategy for when to resolve uncertain references.
Different strategies trade off between:
- Accuracy: Waiting for more context improves accuracy
- Latency: Immediate resolution enables faster processing
- Memory: Maintaining distributions uses more memory
§Example
use anno::discourse::uncertain_reference::{
UncertainReference, ReferenceCandidate, ResolutionStrategy, resolve_uncertain,
};
let mut reference = UncertainReference::new("he");
reference.add_candidate(ReferenceCandidate::new(1, "John", 2.0));
reference.add_candidate(ReferenceCandidate::new(2, "Bill", 0.5));
// Greedy: resolve immediately
let greedy = ResolutionStrategy::Greedy;
assert!(greedy.should_resolve(&reference));
// Confident: only resolve if top candidate has >90% probability
let confident = ResolutionStrategy::Confident(90);
// With weights 2.0 and 0.5, softmax gives ~82% to John, so won't resolve
// (actual behavior depends on softmax computation)Variants§
Greedy
Resolve immediately to best candidate. Fast but may be inaccurate if context would help.
Deferred
Never resolve automatically; wait until forced. Use when downstream processing can handle uncertainty.
Probabilistic
Maintain full distribution; don’t commit to single candidate. Useful for probabilistic downstream processing.
Confident(u8)
Resolve only when top candidate probability exceeds threshold.
The threshold is a percentage (0-100).
E.g., Confident(90) resolves only if P(best) >= 90%.
Implementations§
Source§impl ResolutionStrategy
impl ResolutionStrategy
Sourcepub fn should_resolve(&self, reference: &UncertainReference) -> bool
pub fn should_resolve(&self, reference: &UncertainReference) -> bool
Should resolve now given the reference state?
Trait Implementations§
Source§impl Clone for ResolutionStrategy
impl Clone for ResolutionStrategy
Source§fn clone(&self) -> ResolutionStrategy
fn clone(&self) -> ResolutionStrategy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ResolutionStrategy
Source§impl Debug for ResolutionStrategy
impl Debug for ResolutionStrategy
Source§impl Default for ResolutionStrategy
impl Default for ResolutionStrategy
Source§fn default() -> ResolutionStrategy
fn default() -> ResolutionStrategy
Returns the “default value” for a type. Read more
impl Eq for ResolutionStrategy
Source§impl PartialEq for ResolutionStrategy
impl PartialEq for ResolutionStrategy
Source§fn eq(&self, other: &ResolutionStrategy) -> bool
fn eq(&self, other: &ResolutionStrategy) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ResolutionStrategy
Auto Trait Implementations§
impl Freeze for ResolutionStrategy
impl RefUnwindSafe for ResolutionStrategy
impl Send for ResolutionStrategy
impl Sync for ResolutionStrategy
impl Unpin for ResolutionStrategy
impl UnsafeUnpin for ResolutionStrategy
impl UnwindSafe for ResolutionStrategy
Blanket Implementations§
impl<T> Boilerplate for T
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
Converts
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>
Converts
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