Documentation ¶
Index ¶
- func AsOriginal(abbr Abbreviator, original string, max int, frmFront bool, rmvStop bool) string
- func AsPascal(abbr Abbreviator, original string, max int, frmFront bool, rmvStop bool) string
- func AsSeparated(abbr Abbreviator, original, separator string, max int, frmFront bool, ...) string
- type Abbreviator
- type Matcher
- type NoAbbreviator
- type Sequences
- type Shortener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsOriginal ¶ added in v1.1.0
AsOriginal discovers words using camel case and non letter characters, starting from the back or the front until the string has less than 'max' characters or it can't shorten any more.
func AsPascal ¶ added in v1.1.0
AsPascal discovers words using camel case and non letter characters, starting from the back or the front until the string has less than 'max' characters or it can't shorten any more. Word boundaries are a capital letter at the start of each word
func AsSeparated ¶ added in v1.4.0
func AsSeparated(abbr Abbreviator, original, separator string, max int, frmFront bool, rmvStop bool) string
AsSeparated discovers words using camel case and non letter characters, starting from the back or the front until the string has less than 'max' characters or it can't shorten any more. This inserts the specified separator where a sequence is not alpha-numeric
Types ¶
type Abbreviator ¶ added in v1.4.0
type Abbreviator interface { // Abbreviate attempts to return an abbreviation for the word given. It // does not guarantee to return a different, shorter string. Abbreviate(word string) string }
Abbreviator allows you to use different implementations for abbreviating words
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher finds matches between words and abbreviations
func NewMatcher ¶ added in v1.3.0
NewMatcher creates a new matcher of abbreviation mappings
func NewMatcherFromString ¶
NewMatcherFromString creates a new matcher from newline seperated data
func (*Matcher) Abbreviate ¶ added in v1.4.0
Abbreviate returns an abbreviation looked up from pre-defined mappings
type NoAbbreviator ¶ added in v1.4.0
type NoAbbreviator struct{}
NoAbbreviator does not abbreviate anything
func (*NoAbbreviator) Abbreviate ¶ added in v1.4.0
func (a *NoAbbreviator) Abbreviate(word string) string
Abbreviate just returns the unabbreviated word
type Sequences ¶
type Sequences []string
Sequences represents a string that has been broken in to different parts of words and separators
func NewSequences ¶
NewSequences generates a new Sequences from the string passed in
func (*Sequences) IsSeparator ¶ added in v1.6.0
IsSeparator checks if the string at position pos is a separator
func (*Sequences) Pop ¶ added in v1.6.0
func (all *Sequences) Pop()
Pop deletes the last string in the Sequences
func (*Sequences) RemoveStopwords ¶ added in v1.6.0
func (all *Sequences) RemoveStopwords()
RemoveStopwords removes stopwords in the Sequences, and separators that precedes a stopword