initialism

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: BSD-2-Clause Imports: 1 Imported by: 2

Documentation

Overview

Package initialism provides a list of alternative spellings, acronyms and initialisms for the named releasers.

Alternative spellings are the same name but with different casing, spelling or punctuation (e.g. Coca-Cola, Coke).

An acronym is an abbreviation formed from the initial letters of other words and pronounced as a word (e.g. NATO).

An initialism is an abbreviation consisting of the initial letters pronounced invidivually (e.g. USA).

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialism

func Initialism(path Path) []string

Initialism returns the alternative spellings, acronyms and initialisms for the URL path. Or an empty slice if the URL path has no initialism.

Example:

Initialism("the-firm") = []string{"FiRM, FRM"}
Initialism("defacto2") = []string{"DF2"}
Example
package main

import (
	"fmt"

	"github.com/Defacto2/releaser/initialism"
)

func main() {
	fmt.Println(initialism.Initialism("defacto2"))
}
Output:

[DF2 DF]

func IsInitialism

func IsInitialism(path Path) bool

IsInitialism returns true if the URL path has an initialism.

Example:

IsInitialism("the-firm") = true
IsInitialism("defacto2") = true
IsInitialism("some-random-bbs") = false
Example
package main

import (
	"fmt"

	"github.com/Defacto2/releaser/initialism"
)

func main() {
	fmt.Println(initialism.IsInitialism("defacto2"))
}
Output:

true

func Join

func Join(path Path) string

Join returns the alternative spellings, acronyms and initialisms for the URL path as a comma separated string. Or an empty string if the URL path has no initialism.

Example:

Join("the-firm") = "FiRM, FRM"
Join("defacto2") = "DF2"
Example
package main

import (
	"fmt"

	"github.com/Defacto2/releaser/initialism"
)

func main() {
	fmt.Println(initialism.Join("the-firm")) // FiRM, FRM

	fmt.Println(initialism.Join("united-software-association")) // USA
}
Output:

FiRM, FRM
USA

Types

type List

type List map[Path][]string

List is a map of initialisms to releasers.

func Initialisms

func Initialisms() List

Initialisms returns the list of initialisms.

Example
package main

import (
	"fmt"

	"github.com/Defacto2/releaser/initialism"
)

func main() {
	const find = "USA"
	for k, v := range initialism.Initialisms() {
		for _, x := range v {
			if x == find {
				fmt.Printf("Found %v in %v\n", find, k)
				return
			}
		}
	}
}
Output:

Found USA in united-software-association

type Path

type Path string

A Path is the partial URL path of the releaser.

func Match added in v1.1.0

func Match(s string) []Path

Match returns the list of initialisms that match the given string.

Jump to

Keyboard shortcuts

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