Documentation ¶
Index ¶
- func CompareUtf16String(a []uint16, b []uint16) int
- func ConvertHan2Zen(source string) string
- func ConvertHira2Kata(source string) string
- func ConvertZen2Han(source string) string
- func ExtractTail(words []string) []uint32
- func Query(word string, dict *CompactDictionary, operator *RegexOperator) string
- func QueryAWord(word string, dict *CompactDictionary, operator *RegexOperator) string
- type BitList
- type BitVector
- type CompactDictionary
- type DoubleArray
- type DoubleArrayBuilder
- type Level
- type LoudsTrie
- func (trie *LoudsTrie) FirstChild(x uint32) int
- func (trie *LoudsTrie) Lookup(key []uint16) int
- func (trie *LoudsTrie) Parent(x uint32) uint32
- func (trie *LoudsTrie) PredictiveSearchBreadthFirst(node int, f func(int))
- func (trie *LoudsTrie) PredictiveSearchDepthFirst(index int, f func(int, []uint16))
- func (trie *LoudsTrie) ReverseLookup(index uint32, key *[]uint16) int
- func (trie *LoudsTrie) Size() int
- func (trie *LoudsTrie) Traverse(index uint32, c uint16) int
- type LoudsTrieBuilder
- type MigemoParser
- type RegexOperator
- type RomajiPredictiveResult
- type RomajiProcessor
- type RomajiProcessor2
- type SimpleDictionary
- type TernaryRegexGenerator
- type TernaryRegexNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareUtf16String ¶
CompareUtf16String は、UTF16の文字列を辞書順に比較する
func ConvertHira2Kata ¶
ConvertHira2Kata は、ひらがなからカタカナへ文字列を変更する
func ExtractTail ¶ added in v0.0.4
ExtractTail は、文字列の配列から分岐のない末尾(TAIL)を抽出する
func Query ¶
func Query(word string, dict *CompactDictionary, operator *RegexOperator) string
Query は、migemoクエリを処理する
func QueryAWord ¶
func QueryAWord(word string, dict *CompactDictionary, operator *RegexOperator) string
QueryAWord は、migemoクエリを処理する
Types ¶
type BitList ¶
BitList は、ビット配列を効率的に格納する伸長可能な構造体
func NewBitListWithSize ¶
NewBitListWithSize は、BitListを長さ=sizeで初期化する
type BitVector ¶
type BitVector struct {
// contains filtered or unexported fields
}
BitVector は、RankやSelectの計算が高速なビット配列
func NewBitVector ¶
NewBitVector は、BitVectorを初期化する
func (*BitVector) NextClearBit ¶
NextClearBit は、fromIndexから次の0ビットの位置を取得する
type CompactDictionary ¶
type CompactDictionary struct {
// contains filtered or unexported fields
}
CompactDictionary は、読み毎に複数の単語を格納した辞書
func BuildDictionaryFromMigemoDictFile ¶
func BuildDictionaryFromMigemoDictFile(fp io.Reader) *CompactDictionary
BuildDictionaryFromMigemoDictFile は、ファイルからCompactDictionaryを読み込む
func NewCompactDictionary ¶
func NewCompactDictionary(buffer []uint8) *CompactDictionary
NewCompactDictionary は、バイト配列からCompactDictionaryを読み込む
func (*CompactDictionary) PredictiveSearch ¶
func (compactDictionary *CompactDictionary) PredictiveSearch(key []uint16, f func([]uint16))
PredictiveSearch は、接頭辞がkeyに一致する全ての単語をコールバック関数fに返す
func (*CompactDictionary) Save ¶
func (compactDictionary *CompactDictionary) Save(fp *os.File)
Save は、ファイルに辞書の内容を書き込む
func (*CompactDictionary) Search ¶
func (compactDictionary *CompactDictionary) Search(key []uint16, f func([]uint16))
Search は、キーに一致する単語をコールバック関数fに返す
type DoubleArray ¶ added in v0.0.4
type DoubleArray struct {
// contains filtered or unexported fields
}
DoubleArray は、高速に検索可能なトライ木
func BuildDoubleArray ¶ added in v0.0.4
func BuildDoubleArray(keys []string) *DoubleArray
BuildDoubleArray は、文字列配列keysからDoubleArrayを生成する
func NewDoubleArray ¶ added in v0.0.4
NewDoubleArray は、DoubleArrayを初期化する
func (*DoubleArray) CommonPrefixSearch ¶ added in v0.0.4
func (doubleArray *DoubleArray) CommonPrefixSearch(key string, f func(node int16))
CommonPrefixSearch は、指定した文字列のノードまでにたどる全てのノード番号を関数fに返す
func (*DoubleArray) Lookup ¶ added in v0.0.4
func (doubleArray *DoubleArray) Lookup(str string) int16
Lookup は、指定した文字列のノード番号を返す
func (*DoubleArray) PredictiveSearch ¶ added in v0.0.4
func (doubleArray *DoubleArray) PredictiveSearch(key string, f func(node int16))
PredictiveSearch は、接頭辞keyが含まれている全てのノードのノード番号を関数fに返す
type DoubleArrayBuilder ¶ added in v0.0.4
type DoubleArrayBuilder struct {
// contains filtered or unexported fields
}
DoubleArrayBuilder は、DoubleArrayを生成する構造体
func NewDoubleArrayBuilder ¶ added in v0.0.4
func NewDoubleArrayBuilder(keys []string, indices []int16) *DoubleArrayBuilder
NewDoubleArrayBuilder は、DoubleArrayBuilderを初期化する
type Level ¶
type Level struct {
// contains filtered or unexported fields
}
Level は、Loudsツリーの深さ毎のloudsやlabelを格納した構造体
type LoudsTrie ¶
type LoudsTrie struct {
// contains filtered or unexported fields
}
LoudsTrie は、LOUDS(level order unary degree sequence)を実装したもの
func BuildLoudsTrie ¶
BuildLoudsTrie は、UTF16文字列の配列からLoudsTrieを生成する
func NewLoudsTrie ¶
NewLoudsTrie は、LoudsTrieを初期化する
func (*LoudsTrie) FirstChild ¶
FirstChild は、ノード番号xのはじめの子供のノード番号を返す。子供がなければ-1
func (*LoudsTrie) PredictiveSearchBreadthFirst ¶ added in v0.0.4
PredictiveSearchBreadthFirst は、指定したノードから葉の方向に全てのノードを幅優先で巡る.
func (*LoudsTrie) PredictiveSearchDepthFirst ¶ added in v0.0.4
PredictiveSearchDepthFirst は、指定したノードから葉の方向に全てのノードを深さ優先で巡る
func (*LoudsTrie) ReverseLookup ¶
ReverseLookup は、ノード番号indexからkeyを復元する
type LoudsTrieBuilder ¶
type LoudsTrieBuilder struct {
// contains filtered or unexported fields
}
LoudsTrieBuilder は、LoudsTrieを生成するための構造体
func NewLoudsTrieBuilder ¶
func NewLoudsTrieBuilder() *LoudsTrieBuilder
NewLoudsTrieBuilder は、LoudsTrieBuilderを初期化する
func (*LoudsTrieBuilder) Add ¶
func (builder *LoudsTrieBuilder) Add(key []uint16) error
Add は、LoudsTrieBuliderにキーを追加する(追加するキーは辞書順)
func (*LoudsTrieBuilder) Build ¶
func (builder *LoudsTrieBuilder) Build() *LoudsTrie
Build は、LoudsTrieBuilderに追加した文字列からLoudsTrieを生成する
type MigemoParser ¶ added in v0.0.5
func NewMigemoParser ¶ added in v0.0.5
func NewMigemoParser(query string) MigemoParser
func (*MigemoParser) Next ¶ added in v0.0.5
func (parser *MigemoParser) Next() string
type RegexOperator ¶
type RegexOperator struct {
// contains filtered or unexported fields
}
RegexOperator は、正規表現の記号を格納する
func NewRegexOperator ¶
func NewRegexOperator(or string, beginGroup string, endGroup string, beginClass string, endClass string, newline string) *RegexOperator
NewRegexOperator は、RegexOperatorを初期化する
type RomajiPredictiveResult ¶
RomajiPredictiveResult は、RomajiProcessorの結果を返す構造体
type RomajiProcessor ¶
type RomajiProcessor struct {
// contains filtered or unexported fields
}
RomajiProcessor は、ローマ字を処理する構造体
func NewRomajiProcessor ¶
func NewRomajiProcessor() *RomajiProcessor
NewRomajiProcessor は、RomajiProcessorを初期化する
func (*RomajiProcessor) RomajiToHiragana ¶
func (processor *RomajiProcessor) RomajiToHiragana(romaji string) string
RomajiToHiragana は、ローマ字からひらがなに変換する
func (*RomajiProcessor) RomajiToHiraganaPredictively ¶
func (processor *RomajiProcessor) RomajiToHiraganaPredictively(romaji string) RomajiPredictiveResult
RomajiToHiraganaPredictively は、ローマ字からひらがなに変換する。末尾の未確定部分は予測した結果を返す
type RomajiProcessor2 ¶ added in v0.0.4
type RomajiProcessor2 struct {
// contains filtered or unexported fields
}
RomajiProcessor2 は、DoubleArrayでローマ字を処理する構造体
func NewRomajiProcessor2 ¶ added in v0.0.4
func NewRomajiProcessor2() *RomajiProcessor2
NewRomajiProcessor2 は、RomajiProcessor2を初期化する
func (*RomajiProcessor2) RomajiToHiragana ¶ added in v0.0.4
func (processor *RomajiProcessor2) RomajiToHiragana(romaji string) string
RomajiToHiragana は、入力した文字列romajiをひらがなに変換する
func (*RomajiProcessor2) RomajiToHiraganaPredictively ¶ added in v0.0.4
func (processor *RomajiProcessor2) RomajiToHiraganaPredictively(romaji string) *RomajiPredictiveResult
RomajiToHiraganaPredictively は、入力途中の文字列から変換されるひらがなを予測し、ローマ字からひらがなに変換する
type SimpleDictionary ¶
type SimpleDictionary struct {
// contains filtered or unexported fields
}
SimpleDictionary は、キーとバリューを配列にして格納した、単純な構造の辞書
func BuildSimpleDictionary ¶
func BuildSimpleDictionary(file string) *SimpleDictionary
BuildSimpleDictionary は、ファイルからSimpleDictionaryを生成する
func (*SimpleDictionary) PredictiveSearch ¶
func (dictioary *SimpleDictionary) PredictiveSearch(hiragana string) []string
PredictiveSearch は、入力されたキーを接頭辞とする単語を返す
type TernaryRegexGenerator ¶
type TernaryRegexGenerator struct {
// contains filtered or unexported fields
}
TernaryRegexGenerator は、三分探索木で正規表現を生成する
func NewTernaryRegexGenerator ¶
func NewTernaryRegexGenerator(operator *RegexOperator) *TernaryRegexGenerator
NewTernaryRegexGenerator は、TernaryRegexGeneratorを初期化する
func (*TernaryRegexGenerator) Add ¶
func (generator *TernaryRegexGenerator) Add(word []rune)
Add は、単語を追加する
func (*TernaryRegexGenerator) Generate ¶
func (generator *TernaryRegexGenerator) Generate() []rune
Generate は、追加した文字列から正規表現を生成する
type TernaryRegexNode ¶
type TernaryRegexNode struct {
// contains filtered or unexported fields
}
TernaryRegexNode は、三分探索木で正規表現を生成するノード