abbreviate: github.com/dnnrly/abbreviate/domain Index | Files

package domain

import "github.com/dnnrly/abbreviate/domain"

Index

Package Files

matcher.go shorteners.go

func AsOriginal Uses

func AsOriginal(matcher *Matcher, original string, max int) string

AsOriginal discovers words using camel case and non letter characters, starting from the back until the string has less than 'max' characters or it can't shorten any more.

func AsPascal Uses

func AsPascal(matcher *Matcher, original string, max int) string

AsPascal discovers words using camel case and non letter characters, starting from the back 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 AsSnake Uses

func AsSnake(matcher *Matcher, original, separator string, max int) string

AsSnake discovers words using camel case and non letter characters, starting from the back 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

type Matcher Uses

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

Matcher finds matches between words and abbreviations

func NewMatcherFromString Uses

func NewMatcherFromString(data string) *Matcher

NewMatcherFromString creates a new matcher from newline seperated data

func (Matcher) All Uses

func (matcher Matcher) All() []string

All of the abbreviations in this set in order of the linked word

func (Matcher) Match Uses

func (matcher Matcher) Match(word string) string

Match against a list of mappings

type Sequences Uses

type Sequences []string

Sequences represents a string that has been broken in to different parts of words and separators

func NewSequences Uses

func NewSequences(original string) Sequences

NewSequences generates a new Sequences from the string passed in

func (*Sequences) AddBack Uses

func (all *Sequences) AddBack(str string)

AddBack adds a new string to the back of the Sequences

func (*Sequences) AddFront Uses

func (all *Sequences) AddFront(str string)

AddFront adds a new string to the front of the Sequences

func (Sequences) Len Uses

func (all Sequences) Len() int

Len gives the number of sequences found

func (Sequences) String Uses

func (all Sequences) String() string

type Shortener Uses

type Shortener func(matcher Matcher, original string, max int) string

Shortener represents an algorithm that can be used to shorten a string by substituting words for abbreviations

Package domain imports 4 packages (graph) and is imported by 1 packages. Updated 2019-09-09. Refresh now. Tools for package owners.