Documentation
¶
Index ¶
- Variables
- func DefaultStopWords() []string
- func NewPaginator(txt string, opts ...WrapOpt) *pages.Pages[string]
- func NewTTF(src []byte, opts *opentype.FaceOptions) (font.Face, error)
- func NoopNormalizer(str string) string
- func PaginateText(txt string, w int, maxLines int) *pages.Pages[string]
- func PaginateTextbox(txt string, w, h int, opts ...WrapOpt) *pages.Pages[string]
- func SimpleWrap(txt string, w, maxLines int) ([]string, int)
- func SortByAlphaFunc(a *Token, b *Token) int
- func Split(str string, s sep.Func) []string
- func Stem(token string) string
- func StripPunct(token string) string
- func ToLower(ana *Analyzer)
- func WithDefaultStopWords(ana *Analyzer)
- func WithStemmer(ana *Analyzer)
- func WithoutPunct(ana *Analyzer)
- func WrapFont(txt string, opts ...WrapOpt) ([]string, int)
- func WrapTextbox(txt string, w, h int, opts ...WrapOpt) ([]string, int)
- type AllTokens
- func (toks AllTokens) Find(q string) (AllTokens, error)
- func (toks AllTokens) FindByIndex(ti []int) (AllTokens, error)
- func (toks AllTokens) FindByLabel(label string) (*Token, error)
- func (toks AllTokens) FindByValue(val string) (*Token, error)
- func (toks AllTokens) Labels() []string
- func (toks AllTokens) Len() int
- func (toks AllTokens) Search(q string) (AllTokens, error)
- func (toks AllTokens) Sort(cmp func(a, b *Token) int, order string) AllTokens
- func (toks AllTokens) SortAlphaAsc() AllTokens
- func (toks AllTokens) SortAlphaDesc() AllTokens
- func (toks AllTokens) SortStable(cmp func(a, b *Token) int, order string) AllTokens
- func (toks AllTokens) String(i int) string
- func (toks AllTokens) Values() []string
- func (toks AllTokens) Without(sw AllTokens) AllTokens
- type Analyzer
- func (ana *Analyzer) AddNormalizer(normies ...Normalizer) *Analyzer
- func (ana *Analyzer) IsStopWord(token string) bool
- func (ana *Analyzer) Keywords() *Analyzer
- func (ana *Analyzer) SetStopWords(words []string) *Analyzer
- func (ana *Analyzer) Stopwords() AllTokens
- func (ana *Analyzer) Tokenize(text string) (AllTokens, error)
- func (ana *Analyzer) WithNormalizer(normies ...Normalizer) *Analyzer
- func (ana *Analyzer) WithSep(sep sep.Func) *Analyzer
- func (ana *Analyzer) WithoutStopWords() bool
- type Normalizer
- type Option
- type Token
- type Tokens
- type WrapOpt
- type Wrapper
- func (pg *Wrapper) LinesPerPage() int
- func (wr *Wrapper) Paginate(txt string) *pages.Pages[string]
- func (wr *Wrapper) SetFont(face font.Face) *Wrapper
- func (wr *Wrapper) SetFontSize(fs int) *Wrapper
- func (pg *Wrapper) SetHeight(m int) *Wrapper
- func (pg *Wrapper) SetLineHeight(m int) *Wrapper
- func (pg *Wrapper) SetMaxLines(m int) *Wrapper
- func (wr *Wrapper) SetSize(w, h int) *Wrapper
- func (wr *Wrapper) SetWidth(w int) *Wrapper
- func (wr *Wrapper) WithTTF(src []byte, fs int) error
- func (wr *Wrapper) WrapText(str string) []string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( GoMono = gomono.TTF GoRegular = goregular.TTF Inconsolata = inconsolata.Regular8x16 DefaultFont = inconsolata.Regular8x16 )
Functions ¶
func DefaultStopWords ¶
func DefaultStopWords() []string
func NewPaginator ¶ added in v0.0.5
func NoopNormalizer ¶ added in v0.0.5
func PaginateText ¶ added in v0.0.5
func PaginateTextbox ¶ added in v0.0.5
func SortByAlphaFunc ¶ added in v0.0.2
func StripPunct ¶
func WithDefaultStopWords ¶
func WithDefaultStopWords(ana *Analyzer)
func WithStemmer ¶
func WithStemmer(ana *Analyzer)
func WithoutPunct ¶
func WithoutPunct(ana *Analyzer)
Types ¶
type AllTokens ¶ added in v0.0.5
type AllTokens []*Token
func Normalize ¶
func Normalize(ls []string, normies []Normalizer) AllTokens
func (AllTokens) FindByIndex ¶ added in v0.0.5
func (AllTokens) FindByLabel ¶ added in v0.0.5
func (AllTokens) FindByValue ¶ added in v0.0.5
func (AllTokens) SortAlphaAsc ¶ added in v0.0.5
func (AllTokens) SortAlphaDesc ¶ added in v0.0.5
func (AllTokens) SortStable ¶ added in v0.0.5
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
func NewNormalizer ¶ added in v0.0.2
func (*Analyzer) AddNormalizer ¶
func (ana *Analyzer) AddNormalizer(normies ...Normalizer) *Analyzer
func (*Analyzer) IsStopWord ¶
func (*Analyzer) SetStopWords ¶
func (*Analyzer) WithNormalizer ¶
func (ana *Analyzer) WithNormalizer(normies ...Normalizer) *Analyzer
func (*Analyzer) WithoutStopWords ¶ added in v0.0.4
type Normalizer ¶
type Option ¶
type Option func(*Analyzer)
func WithNormalizers ¶
func WithNormalizers(n ...Normalizer) Option
func WithStopWords ¶
type Tokens ¶
type Tokens struct {
// contains filtered or unexported fields
}
func (*Tokens) SetStringSlice ¶ added in v0.0.5
type WrapOpt ¶ added in v0.0.5
type WrapOpt func(w *Wrapper)
func WithGoMono ¶ added in v0.0.5
func WithGoRegular ¶ added in v0.0.5
func WithMaxLines ¶ added in v0.0.5
type Wrapper ¶ added in v0.0.5
type Wrapper struct {
FontSize int
Width int
DPI int
MaxLines int
Height int
LineHeight int
Font font.Face
Simple bool
}
func NewWrapper ¶ added in v0.0.5
func (*Wrapper) LinesPerPage ¶ added in v0.0.5
func (*Wrapper) SetFontSize ¶ added in v0.0.5
func (*Wrapper) SetLineHeight ¶ added in v0.0.5
func (*Wrapper) SetMaxLines ¶ added in v0.0.5
Source Files
¶
Click to show internal directories.
Click to hide internal directories.