Documentation
¶
Overview ¶
Package sentence composes the sentences Cartograph stores in parts.
A problem, a change and a programme's aim are written in the interface as two or three fields under their own headings, and the manifest holds exactly those fields. The sentence is an output: `<the groups> <situation>, because <cause>`. Nothing stores it, and everything that shows one — this server's renderer, the web interface, whatever the CLI grows — composes it the same way from the same inputs.
The rules are three, and each was a defect first:
- A part is a fragment under a heading; the sentence it builds starts with a capital and ends with a stop.
- A register's name reads as a phrase mid-clause ("so depot staff learn the same day"), not as the heading it is catalogued under.
- A clause never joins onto a full stop.
The composition also tolerates a part that names its own subject, which is what text written before the parts existed looks like: a situation already beginning with the group's name is not given a second one.
Index ¶
- func Aim(change, gain string) string
- func Change(what, who, gain string) string
- func Finish(s string) string
- func MidCase(name string) string
- func Problem(who, situation, cause string) string
- func SplitAim(s string) (change, gain string)
- func SplitChange(s string) (what, gain string)
- func SplitProblem(s string) (situation, cause string)
- func WhoPhrase(names []string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Change ¶
Change composes "<what>, so <who> <gain>". Until the gain is written the sentence stops at what will be true, rather than trailing off on a group name.
func Finish ¶
Finish returns a built sentence with a capital at the front and a stop at the end. A first word that is an acronym or carries an internal capital is left as written, since that is somebody's spelling rather than a fragment's, and a question or exclamation mark is deliberate.
func MidCase ¶
MidCase returns a name as it reads inside a clause: an ordinary capitalised word is lowered, an acronym or a name with an internal capital is left alone.
func Problem ¶
Problem composes "<who> <situation>, because <cause>". A subject with nothing said about it is not a clause, so a problem with no situation and no cause reads as nothing rather than as the group's name.
func SplitChange ¶
func SplitProblem ¶
SplitProblem and SplitChange recover the parts from a sentence stored before the parts existed. They are used once, by the legacy rewrite on read, and never by anything that edits: the subject cannot be separated from the situation without the group names, so it stays where it was written and the composition above leaves it alone.
Types ¶
This section is empty.