language

package
v0.0.0-...-a30bc99 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package language provides structures and methods for dealing with languages, whether fictional or otherwise, in fantasy worlds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conjugate

func Conjugate(lang Language, root string, tense string) string

Conjugate returns the conjugated form of a root word given a tense

Types

type ConjugationRules

type ConjugationRules struct {
	SimplePresent            string `json:"simple_present"`
	SimplePast               string `json:"simple_past"`
	SimpleFuture             string `json:"simple_future"`
	PresentContinuous        string `json:"present_continuous"`
	PastContinuous           string `json:"past_continuous"`
	FutureContinuous         string `json:"future_continuous"`
	PresentPerfect           string `json:"present_perfect"`
	PastPerfect              string `json:"past_perfect"`
	FuturePerfect            string `json:"future_perfect"`
	PresentPerfectContinuous string `json:"present_perfect_continuous"`
	PastPerfectContinuous    string `json:"past_perfect_continuous"`
	FuturePerfectContinuous  string `json:"future_perfect_continuous"`
}

ConjugationRules is a set of templates to be applied to a word depending on its tense

type Language

type Language struct {
	Name                    string            `json:"name"`
	Adjective               string            `json:"adjective"`
	Descriptors             []string          `json:"descriptors"`
	Description             string            `json:"description"`
	SamplePhrase            string            `json:"sample_phrase"`
	SamplePhraseTranslation string            `json:"sample_phrase_translation"`
	WritingSystem           writing.System    `json:"writing_system"`
	WordList                map[string]string `json:"word_list"`
	FemaleFirstNames        []string          `json:"female_first_names"`
	MaleFirstNames          []string          `json:"male_first_names"`
	FamilyNames             []string          `json:"family_names"`
	TownNames               []string          `json:"town_names"`
	VerbConjugationRules    ConjugationRules  `json:"conjugation_rules"`
	IsTonal                 bool              `json:"is_tonal"`
	NewWordPrefixes         []string          `json:"new_word_prefixes"`
	NewWordSuffixes         []string          `json:"new_word_suffixes"`
}

Language is a spoken language

func PremadeCommon

func PremadeCommon() (Language, error)

PremadeCommon returns the Common language

func (Language) Describe

func (language Language) Describe() string

Describe describes a Language as a string

func (Language) NewWord

func (language Language) NewWord() (string, error)

NewWord returns a new word for the language using random components

func (Language) RandomFamilyName

func (language Language) RandomFamilyName() (string, error)

RandomFamilyName returns a random male first name

func (Language) RandomFemaleFirstName

func (language Language) RandomFemaleFirstName() (string, error)

RandomFemaleFirstName returns a random female first name

func (Language) RandomMaleFirstName

func (language Language) RandomMaleFirstName() (string, error)

RandomMaleFirstName returns a random male first name

func (Language) RandomNameList

func (language Language) RandomNameList(numberOfNames int, nameType string) ([]string, error)

RandomNameList returns a list of N unique names of the given type

func (Language) RandomTownName

func (language Language) RandomTownName() (string, error)

RandomTownName returns a random male first name

func (Language) RosettaStone

func (language Language) RosettaStone() string

RosettaStone generates a version of a common phrase in the language

func (Language) Simplify

func (language Language) Simplify() SimplifiedLanguage

Simplify creates a simplified version of a language for display

func (Language) TranslatePhrase

func (language Language) TranslatePhrase(phrase string) string

TranslatePhrase parses a phrase and returns the translated version

func (Language) TranslateWord

func (language Language) TranslateWord(word string) string

TranslateWord returns the translated version of the word

type SimplifiedLanguage

type SimplifiedLanguage struct {
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Phrase      string            `json:"phrase"`
	Translation string            `json:"translation"`
	WordList    map[string]string `json:"word_list"`
}

SimplifiedLanguage is a simplified version of Language meant for display

type Word

type Word struct {
	Root string
}

Word is a simple wrapper for use in conjugations

Jump to

Keyboard shortcuts

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