Documentation ¶
Index ¶
- Constants
- Variables
- func SetDebug(debug bool)
- type Language
- func (lg Language) Alpha2Digit(text string, relaxed bool, signed bool, ordinalThreshold int) string
- func (lg *Language) Normalize(word string) string
- func (lg *Language) NotNumericWord(word string) bool
- func (lg *Language) NumOrd(digits string, originalWord string) string
- func (lg *Language) Ord2Card(word string) string
- type LanguageCode
- type LookAhead
- type OrdinalsMerger
- type RelaxTuple
- type SubRegex
- type WordStreamValueParser
- type WordToDigitParser
Constants ¶
View Source
const UsePTOrdinalsMerger = true
Variables ¶
View Source
var DEBUG = false
View Source
var SegmentBreak = regexp.MustCompile(`\s*[\.,;\(\)…\[\]:!\?]+\s*`)
View Source
var (
WORDSEP = regexp.MustCompile(`\s*[\.,;\(\)…\[\]:!\?]+\s*|\n`)
)
Functions ¶
Types ¶
type Language ¶
type Language struct { LangCode LanguageCode Multipliers map[string]int Units map[string]int STens map[string]int MTens map[string]int MTensWSTens []string Hundred map[string]int MHundreds map[string]int Numbers map[string]int Sign map[string]string Zero []string DecimalSep string DecimalSYM string AndNums []string And string NeverIfAlone []string Relaxed map[string]RelaxTuple Simplify_check_coef_appliable bool // Optional RadMap map[string]string // Optional Composites map[string]int // Optional PtOrdinals map[string]string // Only for Portuguese IrrOrd map[string]RelaxTuple }
func NewLanguage ¶
func NewLanguage(LangCode LanguageCode) (*Language, error)
func (Language) Alpha2Digit ¶
func (*Language) NotNumericWord ¶
type LanguageCode ¶
type LanguageCode int
const ( Spanish LanguageCode = iota English Portuguese French Deutsch Russian Catalan )
type OrdinalsMerger ¶
type OrdinalsMerger struct{}
func NewOrdinalsMerger ¶
func NewOrdinalsMerger() *OrdinalsMerger
func (*OrdinalsMerger) MergeCompoundOrdinalsPT ¶
func (om *OrdinalsMerger) MergeCompoundOrdinalsPT(text string) string
type RelaxTuple ¶
type WordStreamValueParser ¶
type WordStreamValueParser struct { Skip string // contains filtered or unexported fields }
func NewWordStreamValueParser ¶
func NewWordStreamValueParser(lang Language, relaxed bool) *WordStreamValueParser
func (*WordStreamValueParser) GetValue ¶
func (w *WordStreamValueParser) GetValue() int
type WordToDigitParser ¶
type WordToDigitParser struct { Lang Language IntBuilder *WordStreamValueParser FracBuilder *WordStreamValueParser Signed bool InFrac bool Closed bool Open bool OrdinalThreshold int // contains filtered or unexported fields }
func NewWordToDigitParser ¶
func (*WordToDigitParser) GetValue ¶
func (w *WordToDigitParser) GetValue() string
Click to show internal directories.
Click to hide internal directories.