pub struct Options {
pub aliases: BTreeMap<String, String>,
pub min_confidence: Option<f32>,
pub rejections: Vec<Rejection>,
pub ontology: BTreeMap<String, String>,
}Expand description
Configuration for entity and relation extraction.
Fields§
§aliases: BTreeMap<String, String>Optional mapping from surface forms to canonical entity names. Example: { “Marcus”: “marcus_hale”, “Mr Marcus Hale”: “marcus_hale” } All mentions matching a key in this map resolve to the value.
IMPORTANT: the key’s own shape selects how it matches. A key carrying an
uppercase character is matched against the mention’s surface form
exactly, which is the capitalized run with . dropped as a separator:
“Mr Marcus Hale”, never “Mr. Marcus Hale”. A wholly lowercase key is a
lexicon entry instead: the phrase is searched for in the text as a
literal, word-bounded, case-insensitive match and becomes a mention of
the canonical name there, which is how “the detective” reaches a
referent no capitalized-run detector can see. A lexicon match that
overlaps a mention already detected is dropped, so a key can add a
mention but never replace one. A pronoun can take a lexicon mention as
its referent, and a pronoun the mention covers is replaced by it.
min_confidence: Option<f32>Minimum confidence threshold for returned candidates. Candidates below this score are filtered out. Default: 0.0 (all candidates returned).
rejections: Vec<Rejection>Candidates the caller has already judged wrong. A candidate whose (subject, relation, object) matches one of these is not emitted.
IMPORTANT: the crate persists nothing. This set is caller-owned state handed in per call, so where it is stored between runs, and for how long, stays the caller’s decision.
A rejection suppresses and does nothing else: it does not lower the confidence of a sibling candidate, and it does not weaken the rule that produced it. Feeding rejections back into scoring would make the output depend on a history the caller cannot see in the result, and the span and rule name are on every candidate precisely so a caller can audit why it fired.
ontology: BTreeMap<String, String>Optional mapping from recognized relation patterns to a caller-supplied controlled vocabulary. Example: { “loves”: “romantic_interest”, “is_married_to”: “spouse” } If a relation type is not in this map, the heuristic default is used.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Options
impl<'de> Deserialize<'de> for Options
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 TS for Options
impl TS for Options
Source§type WithoutGenerics = Options
type WithoutGenerics = Options
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 = Options
type OptionInnerType = Options
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