lism

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package lism 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 individually (e.g. USA).

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exist

func Exist(p Path) bool

Exist returns true if the URL path has an initialism.

Example:

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

import (
	"fmt"

	"github.com/Defacto2/server/handler/releaser/lism"
)

func main() {
	fmt.Println(lism.Exist("defacto2"))
}
Output:
true

func Initialism

func Initialism(p 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/server/handler/releaser/lism"
)

func main() {
	fmt.Println(lism.Initialism("defacto2"))
}
Output:
[DF2 DF]

func String

func String(p Path) string

String 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:

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

import (
	"fmt"

	"github.com/Defacto2/server/handler/releaser/lism"
)

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

	fmt.Println(lism.String("united-software-association*fairlight")) // USA
}
Output:
FiRM, FRM
USA/Fairlight, USA/FLT, USA

Types

type List

type List map[Path][]string

List maps the initialisms and acronyms of the releasers.

func Copy

func Copy() List

Copy returns a copy of the [initialisms].

Example
package main

import (
	"fmt"
	"slices"

	"github.com/Defacto2/server/handler/releaser/lism"
)

func main() {
	const want = "USA"
	for path, names := range lism.Copy() {
		if slices.Contains(names, want) {
			fmt.Printf("The uri for %v: %v\n", want, path)
		}
	}
}
Output:
The uri for USA: united-software-association*fairlight

type Path

type Path string

Path is the partial URL path of the releaser.

func Find

func Find(s string) []Path

Find returns the uri Paths that match the given acronym/initialism. Most matches will only return a single path, however, there are situations where two or more releases shared the same initialism.

Example:

Find("Firm") = []Path{"the-firm"}
Example
package main

import (
	"fmt"

	"github.com/Defacto2/server/handler/releaser/lism"
)

func main() {
	fmt.Println(lism.Find("Firm"))
}
Output:
[the-firm]

func FindOne

func FindOne(s string) Path

FindOne returns the uri Path of the given acronym/initialism. However, there are siutations where two or more releasers shared the same initialism, so returned Path may not be accurate.

Jump to

Keyboard shortcuts

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