Documentation
¶
Overview ¶
Package push hands one item that the service holds straight to a program on this machine. psyche is the one such program. Its relate reads the item's parse, the findings of the scan that read it and, where asked, what the service derived from the parse, as one parse-input document on stdin.
Index ¶
Constants ¶
const ( FromQualityGate = "the quality gate" FromModelRead = "the model read" )
The stages that --enriched reads, as a person names them.
const Program = "psyche"
Program is the program that a push to psyche runs, found on PATH.
const SchemaVersion = 1
SchemaVersion is the version of psyche's parse-input schema that Write writes, the one that testdata/parse-input.schema.json holds.
Variables ¶
var ErrNoText = errors.New("the parse holds no text")
ErrNoText is a parse whose text is whitespace alone, which leaves psyche nothing to relate.
var ErrNotScanned = errors.New("no scan has read the parse")
ErrNotScanned is a parse that no scan has read, which a push never hands on.
Functions ¶
Types ¶
type Document ¶
type Document struct {
SchemaVersion int `json:"schema_version"`
Key string `json:"key"`
URL *string `json:"url"`
Title *string `json:"title"`
Zone store.Zone `json:"zone"`
MediaType string `json:"media_type"`
Extractor string `json:"extractor"`
ExtractorVersion string `json:"extractor_version"`
Text string `json:"text"`
Units []store.Unit `json:"units"`
RulesVersion *string `json:"rules_version"`
Findings []server.ParseFinding `json:"findings"`
Suggested []Suggestion `json:"suggested"`
Enriched *Enriched `json:"enriched,omitempty"`
}
Document is one parsed source as `psyche relate --parse` reads it.
type Enriched ¶
type Enriched struct {
Summary *string `json:"summary,omitempty"`
Idea *string `json:"idea,omitempty"`
Suggestion *string `json:"suggestion,omitempty"`
Genre *string `json:"genre,omitempty"`
Domains []string `json:"domains,omitempty"`
Themes []string `json:"themes,omitempty"`
Quality *int `json:"quality,omitempty"`
}
Enriched is what the service derived from the parse. Each field is absent where no stage answered it.
type Enrichment ¶
type Enrichment struct {
// Enriched is nil where no stage's answer could be read.
Enriched *Enriched
// From names each stage whose answer Enriched carries.
From []string
// Left says, in a sentence each, which part was left out and why.
Left []string
}
Enrichment is what --enriched adds to the document, and why each part that it leaves out is missing.
func Enrich ¶
func Enrich(item server.ItemAnswer) Enrichment
Enrich is what the service's current answers on item add: the quality gate's answer and the model read's summary and suggestion. The model read's sentence goes only where no scan finding lies over it, because psyche's document holds no place for a finding in it. The summary and the quality gate's words go unscanned. Each restates the source text, which psyche reads whole beside its findings.
type Suggestion ¶
type Suggestion struct {
Kind string `json:"kind"`
Text string `json:"text"`
Unit *int `json:"unit"`
}
Suggestion is one command, link or piece of code that the text suggests, from the scan's finding that matched it.