bleve: github.com/blevesearch/bleve/analysis/token/camelcase Index | Files

package camelcase

import "github.com/blevesearch/bleve/analysis/token/camelcase"

Index

Package Files

camelcase.go parser.go states.go

Constants

const Name = "camelCase"

func CamelCaseFilterConstructor Uses

func CamelCaseFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error)

type CamelCaseFilter Uses

type CamelCaseFilter struct{}

CamelCaseFilter splits a given token into a set of tokens where each resulting token falls into one the following classes: 1) Upper case followed by lower case letters.

Terminated by a number, an upper case letter, and a non alpha-numeric symbol.

2) Upper case followed by upper case letters.

Terminated by a number, an upper case followed by a lower case letter, and a non alpha-numeric symbol.

3) Lower case followed by lower case letters.

Terminated by a number, an upper case letter, and a non alpha-numeric symbol.

4) Number followed by numbers.

Terminated by a letter, and a non alpha-numeric symbol.

5) Non alpha-numeric symbol followed by non alpha-numeric symbols.

Terminated by a number, and a letter.

It does a one-time sequential pass over an input token, from left to right. The scan is greedy and generates the longest substring that fits into one of the classes.

See the test file for examples of classes and their parsings.

func NewCamelCaseFilter Uses

func NewCamelCaseFilter() *CamelCaseFilter

func (*CamelCaseFilter) Filter Uses

func (f *CamelCaseFilter) Filter(input analysis.TokenStream) analysis.TokenStream

type LowerCaseState Uses

type LowerCaseState struct{}

func (*LowerCaseState) Member Uses

func (s *LowerCaseState) Member(sym rune, peek *rune) bool

func (*LowerCaseState) StartSym Uses

func (s *LowerCaseState) StartSym(sym rune) bool

type NonAlphaNumericCaseState Uses

type NonAlphaNumericCaseState struct{}

func (*NonAlphaNumericCaseState) Member Uses

func (s *NonAlphaNumericCaseState) Member(sym rune, peek *rune) bool

func (*NonAlphaNumericCaseState) StartSym Uses

func (s *NonAlphaNumericCaseState) StartSym(sym rune) bool

type NumberCaseState Uses

type NumberCaseState struct{}

func (*NumberCaseState) Member Uses

func (s *NumberCaseState) Member(sym rune, peek *rune) bool

func (*NumberCaseState) StartSym Uses

func (s *NumberCaseState) StartSym(sym rune) bool

type Parser Uses

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

Parser accepts a symbol and passes it to the current state (representing a class). The state can accept it (and accumulate it). Otherwise, the parser creates a new state that starts with the pushed symbol.

Parser accumulates a new resulting token every time it switches state. Use FlushTokens() to get the results after the last symbol was pushed.

func NewParser Uses

func NewParser(length, position, index int) *Parser

func (*Parser) FlushTokens Uses

func (p *Parser) FlushTokens() []*analysis.Token

func (*Parser) NewState Uses

func (p *Parser) NewState(sym rune) State

Note. States have to have different starting symbols.

func (*Parser) NextPosition Uses

func (p *Parser) NextPosition() int

func (*Parser) Push Uses

func (p *Parser) Push(sym rune, peek *rune)

type State Uses

type State interface {
    // is _sym_ the start character
    StartSym(sym rune) bool

    // is _sym_ a member of a class.
    // peek, the next sym on the tape, can also be used to determine a class.
    Member(sym rune, peek *rune) bool
}

States codify the classes that the parser recognizes.

type UpperCaseState Uses

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

func (*UpperCaseState) Member Uses

func (s *UpperCaseState) Member(sym rune, peek *rune) bool

func (*UpperCaseState) StartSym Uses

func (s *UpperCaseState) StartSym(sym rune) bool

Package camelcase imports 5 packages (graph) and is imported by 1 packages. Updated 2018-10-27. Refresh now. Tools for package owners.