Skip to main content

Module spamcore

Module spamcore 

Source
Expand description

The seam to sioul-core’s spam module: the tokenizer, the header features and the reduced table, the same code the phone runs.

Training reads a corpus record as the Porch reads the message itself, by the same code: card_of makes the message again from what the record keeps (its header block; its MIME structure from BODYSTRUCTURE, part by part; the text and the HTML the Porch reads, in their places; every other part empty) and hands it to Card::from_bytes. So the card’s excerpt (the text part, the HTML read as text after a stand-in) and its shape (its text and HTML versions, its other parts’ names and types) are made by sioul-core’s own code, mail-parser sorting the parts. bodies asks the same parser, before the texts are downloaded, which parts they are.

Structs§

Lexicon 🔒
The words the tokenizer looks for (words::SpamWords) and the patterns made from them (see the module).
Meta 🔒
What the settings say of the training that made the table.
Table 🔒
The spam filter, folded (see the module’s documentation).

Constants§

FEATURES 🔒
The header features’ version, stamped in every table.
N 🔒
How many header features there are.
NAMES 🔒
Each feature’s name, in the order of features’ values.
TOKENIZER 🔒
The tokenizer’s version, stamped in every table (table.rs).

Functions§

all_header_words 🔒
Every word header_words can give, each with its feature’s place: what the classifier may have learned of the header facts.
bodies 🔒
Which parts of a structure are its text and HTML bodies, as mail-parser sorts them for the Porch: its first text body that is text, its first HTML body that is HTML (mail-parser lends one as the other when a message has only one).
card_of 🔒
The Porch’s card for a corpus record, made by Card::from_bytes from the message made again (see the module); its headers are the record’s own, MIME fields included.
features 🔒
The header features of a message: its card (headers, parts, text), its authentication results (auth_results, or the corpus’s own checks), when its provider received it (IMAP’s INTERNALDATE, the Maildir file’s time), the domains of its links (tokenize::tokens). A value it cannot know is f32::NAN (see the module).
header_words 🔒
The header facts as words, as the classifier reads them after the message’s own (table::Kind::Rows), each with its feature’s place in NAMES: a fact that holds, H: and its name in capitals; a number in a few bins (the Date an hour or more ahead; an hour or a day or more behind; no link, 1 to 3, 4 to 10, 11 or more; links elsewhere, half of them or more); a fact that does not hold, or is missing, none. No word of a message can be one of them: the tokenizer lowercases every word and splits on punctuation, and its own placeholders read _URL_; so no sender writes a header fact into a text.
numbered 🔒
Every part’s number in mail-parser’s order (each multipart before its parts): the leaves’ part numbers, none for the multiparts.
quoted 🔒
A quoted string’s inside: quotes and backslashes escaped, line ends out.
rebuild 🔒
A message made again from a record (see the module). Without a structure (a server that gave none), one part: the HTML if that is all there is, else the text.
token 🔒
A MIME token as written: no quote, space, control or separator.
tokens_with 🔒
The words of a message, and the domains its links point to, read with lexicon (a table’s own: table::Table::lexicon).
without_mime_fields 🔒
The header block without its MIME fields (Content-*, MIME-Version), which the message made again writes from its structure; lines end in CRLF.
word_hash 🔒
A word’s key in the table: FNV-1a, 64 bits, over its UTF-8 bytes.
write_part 🔒