transcheck

package
v0.23.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const OverlapShare = 0.45

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

func AsItIs(src string) bool

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

func Checked(src, out, target string) (string, bool)

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

func ChineseScript(tgt lang.Tag) string

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

func CutShort(src, out string) bool

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

func MeaningUnits(s string) float64

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

func OtherHan(out string, tgt lang.Tag) bool

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

func Repeats(src, out, otherSrc, other string) bool

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 Sentences

func Sentences(s string) int

Sentences counts a text's sentences (its final punctuation; one at least).

func ShortenedTooMuch

func ShortenedTooMuch(was, now string) bool

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

func SplitSentences(s string) []string

SplitSentences cuts a text after each sentence's final punctuation (as Sentences counts it).

func ToScript

func ToScript(out string, tgt lang.Tag) string

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

func TooLong(src, out string) bool

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

func Untranslated(src, out string, tgt lang.Tag) bool

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.

func Wordless

func Wordless(src, out string) bool

Wordless reports a translation without a letter of a source that has words ("1", "}1": a model that wrote a line's number, or lost its place in the JSON).

func WrongScript

func WrongScript(src, out string, tgt lang.Tag) bool

WrongScript reports a translation without a letter of the target's script from a source in another one (English "translated" into English when Chinese was asked for).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL