Documentation
¶
Index ¶
- Constants
- func ConnectProfile(c *Config, suffix string) apoco.StreamFunc
- func E(str string) string
- func EachStok(r io.Reader, f func(string, Stok)) error
- func IDFromFilePath(path, fg string) string
- func UpdateBool(key *bool, val bool)
- func UpdateInConfig(dest, val interface{})
- func UpdateInt(key *int, val int)
- func UpdateString(key *string, val string)
- type Config
- type DMSettings
- type MRGSettings
- type MSSettings
- type Piper
- type Stok
- type StokCause
- type StokType
- type TrainingSettings
Constants ¶
const ( Cautious string = "cautious" Courageous string = "courageous" Redundant string = "redundant" )
const Epsilon = "ε"
Epsilon is used to mark empty strings and slices in the IO of stoks.
const PStep = "recognition/post-correction"
PStep defines the OCR-D processing step.
const Version = "v0.0.51"
Version defines the version of apoco.
Variables ¶
This section is empty.
Functions ¶
func ConnectProfile ¶ added in v0.0.37
func ConnectProfile(c *Config, suffix string) apoco.StreamFunc
ConnectProfile generates the profile by running the profiler or reads the profile from the cache and connects the profile with the tokens.
func EachStok ¶ added in v0.0.42
EachStok calls the given callback function f for each token read from r with the according name. Stokens are read line by line from the reader, lines starting with # are skipped. If a line starting with '#name=x' is encountered the name for the callback function is updated accordingly.
func IDFromFilePath ¶
IDFromFilePath generates an id based on the file group and the file path.
func UpdateBool ¶ added in v0.0.46
func UpdateInConfig ¶ added in v0.0.46
func UpdateInConfig(dest, val interface{})
UpdateInConfig updates the value in dest with val if the according value is not the zero-type for the underlying type.
func UpdateString ¶ added in v0.0.46
Types ¶
type Config ¶ added in v0.0.29
type Config struct { Model string `json:"model,omitempty"` Ngrams string `json:"ngrams"` ProfilerBin string `json:"profilerBin"` ProfilerConfig string `json:"profilerConfig"` RR TrainingSettings `json:"rr"` DM DMSettings `json:"dm"` MS MSSettings `json:"ms"` Nocr int `json:"nocr"` Cache bool `json:"cache"` GT bool `json:"gt"` AlignLev bool `json:"alignLev"` }
Config defines the command's configuration.
func ReadConfig ¶ added in v0.0.29
ReadConfig reads the config from a json or toml file. If the name is empty, an empty configuration file is returned. If name has the prefix '{' and the suffix '}' the name is interpreted as a json string and parsed accordingly (OCR-D compability).
type DMSettings ¶ added in v0.0.37
type DMSettings struct { TrainingSettings Filter string `json:"filter"` // cautious, courageous or redundant }
DMSettings encloses settings for dm training.
type MRGSettings ¶ added in v0.0.49
type MRGSettings struct { TrainingSettings Window int `json:"window"` }
MRGSettings are the settings for the mrg training.
type MSSettings ¶ added in v0.0.46
type MSSettings struct { TrainingSettings Window int `json:"window"` }
MSSettings are the settings for the mrg training.
type Stok ¶ added in v0.0.21
type Stok struct {
OCR, Sug, GT, ID string
OCRConfs []float64
Conf float64
Rank int
Skipped, Short, Lex, Cor bool
}
Stok represents a stats token. Stat tokens explain the correction decisions of apoco and form the basis of the correction protocols.
func MakeStok ¶ added in v0.0.21
MakeStok creates a new stats token from a according formatted line.
func (Stok) Cause ¶ added in v0.0.27
Cause returns the cause of a correction error. There are 3 possibilities. Either the correction candidate was missing, the correct correction candidate was not selected by the reranker or the correct correction canidate would have been available but could not be selected because of the imposed limit of the number of correction candidates. If the limit smaller or equal to 0, no limit is imposed.
type StokType ¶ added in v0.0.27
type StokType int
StokType gives the type of stoks.
const ( SkippedShort StokType = iota // Skipped short token. SkippedShortErr // Error in short token. SkippedNoCand // Skipped no canidate token. SkippedNoCandErr // Error in skipped no candidate token. SkippedLex // Skipped lexical token. FalseFriend // Error in skipped lexical token (false friend). RedundantCorrection // Redundant correction. InfelicitousCorrection // Infelicitous correction. SuccessfulCorrection // Successful correction. DoNotCareCorrection // Do not care correction. SuspiciousNotReplacedCorrect // Accept OCR. DodgedBullet // Dogded bullet. MissedOpportunity // Missed opportunity. SuspiciousNotReplacedNotCorrectErr // Skipped do not care. )
type TrainingSettings ¶ added in v0.0.37
type TrainingSettings struct { Features []string `json:"features"` LearningRate float64 `json:"learningRate"` Ntrain int `json:"ntrain"` }
TrainingSettings encloses different training settings.