Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Indexは高速な部分文字列検索のための接尾辞配列を実装しています。
func (*Index) FindAllIndex ¶
FindAllIndexは正規表現rの非重複マッチのソートされたリストを返します。 マッチは、x.Bytes()の一致するスライスを指定するインデックスのペアです。 nが0未満の場合、すべてのマッチが連続して返されます。 そうでない場合、最大でnマッチが返される可能性がありますが、連続しているとは限りません。 マッチがない場合、またはn == 0の場合は、結果はnilです。
func (*Index) Lookup ¶
Lookupは、バイト文字列sがインデックス付きデータに出現する最大n箇所のインデックスの非ソートリストを返します。n < 0の場合、すべての出現箇所が返されます。 sが空である、sが見つからない、またはn == 0の場合、結果はnilです。 ルックアップ時間はO(log(N)*len(s) + len(result))であり、Nはインデックス付きデータのサイズです。
Example ¶
package main
import (
"github.com/shogo82148/std/fmt"
"github.com/shogo82148/std/index/suffixarray"
)
func main() {
index := suffixarray.New([]byte("banana"))
offsets := index.Lookup([]byte("ana"), -1)
for _, off := range offsets {
fmt.Println(off)
}
}
Output: 1 3
Click to show internal directories.
Click to hide internal directories.