Documentation
¶
Index ¶
- Constants
- Variables
- func GetCharCategoryTypes(text *InputText, node *LatticeNode) uint32
- func InhibitConnection(grammar *dictionary.Grammar, leftId int16, rightId int16)
- type BaseConfig
- type DefaultInputTextPlugin
- type DefaultInputTextPluginConfig
- type EditConnectionCostPlugin
- type InhibitConnectionPlugin
- type InputText
- func (t *InputText) CanBow(index int) bool
- func (t *InputText) CodePointCount(begin int, end int) int
- func (t *InputText) GetByteText() []byte
- func (t *InputText) GetCharCategoryContinuousLength(index int) int
- func (t *InputText) GetCharCategoryTypes(index int) uint32
- func (t *InputText) GetCharCategoryTypesRange(begin int, end int) uint32
- func (t *InputText) GetCodePointsOffsetLength(index int, codePointOffset int) int
- func (t *InputText) GetOffsetTextLength(index int) int
- func (t *InputText) GetOriginalIndex(index int) int
- func (t *InputText) GetSubstring(begin int, end int) string
- func (t *InputText) GetText() string
- func (t *InputText) IsCharAlignment(index int) bool
- type InputTextBuilder
- type InputTextPlugin
- type JapaneseDictionary
- func (d *JapaneseDictionary) Close()
- func (d *JapaneseDictionary) Create() *JapaneseTokenizer
- func (d *JapaneseDictionary) GetPartOfSpeechSize() int
- func (d *JapaneseDictionary) GetPartOfSpeechString(posId int16) []string
- func (d *JapaneseDictionary) ReadCharacterDefinition(charDef string) error
- func (d *JapaneseDictionary) ReadSystemDictionary(filename string, utf16string bool) error
- func (d *JapaneseDictionary) ReadUserDictionary(filename string, utf16string bool) error
- type JapaneseTokenizer
- type JoinKatakanaOovPlugin
- type JoinKatakanaOovPluginConfig
- type JoinNumericPlugin
- type JoinNumericPluginConfig
- type Lattice
- func (l *Lattice) Dump(w io.Writer)
- func (l *Lattice) GetBestPath() ([]*LatticeNode, error)
- func (l *Lattice) GetMinimumNode(begin int, end int) *LatticeNode
- func (l *Lattice) GetNodes(begin int, end int) []*LatticeNode
- func (l *Lattice) GetNodesWithEnd(end int) []*LatticeNode
- func (l *Lattice) HasPreviousNode(index int) bool
- func (l *Lattice) Insert(begin int, end int, node *LatticeNode)
- func (l *Lattice) Remove(begin int, end int, node *LatticeNode)
- type LatticeNode
- func ConcatenateNodes(path *[]*LatticeNode, begin int, end int, lattice *Lattice, ...) (*LatticeNode, error)
- func ConcatenateOov(path *[]*LatticeNode, begin int, end int, posId int16, lattice *Lattice) (*LatticeNode, error)
- func CreateNodeOfOOV() *LatticeNode
- func GetOOV(p OovProviderPlugin, inputText *InputText, offset int, hasOtherWords bool) ([]*LatticeNode, error)
- func NewLatticeNode(lexicon *dictionary.LexiconSet, leftId int16, rightId int16, cost int16, ...) *LatticeNode
- func (ln *LatticeNode) GetBegin() int
- func (ln *LatticeNode) GetDictionaryId() int
- func (ln *LatticeNode) GetEnd() int
- func (ln *LatticeNode) GetPathCost() int
- func (ln *LatticeNode) GetWordId() int
- func (ln *LatticeNode) GetWordInfo() *dictionary.WordInfo
- func (ln *LatticeNode) IsOOV() bool
- func (ln *LatticeNode) SetOOV()
- func (ln *LatticeNode) SetParameter(leftId int16, rightId int16, cost int16)
- func (ln *LatticeNode) SetRange(begin int, end int)
- func (ln *LatticeNode) SetWordInfo(wordInfo *dictionary.WordInfo)
- func (ln *LatticeNode) String() string
- type MakeEditConnectionCostPluginFunc
- type MakeInputTextPluginFunc
- type MakeOovProviderPluginFunc
- type MakePathRewritePluginFunc
- type MeCabOovProviderPlugin
- type MeCabOovProviderPluginConfig
- type Morpheme
- func (m *Morpheme) Begin() int
- func (m *Morpheme) DictionaryForm() string
- func (m *Morpheme) End() int
- func (m *Morpheme) GetDictionaryId() int
- func (m *Morpheme) GetWordId() int
- func (m *Morpheme) GetWordInfo() *dictionary.WordInfo
- func (m *Morpheme) IsOOV() bool
- func (m *Morpheme) NormalizedForm() string
- func (m *Morpheme) PartOfSpeech() []string
- func (m *Morpheme) ReadingForm() string
- func (m *Morpheme) Split(mode string) *MorphemeList
- func (m *Morpheme) Surface() string
- type MorphemeList
- func (l *MorphemeList) Get(index int) *Morpheme
- func (l *MorphemeList) GetBegin(index int) int
- func (l *MorphemeList) GetDictionaryId(index int) int
- func (l *MorphemeList) GetEnd(index int) int
- func (l *MorphemeList) GetInternalCost() int
- func (l *MorphemeList) GetSurface(index int) string
- func (l *MorphemeList) GetWordId(index int) int
- func (l *MorphemeList) GetWordInfo(index int) *dictionary.WordInfo
- func (l *MorphemeList) IsOOV(index int) bool
- func (l *MorphemeList) Length() int
- func (l *MorphemeList) Split(mode string, index int, wi *dictionary.WordInfo) *MorphemeList
- type OovProviderPlugin
- type PathRewritePlugin
- type Plugin
- type PluginMaker
- type ProlongedSoundMarkInputTextPlugin
- type ProlongedSoundMarkInputTextPluginConfig
- type Settings
- type SettingsJSON
- func (settings *SettingsJSON) GetBaseConfig() *BaseConfig
- func (settings *SettingsJSON) GetEditConnectionCostPluginArray(makeproc MakeEditConnectionCostPluginFunc) ([]EditConnectionCostPlugin, error)
- func (settings *SettingsJSON) GetInputTextPluginArray(makeproc MakeInputTextPluginFunc) ([]InputTextPlugin, error)
- func (settings *SettingsJSON) GetOovProviderPluginArray(makeproc MakeOovProviderPluginFunc) ([]OovProviderPlugin, error)
- func (settings *SettingsJSON) GetPathRewritePluginArray(makeproc MakePathRewritePluginFunc) ([]PathRewritePlugin, error)
- func (settings *SettingsJSON) ParseSettingsJSON(defpath string, reader io.Reader) error
- type SimpleOovProviderPlugin
- type SimpleOovProviderPluginConfig
Constants ¶
View Source
const (
NullSurface = "(null)"
)
View Source
const (
UserDictCostParMorph = -20
)
Variables ¶
View Source
var NumericPos []string = []string{"名詞", "数詞", "*", "*", "*", "*"}
View Source
var UndefinedWordInfo = &dictionary.WordInfo{ Surface: NullSurface, HeadwordLength: 0, PosId: -1, NormalizedForm: NullSurface, DictionaryFormWordId: -1, DictionaryForm: NullSurface, ReadingForm: NullSurface, }
Functions ¶
func GetCharCategoryTypes ¶
func GetCharCategoryTypes(text *InputText, node *LatticeNode) uint32
func InhibitConnection ¶
func InhibitConnection(grammar *dictionary.Grammar, leftId int16, rightId int16)
Types ¶
type BaseConfig ¶
type DefaultInputTextPlugin ¶
type DefaultInputTextPlugin struct {
// contains filtered or unexported fields
}
func NewDefaultInputTextPlugin ¶
func NewDefaultInputTextPlugin(config *DefaultInputTextPluginConfig) *DefaultInputTextPlugin
func (*DefaultInputTextPlugin) GetConfigStruct ¶
func (p *DefaultInputTextPlugin) GetConfigStruct() interface{}
func (*DefaultInputTextPlugin) Rewrite ¶
func (p *DefaultInputTextPlugin) Rewrite(builder *InputTextBuilder) error
func (*DefaultInputTextPlugin) SetUp ¶
func (p *DefaultInputTextPlugin) SetUp() error
type DefaultInputTextPluginConfig ¶
type DefaultInputTextPluginConfig struct {
RewriteDef string
}
type EditConnectionCostPlugin ¶
type EditConnectionCostPlugin interface {
Plugin
SetUp(grammar *dictionary.Grammar) error
Edit(grammar *dictionary.Grammar) error
}
func DefMakeEditConnectionCostPlugin ¶
func DefMakeEditConnectionCostPlugin(k string) EditConnectionCostPlugin
type InhibitConnectionPlugin ¶
type InhibitConnectionPlugin struct {
// contains filtered or unexported fields
}
func NewInhibitConnectionPlugin ¶
func NewInhibitConnectionPlugin(inhibitedPair []*[]int) *InhibitConnectionPlugin
func (*InhibitConnectionPlugin) Edit ¶
func (p *InhibitConnectionPlugin) Edit(grammar *dictionary.Grammar) error
func (*InhibitConnectionPlugin) GetConfigStruct ¶
func (p *InhibitConnectionPlugin) GetConfigStruct() interface{}
func (*InhibitConnectionPlugin) SetUp ¶
func (p *InhibitConnectionPlugin) SetUp(grammar *dictionary.Grammar) error
type InputText ¶
type InputText struct {
OriginalText string
ModifiedText string
Bytea []byte
// contains filtered or unexported fields
}
func NewInputText ¶
func (*InputText) GetByteText ¶
func (*InputText) GetCharCategoryContinuousLength ¶
func (*InputText) GetCharCategoryTypes ¶
func (*InputText) GetCharCategoryTypesRange ¶
func (*InputText) GetCodePointsOffsetLength ¶
func (*InputText) GetOffsetTextLength ¶
func (*InputText) GetOriginalIndex ¶
func (*InputText) IsCharAlignment ¶
type InputTextBuilder ¶
type InputTextBuilder struct {
OriginalText string
// contains filtered or unexported fields
}
func NewInputTextBuilder ¶
func NewInputTextBuilder(text string, grammar *dictionary.Grammar) *InputTextBuilder
func (*InputTextBuilder) Build ¶
func (builder *InputTextBuilder) Build() *InputText
func (*InputTextBuilder) GetText ¶
func (builder *InputTextBuilder) GetText() []rune
type InputTextPlugin ¶
type InputTextPlugin interface {
Plugin
SetUp() error
Rewrite(builder *InputTextBuilder) error
}
func DefMakeInputTextPlugin ¶
func DefMakeInputTextPlugin(k string) InputTextPlugin
type JapaneseDictionary ¶
type JapaneseDictionary struct {
// contains filtered or unexported fields
}
func NewJapaneseDictionary ¶
func NewJapaneseDictionary(config *BaseConfig, inputTextPlugins []InputTextPlugin, oovProviderPlugins []OovProviderPlugin, pathRewritePlugins []PathRewritePlugin, editConnectionCostPlugins []EditConnectionCostPlugin) (*JapaneseDictionary, error)
func (*JapaneseDictionary) Close ¶
func (d *JapaneseDictionary) Close()
func (*JapaneseDictionary) Create ¶
func (d *JapaneseDictionary) Create() *JapaneseTokenizer
func (*JapaneseDictionary) GetPartOfSpeechSize ¶
func (d *JapaneseDictionary) GetPartOfSpeechSize() int
func (*JapaneseDictionary) GetPartOfSpeechString ¶
func (d *JapaneseDictionary) GetPartOfSpeechString(posId int16) []string
func (*JapaneseDictionary) ReadCharacterDefinition ¶
func (d *JapaneseDictionary) ReadCharacterDefinition(charDef string) error
func (*JapaneseDictionary) ReadSystemDictionary ¶
func (d *JapaneseDictionary) ReadSystemDictionary(filename string, utf16string bool) error
func (*JapaneseDictionary) ReadUserDictionary ¶
func (d *JapaneseDictionary) ReadUserDictionary(filename string, utf16string bool) error
type JapaneseTokenizer ¶
func NewJapaneseTokenizer ¶
func NewJapaneseTokenizer(grammar *dictionary.Grammar, lexicon *dictionary.LexiconSet, inputTextPlugins []InputTextPlugin, oovProviderPlugins []OovProviderPlugin, pathRewritePlugins []PathRewritePlugin) *JapaneseTokenizer
func (*JapaneseTokenizer) Tokenize ¶
func (t *JapaneseTokenizer) Tokenize(mode string, text string) (*MorphemeList, error)
type JoinKatakanaOovPlugin ¶
type JoinKatakanaOovPlugin struct {
// contains filtered or unexported fields
}
func NewJoinKatakanaOovPlugin ¶
func NewJoinKatakanaOovPlugin(config *JoinKatakanaOovPluginConfig) *JoinKatakanaOovPlugin
func (*JoinKatakanaOovPlugin) GetConfigStruct ¶
func (p *JoinKatakanaOovPlugin) GetConfigStruct() interface{}
func (*JoinKatakanaOovPlugin) Rewrite ¶
func (p *JoinKatakanaOovPlugin) Rewrite(text *InputText, path *[]*LatticeNode, lattice *Lattice) error
func (*JoinKatakanaOovPlugin) SetUp ¶
func (p *JoinKatakanaOovPlugin) SetUp(grammar *dictionary.Grammar) error
type JoinNumericPlugin ¶
type JoinNumericPlugin struct {
// contains filtered or unexported fields
}
func NewJoinNumericPlugin ¶
func NewJoinNumericPlugin(config *JoinNumericPluginConfig) *JoinNumericPlugin
func (*JoinNumericPlugin) GetConfigStruct ¶
func (p *JoinNumericPlugin) GetConfigStruct() interface{}
func (*JoinNumericPlugin) Rewrite ¶
func (p *JoinNumericPlugin) Rewrite(text *InputText, path *[]*LatticeNode, lattice *Lattice) error
func (*JoinNumericPlugin) SetUp ¶
func (p *JoinNumericPlugin) SetUp(grammar *dictionary.Grammar) error
type JoinNumericPluginConfig ¶
type JoinNumericPluginConfig struct {
EnableNormalize *bool
}
type Lattice ¶
type Lattice struct {
// contains filtered or unexported fields
}
func NewLattice ¶
func NewLattice(grammar *dictionary.Grammar) *Lattice
func (*Lattice) GetBestPath ¶
func (l *Lattice) GetBestPath() ([]*LatticeNode, error)
func (*Lattice) GetMinimumNode ¶
func (l *Lattice) GetMinimumNode(begin int, end int) *LatticeNode
func (*Lattice) GetNodesWithEnd ¶
func (l *Lattice) GetNodesWithEnd(end int) []*LatticeNode
func (*Lattice) HasPreviousNode ¶
type LatticeNode ¶
func ConcatenateNodes ¶
func ConcatenateNodes(path *[]*LatticeNode, begin int, end int, lattice *Lattice, normalizedForm string) (*LatticeNode, error)
func ConcatenateOov ¶
func ConcatenateOov(path *[]*LatticeNode, begin int, end int, posId int16, lattice *Lattice) (*LatticeNode, error)
func CreateNodeOfOOV ¶
func CreateNodeOfOOV() *LatticeNode
func GetOOV ¶
func GetOOV(p OovProviderPlugin, inputText *InputText, offset int, hasOtherWords bool) ([]*LatticeNode, error)
func NewLatticeNode ¶
func NewLatticeNode(lexicon *dictionary.LexiconSet, leftId int16, rightId int16, cost int16, wordId int32) *LatticeNode
func (*LatticeNode) GetBegin ¶
func (ln *LatticeNode) GetBegin() int
func (*LatticeNode) GetDictionaryId ¶
func (ln *LatticeNode) GetDictionaryId() int
func (*LatticeNode) GetEnd ¶
func (ln *LatticeNode) GetEnd() int
func (*LatticeNode) GetPathCost ¶
func (ln *LatticeNode) GetPathCost() int
func (*LatticeNode) GetWordId ¶
func (ln *LatticeNode) GetWordId() int
func (*LatticeNode) GetWordInfo ¶
func (ln *LatticeNode) GetWordInfo() *dictionary.WordInfo
func (*LatticeNode) IsOOV ¶
func (ln *LatticeNode) IsOOV() bool
func (*LatticeNode) SetOOV ¶
func (ln *LatticeNode) SetOOV()
func (*LatticeNode) SetParameter ¶
func (ln *LatticeNode) SetParameter(leftId int16, rightId int16, cost int16)
func (*LatticeNode) SetRange ¶
func (ln *LatticeNode) SetRange(begin int, end int)
func (*LatticeNode) SetWordInfo ¶
func (ln *LatticeNode) SetWordInfo(wordInfo *dictionary.WordInfo)
func (*LatticeNode) String ¶
func (ln *LatticeNode) String() string
type MakeEditConnectionCostPluginFunc ¶
type MakeEditConnectionCostPluginFunc func(n string) EditConnectionCostPlugin
type MakeInputTextPluginFunc ¶
type MakeInputTextPluginFunc func(n string) InputTextPlugin
type MakeOovProviderPluginFunc ¶
type MakeOovProviderPluginFunc func(n string) OovProviderPlugin
type MakePathRewritePluginFunc ¶
type MakePathRewritePluginFunc func(n string) PathRewritePlugin
type MeCabOovProviderPlugin ¶
type MeCabOovProviderPlugin struct {
// contains filtered or unexported fields
}
func NewMeCabOovProviderPlugin ¶
func NewMeCabOovProviderPlugin(config *MeCabOovProviderPluginConfig) *MeCabOovProviderPlugin
func (*MeCabOovProviderPlugin) GetConfigStruct ¶
func (p *MeCabOovProviderPlugin) GetConfigStruct() interface{}
func (*MeCabOovProviderPlugin) ProvideOOV ¶
func (p *MeCabOovProviderPlugin) ProvideOOV(inputText *InputText, offset int, hasOtherWords bool) ([]*LatticeNode, error)
func (*MeCabOovProviderPlugin) SetUp ¶
func (p *MeCabOovProviderPlugin) SetUp(grammar *dictionary.Grammar) error
type Morpheme ¶
type Morpheme struct {
// contains filtered or unexported fields
}
func (*Morpheme) DictionaryForm ¶
func (*Morpheme) GetDictionaryId ¶
func (*Morpheme) GetWordInfo ¶
func (m *Morpheme) GetWordInfo() *dictionary.WordInfo
func (*Morpheme) NormalizedForm ¶
func (*Morpheme) PartOfSpeech ¶
func (*Morpheme) ReadingForm ¶
func (*Morpheme) Split ¶
func (m *Morpheme) Split(mode string) *MorphemeList
type MorphemeList ¶
type MorphemeList struct {
// contains filtered or unexported fields
}
func NewMorphemeList ¶
func NewMorphemeList(inputText *InputText, grammar *dictionary.Grammar, lexicon *dictionary.LexiconSet, path []*LatticeNode) *MorphemeList
func (*MorphemeList) Get ¶
func (l *MorphemeList) Get(index int) *Morpheme
func (*MorphemeList) GetBegin ¶
func (l *MorphemeList) GetBegin(index int) int
func (*MorphemeList) GetDictionaryId ¶
func (l *MorphemeList) GetDictionaryId(index int) int
func (*MorphemeList) GetEnd ¶
func (l *MorphemeList) GetEnd(index int) int
func (*MorphemeList) GetInternalCost ¶
func (l *MorphemeList) GetInternalCost() int
func (*MorphemeList) GetSurface ¶
func (l *MorphemeList) GetSurface(index int) string
func (*MorphemeList) GetWordId ¶
func (l *MorphemeList) GetWordId(index int) int
func (*MorphemeList) GetWordInfo ¶
func (l *MorphemeList) GetWordInfo(index int) *dictionary.WordInfo
func (*MorphemeList) IsOOV ¶
func (l *MorphemeList) IsOOV(index int) bool
func (*MorphemeList) Length ¶
func (l *MorphemeList) Length() int
func (*MorphemeList) Split ¶
func (l *MorphemeList) Split(mode string, index int, wi *dictionary.WordInfo) *MorphemeList
type OovProviderPlugin ¶
type OovProviderPlugin interface {
Plugin
SetUp(grammar *dictionary.Grammar) error
ProvideOOV(inputText *InputText, offset int, hasOtherWords bool) ([]*LatticeNode, error)
}
func DefMakeOovProviderPlugin ¶
func DefMakeOovProviderPlugin(k string) OovProviderPlugin
type PathRewritePlugin ¶
type PathRewritePlugin interface {
Plugin
SetUp(grammar *dictionary.Grammar) error
Rewrite(text *InputText, path *[]*LatticeNode, lattice *Lattice) error
}
func DefMakePathRewritePlugin ¶
func DefMakePathRewritePlugin(k string) PathRewritePlugin
type PluginMaker ¶
type PluginMaker interface {
GetInputTextPluginArray(f MakeInputTextPluginFunc) ([]InputTextPlugin, error)
GetOovProviderPluginArray(f MakeOovProviderPluginFunc) ([]OovProviderPlugin, error)
GetPathRewritePluginArray(f MakePathRewritePluginFunc) ([]PathRewritePlugin, error)
GetEditConnectionCostPluginArray(f MakeEditConnectionCostPluginFunc) ([]EditConnectionCostPlugin, error)
}
type ProlongedSoundMarkInputTextPlugin ¶
type ProlongedSoundMarkInputTextPlugin struct {
// contains filtered or unexported fields
}
func NewProlongedSoundMarkInputTextPlugin ¶
func NewProlongedSoundMarkInputTextPlugin(config *ProlongedSoundMarkInputTextPluginConfig) *ProlongedSoundMarkInputTextPlugin
func (*ProlongedSoundMarkInputTextPlugin) GetConfigStruct ¶
func (p *ProlongedSoundMarkInputTextPlugin) GetConfigStruct() interface{}
func (*ProlongedSoundMarkInputTextPlugin) Rewrite ¶
func (p *ProlongedSoundMarkInputTextPlugin) Rewrite(builder *InputTextBuilder) error
func (*ProlongedSoundMarkInputTextPlugin) SetUp ¶
func (p *ProlongedSoundMarkInputTextPlugin) SetUp() error
type Settings ¶
type Settings interface {
GetBaseConfig() *BaseConfig
}
type SettingsJSON ¶
type SettingsJSON struct {
BaseConfig
// contains filtered or unexported fields
}
func NewSettingsJSON ¶
func NewSettingsJSON() *SettingsJSON
func (*SettingsJSON) GetBaseConfig ¶
func (settings *SettingsJSON) GetBaseConfig() *BaseConfig
func (*SettingsJSON) GetEditConnectionCostPluginArray ¶
func (settings *SettingsJSON) GetEditConnectionCostPluginArray(makeproc MakeEditConnectionCostPluginFunc) ([]EditConnectionCostPlugin, error)
func (*SettingsJSON) GetInputTextPluginArray ¶
func (settings *SettingsJSON) GetInputTextPluginArray(makeproc MakeInputTextPluginFunc) ([]InputTextPlugin, error)
func (*SettingsJSON) GetOovProviderPluginArray ¶
func (settings *SettingsJSON) GetOovProviderPluginArray(makeproc MakeOovProviderPluginFunc) ([]OovProviderPlugin, error)
func (*SettingsJSON) GetPathRewritePluginArray ¶
func (settings *SettingsJSON) GetPathRewritePluginArray(makeproc MakePathRewritePluginFunc) ([]PathRewritePlugin, error)
func (*SettingsJSON) ParseSettingsJSON ¶
func (settings *SettingsJSON) ParseSettingsJSON(defpath string, reader io.Reader) error
type SimpleOovProviderPlugin ¶
type SimpleOovProviderPlugin struct {
// contains filtered or unexported fields
}
func NewSimpleOovProviderPlugin ¶
func NewSimpleOovProviderPlugin(config *SimpleOovProviderPluginConfig) *SimpleOovProviderPlugin
func (*SimpleOovProviderPlugin) GetConfigStruct ¶
func (p *SimpleOovProviderPlugin) GetConfigStruct() interface{}
func (*SimpleOovProviderPlugin) ProvideOOV ¶
func (p *SimpleOovProviderPlugin) ProvideOOV(inputText *InputText, offset int, hasOtherWords bool) ([]*LatticeNode, error)
func (*SimpleOovProviderPlugin) SetUp ¶
func (p *SimpleOovProviderPlugin) SetUp(grammar *dictionary.Grammar) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.