Documentation
¶
Index ¶
- Constants
- func CleanExistingFiles(dir string) error
- func CreateRuleFolders(baseDir string) error
- func EnsureDir(path string) error
- func NewScanner(path string) (*bufio.Scanner, *os.File, error)
- func NewWriter(path string) (*bufio.Writer, *os.File, error)
- func ParseTSVLine(line string) (string, string, bool)
- func WriteProbFile(path string, entries []ProbEntry) error
- type BaseStructure
- type Grammar
- type GrammarEntry
- type PTItem
- type PTNode
- type ProbEntry
- type ProbPair
- type Section
Constants ¶
View Source
const ( Alpha = "A" Digit = "D" Other = "O" Keyboard = "K" Context = "X" Year = "Y" Markov = "M" Cap = "C" Email = "E" Website = "W" )
TransitionID constants
Variables ¶
This section is empty.
Functions ¶
func CleanExistingFiles ¶
removes all files in a directory (not subdirectories)
func CreateRuleFolders ¶
creates the directory structure for a pcfg rule
func NewScanner ¶
returns a buffered scanner for the given file
func ParseTSVLine ¶
splits a tab-separated line into value and probability string
func WriteProbFile ¶
writes probability entries to a file in "value\tprob\n" format
Types ¶
type BaseStructure ¶
represents a base structure with its probability and replacement types
type Grammar ¶
type Grammar map[string][]GrammarEntry
maps transition type names to ordered slices of GrammarEntry
type GrammarEntry ¶
groups terminal values sharing the same probability
type ProbEntry ¶
stores a value, its probability, and count
func CounterToProbs ¶
converts a map[string]int counter to a probability-sorted list
Click to show internal directories.
Click to hide internal directories.