Documentation
¶
Overview ¶
Package transcheck checks a translation of a line, from a model or a system engine: left untranslated, in the wrong script, without words, much shorter or longer than its source, repeating another line's translation, or Chinese in the other script (hanzi). The apps translate a line that fails one again on its own; the checks are the ones their subtitle and transcript translations share.
Lengths are compared in rough units of meaning (MeaningUnits): a CJK character is one, three letters or digits of another script are one.
Index ¶
- Constants
- func AsItIs(src string) bool
- func Checked(src, out, target string) (string, bool)
- func ChineseScript(tgt lang.Tag) string
- func CutShort(src, out string) bool
- func MeaningUnits(s string) float64
- func OtherHan(out string, tgt lang.Tag) bool
- func Repeats(src, out, otherSrc, other string) bool
- func Sentences(s string) int
- func ShortenedTooMuch(was, now string) bool
- func SplitSentences(s string) []string
- func ToScript(out string, tgt lang.Tag) string
- func TooLong(src, out string) bool
- func Untranslated(src, out string, tgt lang.Tag) bool
- func Wordless(src, out string) bool
- func WrongScript(src, out string, tgt lang.Tag) bool
Constants ¶
Repeats: a translation that repeats much of another line's (its word trigrams, OverlapShare of them at least) while their sources differ took that line's text: the model translated a context line, or the rest of the line before, under this line's id.
Variables ¶
This section is empty.
Functions ¶
func AsItIs ¶
AsItIs reports a line that may stand for its own translation when the model will not translate it: three words at most ("Sam.", "Google DeepMind.", "Mm-hmm."), names or interjections that read the same in any language.
func Checked ¶
Checked checks a translation another engine made (the system's) as the apps check a model's: Chinese is written in the target's script (the system sometimes answers Simplified Chinese in Traditional characters); ok is false when it is empty or the source left as it was in another script (an echo), unless the source is a short line that may stand as it is (AsItIs). A target lang.Parse does not know only needs a translation that is not empty.
func ChineseScript ¶
ChineseScript is the Chinese script a target writes, "Hans" or "Hant" (zh-TW, zh-Hant, yue-Hant), "" when it is not Chinese. Cantonese is Traditional as the table writes it ("yue": Hant).
func CutShort ¶
CutShort reports a translation that says much less than its source: a model that split one line's sentences over two ids (and dropped the next line) leaves each half far too short, and one that stopped at the first sentence of a line leaves it short too. The line is then translated again on its own. Lengths are compared in MeaningUnits.
func MeaningUnits ¶
MeaningUnits is how much s says, roughly: a Han, kana or Hangul character is one unit, three letters or digits of another script are one.
func OtherHan ¶
OtherHan reports whether a translation into tgt has a character only the other Chinese script writes (hanzi): a model asked for Simplified Chinese wrote Traditional, or the other way round.
func Repeats ¶
Repeats reports whether translation out (of source src) repeats the translation other of another line (of source otherSrc): it shares OverlapShare of its trigrams with it (or other with it), while the sources do not (a speaker saying the same thing twice).
func ShortenedTooMuch ¶
ShortenedTooMuch reports a shortened translation that kept less than a third of what it said: not a shorter way to say it, but another text.
func SplitSentences ¶
SplitSentences cuts a text after each sentence's final punctuation (as Sentences counts it).
func ToScript ¶
ToScript writes the characters of out that only the other Chinese script writes in tgt's script; out itself when tgt is not Chinese or out has none.
func TooLong ¶
TooLong reports a translation that says much more than its source: a model that put another line's text (the next one, or a context line) into this one. Lengths are compared as in CutShort; a short translation is never too long (names, interjections).
func Untranslated ¶
Untranslated reports whether a translation is the source left as it was although it is not written in the target's script (the model echoed it), or is written in another script than the target's while the source was too (the model rephrased it in the source language). A line already in the target language may come back the same: that is accepted.
Types ¶
This section is empty.