Documentation
¶
Overview ¶
Package pytext follows Python's rules for text where they differ from Go's: the string and rounding rules the tone models' inputs were written by, and the way Python writes a value out with str(), repr() and json.dumps(), which is what a model reads when a prompt quotes one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dumps ¶ added in v1.3.0
Dumps rewrites a JSON document as Python's json.dumps(json.loads(raw), ensure_ascii=False) writes it: keys in their order, ", " and ": " between items, a number with a fraction or an exponent as a float.
func Float ¶ added in v1.3.0
Float is Python's repr of a float: the shortest digits that read back as f, written plainly from 1e-4 up to 1e16 with at least one decimal, and in exponent form outside it.
func IsSpace ¶
IsSpace reports whether r is whitespace to Python's str.isspace: Unicode's White_Space, and the four separators U+001C to U+001F, which Go leaves out.
func Repr ¶ added in v1.3.0
Repr is Python's repr(v) for a JSON-like value: None, True and False, a float as Python writes it (2.0, 1e-07), a string quoted, a list in brackets and a dict in braces. An ordered.Object is a dict in its own order; a Go map is a dict in key order, having no order of its own. Anything else is written as fmt.Sprint writes it.
func Round ¶
Round is Python's round(x, digits): the decimal nearest x, with a tie, which only an exact binary value can be, going to the even digit.
Types ¶
This section is empty.