Documentation
¶
Index ¶
- Variables
- func Contains(list []string, str string) bool
- func DecodeChineseToFloat64(cn string) (float64, error)
- func DecodeChineseToInt64(chinese string) (int64, error)
- func EncodeChineseFromFloat64(num float64) string
- func EncodeChineseFromInt64(num int64) string
- func Filter(s string, filter func(r rune) bool) string
- func HasEmpty(args ...string) bool
- func MustDecodeChineseToFloat64(cn string) float64
- func MustDecodeChineseToInt64(chinese string) int64
- func NotEmpty(args ...string) bool
- func Remove(strings []string, strs ...string) []string
- func Reverse(s string) string
- func Substr(str string, start int, stop int) (string, error)
- func TakeOne(valid, or string) string
- func TakeWithPriority(fns ...func() string) string
- func Union(first, second []string) []string
- type Replacer
- type Trie
- type TrieOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidStartPosition = errors.New("start position is invalid") ErrInvalidStopPosition = errors.New("stop position is invalid") )
Functions ¶
func DecodeChineseToFloat64 ¶
DecodeToFloat64 : decode a chinese number string into Float64
func DecodeChineseToInt64 ¶
DecodeToInt64 : decode a chinese number string into Int64
func EncodeChineseFromFloat64 ¶
EncodeFromFloat64 : convert float64 into Chinese number 由于float64固然存在的精度问题,本函数可能不会特别精准。所以小数部分最多精确到6位。
func EncodeChineseFromInt64 ¶
EncodeFromInt64 : convert int64 into Chinese number
func MustDecodeChineseToFloat64 ¶
MustDecodeToFloat64 : decode a chinese number string into Float64 without error
func MustDecodeChineseToInt64 ¶
MustDecodeToInt64 : decode a chinese number string into Int64 without error
func Substr ¶
Substr returns runes between start and stop [start, stop) regardless of the chars are ascii or utf8
func TakeWithPriority ¶
Types ¶
type Replacer ¶
func NewReplacer ¶
type Trie ¶
type Trie interface { Filter(text string) (string, []string, bool) FindKeywords(text string) []string }
func NewTrie ¶
func NewTrie(words []string, opts ...TrieOption) Trie
type TrieOption ¶
type TrieOption func(trie *trieNode)
func WithMask ¶
func WithMask(mask rune) TrieOption
Click to show internal directories.
Click to hide internal directories.