fmindex

package module
v0.0.0-...-77e6c66 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 5 Imported by: 0

README

FM-index

Go Go Report Card Read the Docs

A FM-index using Wavelet Tree's to store the Burrows–Wheeler transform. A Prefix Tree using BitVector and a Sampled Suffix Array, for storing the offsets.

The Prefix Tree can be shared across FM-indexs to reduce storage needs.

index, err := NewFMIndex("The quick brown fox jumps over the lazy dog", WithCompression(2))

Operation

Count
count := index.Count("jumps")
fmt.Println(count) // 1
Locate
matches := index.Locate("jumps")
fmt.Println(matches) // []int{20}
Extract
text := index.Extract(matches[0], 5)
fmt.Println(text) // "jumps"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FMIndex

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

func NewFMIndex

func NewFMIndex(text string, opts ...FMIndexOption) (*FMIndex, error)

func (*FMIndex) CaseInsensitive

func (s *FMIndex) CaseInsensitive() bool

func (*FMIndex) Compression

func (s *FMIndex) Compression() int

func (*FMIndex) Count

func (s *FMIndex) Count(pattern string) int

func (*FMIndex) Extract

func (s *FMIndex) Extract(offset, length int) string

func (*FMIndex) Locate

func (s *FMIndex) Locate(pattern string) []int

func (*FMIndex) PrefixTree

func (s *FMIndex) PrefixTree() *prefixtree.Prefix

type FMIndexOption

type FMIndexOption func(f *FMIndex)

func WithCaseInsensitive

func WithCaseInsensitive(caseinsensitive bool) FMIndexOption

func WithCompression

func WithCompression(compression int) FMIndexOption

func WithPrefixTree

func WithPrefixTree(prefix prefixtree.Prefix) FMIndexOption

Jump to

Keyboard shortcuts

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