pub struct AggregateTriple {
pub subject: String,
pub relation: String,
pub object: String,
pub polarity: Polarity,
pub confidence: f32,
pub spans: Vec<[usize; 2]>,
pub rules: Vec<String>,
}Expand description
One fact as a whole document states it, with every piece of evidence for it.
TripleCandidate is per-sentence and extract_candidate_triples keeps the
highest-confidence one per triple, discarding the spans of the rest. An
aggregate keeps them: a passage stating one fact three ways yields one
aggregate carrying three spans.
Fields§
§subject: String§relation: String§object: String§polarity: PolarityWhether the document states this fact or denies it. A denial and the
assertion of the same triple are two aggregates, not one, because they
are two claims — and a document carrying both is the contradiction
find_conflicts reports.
confidence: f32The highest confidence of any supporting candidate.
IMPORTANT: repetition does not raise it, and spans.len() is the only
thing that reports corroboration. In fiction a restatement is not
independent evidence — an unreliable narrator restates a falsehood as
readily as a reliable one states a fact — so summing would let a
thrice-repeated lie outrank a once-stated fact, and averaging would
punish a strong statement for being echoed by a weaker phrasing. The
score answers “how good is the best evidence”, not “how much is there”.
spans: Vec<[usize; 2]>Every span the fact was found at, in document order. Never empty.
rules: Vec<String>The rules that produced those spans, first occurrence first, without repeats. Two spans from one rule name it once.
Trait Implementations§
Source§impl Clone for AggregateTriple
impl Clone for AggregateTriple
Source§impl Debug for AggregateTriple
impl Debug for AggregateTriple
Source§impl<'de> Deserialize<'de> for AggregateTriple
impl<'de> Deserialize<'de> for AggregateTriple
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for AggregateTriple
impl Serialize for AggregateTriple
Source§impl TS for AggregateTriple
impl TS for AggregateTriple
Source§type WithoutGenerics = AggregateTriple
type WithoutGenerics = AggregateTriple
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that
EXPORT_TO must be None. Read moreSource§type OptionInnerType = AggregateTriple
type OptionInnerType = AggregateTriple
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
Source§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export. Read more