dictionary

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package dictionary contains a interface and wraps all io related work. It is used by jiebago module to read/write files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDictionary

func LoadDictionary(dl DictLoader, fileName string) error

LoadDictionary reads the given file and passes all tokens to a DictLoader.

func LoadDictionaryRemote

func LoadDictionaryRemote(dl DictLoader, url string) (err error)

Types

type DictLoader

type DictLoader interface {
	Load(<-chan Token)
	AddToken(Token)
}

DictLoader is the interface that could add one token or load tokens from channel.

type Token

type Token struct {
	// contains filtered or unexported fields
}

Token represents a Chinese word with (optional) frequency and POS.

func NewToken

func NewToken(text string, frequency float64, pos string) Token

NewToken creates a new token.

func (Token) Frequency

func (t Token) Frequency() float64

Frequency returns token's frequency.

func (Token) Pos

func (t Token) Pos() string

Pos returns token's POS.

func (Token) Text

func (t Token) Text() string

Text returns token's text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL