pronouns

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: MIT Imports: 2 Imported by: 0

README

Pronouns

This is meant to make working with pronouns dynamically a lot easier.

The standardPronouns variable isn't meant to be a full list. Developers can manage their own pronoun lists.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HeHim    = Pronoun{"he", "him", "his", "his", "himself"}
	SheHer   = Pronoun{"she", "her", "her", "hers", "herself"}
	TheyThem = Pronoun{"they", "them", "their", "theirs", "themself"}
	ItIts    = Pronoun{"it", "it", "its", "its", "itself"}
	OneOnes  = Pronoun{"one", "one", "one's", "one's", "oneself"}
)

Binary and normative-ish forms from https://en.pronouns.page/pronouns

View Source
var ErrInvalidPronounString = errors.New("invalid pronoun string")

Functions

This section is empty.

Types

type Pronoun

type Pronoun struct {
	Subject, Object, Possessive, PossessivePronoun, Reflexive string
}

Pronoun holds the 5 main forms of a pronoun in English

func FindPronoun

func FindPronoun(v string) (Pronoun, error)

FindPronoun is a utility function which uses the defaultFinder

func ParsePronounString

func ParsePronounString(v string) (Pronoun, error)

ParsePronounString splits the string a/b/c/d/e into the 5 separate components in the Pronoun struct.

This trims any spaces around the 5 separate components.

Errors are returned as (empty, ErrInvalidPronounString)

func (Pronoun) Long

func (p Pronoun) Long() string

Long returns the full 5 components

func (Pronoun) String

func (p Pronoun) String() string

String returns the short form output: he/him, she/her etc...

type PronounFinder

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

PronounFinder is used to find the pronoun struct based on the short form representation.

func NewPronounFinder

func NewPronounFinder(p []Pronoun, std bool) *PronounFinder

NewPronounFinder creates a PronounFinder using the listed pronouns. Set std to true to load the standardPronouns as well.

func (*PronounFinder) Find

func (p *PronounFinder) Find(v string) (Pronoun, error)

Find locates the pronoun matching the input short string. "he/him", "he / him" -> HeHim "she/her", "she / her" -> SheHer

Jump to

Keyboard shortcuts

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