search

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ZeroToken = Token(0)

Variables

This section is empty.

Functions

func Run

func Run(s *Setup)

func RunParallel

func RunParallel(s *Setup, routines int)

Types

type Database

type Database struct {
	Alphabet map[Token]*TokenInfo
	Groups   map[Token]*TokenGroup

	PosToSequence []Sequence // mapping from position to sequence
	FullSequence  []Token    // concatenated sequences
	Total         []int      // total number sequence for each section
	TotalTokens   []int      // total number of tokens for each section

	Separator string // separator for joining pattern
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase() *Database

func (*Database) AddAllPositions

func (db *Database) AddAllPositions(s set.Set)

func (*Database) AddGroup

func (db *Database) AddGroup(group *TokenGroup) Token

func (*Database) AddSequence

func (db *Database) AddSequence(sec int, raw []string, count int)

func (*Database) AddToken

func (db *Database) AddToken(tokenName string) Token

func (*Database) MakeSection

func (db *Database) MakeSection() int

func (*Database) MatchesOccs

func (db *Database) MatchesOccs(s set.Set) (matches []int, occs []int)

func (*Database) ToTokens

func (db *Database) ToTokens(raw []string) []Token

type Extender

type Extender func(p *Query) Querys

type Feature

type Feature func(p *Query) (float64, string)

type Filter

type Filter func(p *Query) bool

type Pooler

type Pooler interface {
	Pop() (*Query, bool)
	Push(*Query)
	Values() []*Query
	Len() int
	Empty() bool
}

type ProcessQuery

type ProcessQuery func(p *Query) error

type Query

type Query struct {
	Pat []RegToken
	Loc set.Set
	Db  *Database
	// contains filtered or unexported fields
}

func NewEmptyQuery

func NewEmptyQuery(db *Database) *Query

func NewQuery

func NewQuery(parent *Query, token RegToken) *Query

func (*Query) CacheValues

func (q *Query) CacheValues()

func (*Query) Len

func (q *Query) Len() int

func (*Query) Matches

func (q *Query) Matches() []int

func (*Query) Occs

func (q *Query) Occs() []int

func (*Query) String

func (q *Query) String() string

func (*Query) StringLong

func (q *Query) StringLong() string

func (*Query) StringRaw

func (q *Query) StringRaw() string

type Querys

type Querys []*Query

type RegFlags

type RegFlags uint8
const (
	IsGroup RegFlags = 1 << iota
	IsStar
	IsSingle RegFlags = 0
)

type RegToken

type RegToken struct {
	Token Token
	Flags RegFlags
}

type Sequence

type Sequence struct {
	Index   int
	Section uint32
	Count   uint32
}

type Setup

type Setup struct {
	Db  *Database
	Out Pooler
	In  Pooler

	Extender Extender

	Extendable  Filter
	Outputtable Filter

	PreProcess  ProcessQuery
	PostProcess ProcessQuery
}

type Token

type Token uint32

type TokenGroup

type TokenGroup struct {
	Token    Token
	Elems    []Token
	Name     string
	FullName string
}

type TokenInfo

type TokenInfo struct {
	Token Token
	Name  string
	Count int
}

Directories

Path Synopsis
Package queue implements a FIFO (first in first out) data structure supporting arbitrary types (even a mixture).
Package queue implements a FIFO (first in first out) data structure supporting arbitrary types (even a mixture).

Jump to

Keyboard shortcuts

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