Documentation ¶
Index ¶
- func ExitIfError(prefix string, err error)
- func FileOrStdin(args []string, idx int) *os.File
- func FileOrStdout(args []string, idx int) *os.File
- func MustLoadClosedClass(filename string) model.ClosedClassSet
- func MustLoadSubstitutions(filename string) []words.Substitution
- type CitarConfig
- type Evaluator
- func (e *Evaluator) Accuracy() float64
- func (e *Evaluator) KnownAccuracy() float64
- func (e *Evaluator) KnownCorrect() uint
- func (e *Evaluator) KnownIncorrect() uint
- func (e *Evaluator) OverallCorrect() uint
- func (e *Evaluator) OverallIncorrect() uint
- func (e *Evaluator) Process(sent []conllx.Token) error
- func (e *Evaluator) UnknownAccuracy() float64
- func (e *Evaluator) UnknownCorrect() uint
- func (e *Evaluator) UnknownIncorrect() uint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExitIfError ¶
ExitIfError exits a program with a fatal error message, if // the supplied error is not nil.
func FileOrStdin ¶
FileOrStdin opens the file at the given index for reading when the index is valid. Otherwise, it returns os.Stdin.
func FileOrStdout ¶
FileOrStdout opens the file at the given index for writing when the index is valid. Otherwise, it returns os.Stdout.
func MustLoadClosedClass ¶
func MustLoadClosedClass(filename string) model.ClosedClassSet
func MustLoadSubstitutions ¶
func MustLoadSubstitutions(filename string) []words.Substitution
Types ¶
type CitarConfig ¶
type CitarConfig struct { Model string Substitutions string UnknownHandler string `toml:"unknown_handler"` }
CitarConfig stores the configuration of citar.
func MustParseConfig ¶
func MustParseConfig(filename string) *CitarConfig
MustParseConfig parses the given configuration file. If the file could not be parsed successfully, the process is exited with an error message.
func ParseConfig ¶
func ParseConfig(reader io.Reader) (*CitarConfig, error)
ParseConfig attempts to parse the configuration from the given reader.
func (CitarConfig) UnknownWordHandler ¶
func (c CitarConfig) UnknownWordHandler(m model.Model) (words.WordHandler, error)
UnknownWordHandler returns a word handler given the tagger configuration and a data model.
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
The Evaluator type is used to keep counts on the number of correctly/incorrectly tagged known/unknown tokens.
func NewEvaluator ¶
NewEvaluator creates an evaluator that uses the provided tagger and the corresponding model. The model is used to distinguish known and unknown tokens.
func (*Evaluator) KnownAccuracy ¶
KnownAccuracy returns the tagging accuracy of known words.
func (*Evaluator) KnownCorrect ¶
KnownCorrect returns the number of correctly tagged known words.
func (*Evaluator) KnownIncorrect ¶
KnownIncorrect returns the number of incorrectly tagged known words.
func (*Evaluator) OverallCorrect ¶
OverallCorrect returns the number of correctly tagged words.
func (*Evaluator) OverallIncorrect ¶
OverallIncorrect returns the number of incorrectly tagged words.
func (*Evaluator) Process ¶
Process a sentence, tagging it using the Evaluator's tagger and counting the number of tokens that were tagged correctly.
func (*Evaluator) UnknownAccuracy ¶
UnknownAccuracy returns the tagging accuracy of unknown words.
func (*Evaluator) UnknownCorrect ¶
UnknownCorrect returns the number of correctly tagged unknown words.
func (*Evaluator) UnknownIncorrect ¶
UnknownIncorrect returns the number of incorrectly tagged unknown words.