pub struct Artifacts {
pub schema: u32,
pub producer: String,
pub created: String,
pub categories: Vec<CategoryRecord>,
pub gazetteer: Vec<Registration>,
pub relations: Vec<String>,
pub motifs: Vec<CategoryRecord>,
pub digests: BTreeMap<String, usize>,
pub training_examples: usize,
pub contains_document_text: Vec<String>,
/* private fields */
}Expand description
The complete set. Small, human-readable, and diffable on purpose — a vocabulary change should show up in review like any other change.
Fields§
§schema: u32§producer: Stringwhat produced this set: discovery for the offline path, or learn:<model> when a model proposed it
created: StringRFC3339 timestamp, or empty where no clock is available
categories: Vec<CategoryRecord>§gazetteer: Vec<Registration>Registered mentions: the surface as it appears in text, and the canonical token it resolves to.
A mapping rather than a list because registration NORMALISES — leading determiners and trailing status words are stripped, so several surfaces can share one token and their postings merge. Recording only the surfaces would drop that, and two variants of one entity would become two entities.
relations: Vec<String>relation verbs, canonical form
motifs: Vec<CategoryRecord>latent motifs, in the same shape as a category: a name and the terms that join it
digests: BTreeMap<String, usize>byte lengths of each written part, so a truncated set is detected on load
training_examples: usizeNumber of labelled examples written under training/, if any.
The count lives in the manifest but the examples do not, because they contain corpus text and the manifest is meant to be readable and committable.
contains_document_text: Vec<String>Parts of this set that contain verbatim document text. Always empty for the vocabulary files; lists
training/ when a finetuning set was written.
Recorded explicitly so a tool, a reviewer, or a CI check can tell which parts are safe to publish without having to know the layout by heart.
Implementations§
Source§impl Artifacts
impl Artifacts
Sourcepub fn new(
producer: impl Into<String>,
categories: Vec<CategoryRecord>,
gazetteer: Vec<Registration>,
relations: Vec<String>,
) -> Artifacts
pub fn new( producer: impl Into<String>, categories: Vec<CategoryRecord>, gazetteer: Vec<Registration>, relations: Vec<String>, ) -> Artifacts
Build a set from the parts an ingest produced.
Sourcepub fn with_training(self, jsonl: impl Into<String>) -> Artifacts
pub fn with_training(self, jsonl: impl Into<String>) -> Artifacts
Attach a finetuning set: JSONL lines, one labelled passage each.
This is the one part of an artefact set that carries document text — a span label is meaningless
without the words it points at. It is therefore written to a subdirectory, recorded in
contains_document_text, and excluded by a .gitignore that Artifacts::save writes, so committing
the artefact directory does not commit the corpus by accident.
Sourcepub fn training(&self) -> Option<&str>
pub fn training(&self) -> Option<&str>
The finetuning set, if this build of the artefacts carries one in memory.
Sourcepub fn with_motifs(self, motifs: Vec<CategoryRecord>) -> Artifacts
pub fn with_motifs(self, motifs: Vec<CategoryRecord>) -> Artifacts
Write the set to dir, creating it if needed.
Each part is written separately so a reviewer sees a small, meaningful diff rather than one large blob.
Record the discovered motifs, so a reload projects the same motif/* tokens discovery did.
pub fn save(&self, dir: impl AsRef<Path>) -> Result<(), ArtifactError>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Artifacts
impl<'de> Deserialize<'de> for Artifacts
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>,
Auto Trait Implementations§
impl Freeze for Artifacts
impl RefUnwindSafe for Artifacts
impl Send for Artifacts
impl Sync for Artifacts
impl Unpin for Artifacts
impl UnsafeUnpin for Artifacts
impl UnwindSafe for Artifacts
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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