Documentation ¶
Overview ¶
Package words provides capabilities for splitting a string into a slice of words by a collection of rules
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(c *config)
Option defines the interface for applying options to the extraction
func AllowHyphenatedWords ¶
func AllowHyphenatedWords() Option
AllowHyphenatedWords allows hyphenated words in the extraction. E.g. "a family-sized pizza" => []{"a", "family-sized", "pizza"}
func IncludePunctuation ¶
func IncludePunctuation() Option
IncludePunctuation includes punctuation in extraction. E.g. "a.nested_path" => []{"a", ".", "nested", "-", "path"}
func IncludeSpaces ¶
func IncludeSpaces() Option
IncludeSpaces includes spaces in the extraction. E.g. "the moon" => []{"the", " ", "moon"}
func IncludeSymbols ¶
func IncludeSymbols() Option
IncludeSymbols includes symbols in the extraction. E.g. "beer>food" => []{"beer", ">", "food"}
func WithIgnoredRuneKinds ¶ added in v1.0.3
WithIgnoredRuneKinds tells the extractor to ignore these rune kinds when they are encountered, simply adding them to the output as the rune was of most recent rune kind.
func WithIgnoredRunes ¶ added in v1.0.2
WithIgnoredRunes tells the extractor to ignore these runes when they are encountered, simply adding them to the output as the rune was of most recent rune kind. E.g. => WithIgnoredRunes('.') "Etc. and so on" becomes => []{"Etc.", "and", "so", "on"}