phonology

package
v0.0.0-...-3cf9651 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consonant

type Consonant struct {
	Place          ConsonantPlace          `json:"place"`          // Dental, Velar, etc.
	Manner         ConsonantManner         `json:"manner"`         // Plosive, Nasal, Approximant, etc.
	Coarticulation ConsonantCoarticulation `json:"coarticulation"` // Labialized, Palatalized, Velarized, etc.
	NonPulmonic    ConsonantNonPulmonic    `json:"nonpulmonic"`    // Ejective, Implosive, Velaric
	Voiced         ConsonantVoice          `json:"voiced"`         // Voiced / Voiceless
	Aspirated      ConsonantAspiration     `json:"aspirated"`      // Aspirated / Unaspirated
	Lateral        ConsonantLateral        `json:"lateral"`        // Lateral / Central
	Sibilant       ConsononantSibilance    `json:"sibilant"`       // Sibilant / Nonsibilant
	Geminate       ConsonantGeminate       `json:"geminate"`       // Geminated / Singleton
}

Consonant represents a consonant phoneme

func NewConsonantFromIPA

func NewConsonantFromIPA(s string) (Consonant, error)

NewConsonantFromIPA creates a Consonant from an IPA string

func (Consonant) MarshalJSON

func (c Consonant) MarshalJSON() ([]byte, error)

MarshalJSON to implement Marshaler interface for type Consonant converts Consonant structs into the JS format used on the frontend

func (Consonant) Match

func (c Consonant) Match(pattern Phoneme) bool

Match returns true if the Consonant matches the specified features in the pattern Each field's zero value denotes an unspecified feature, such that Consonant{} as a pattern param will match any consonant. If the pattern is not a Consonant, however, it will be caught with the asConsonant() Phoneme method and return false Note that the pattern param may be partially described, but the receiver should not

func (Consonant) ToIPA

func (c Consonant) ToIPA() string

ToIPA returns the IPA representation of a Consonant struct

func (*Consonant) UnmarshalJSON

func (c *Consonant) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the Unmarshaler interface for type Consonant

type ConsonantAspiration

type ConsonantAspiration uint8

ConsonantAspiration is whether a consonant is aspirated or not

const (
	UnspecifiedCA ConsonantAspiration = iota
	UnaspiratedCA
	AspiratedCA
)

ConsonantAspiration values

type ConsonantCoarticulation

type ConsonantCoarticulation uint8

ConsonantCoarticulation is the presence of coarticulations with a consonant, like palatization or pharyngealization

const (
	UnspecifiedCC ConsonantCoarticulation = iota
	NoneCC
	LabialCC
	PalatalCC
	VelarCC
	PharyngealCC
	PrenasalCC
)

ConsonantCoarticulation values

type ConsonantGeminate

type ConsonantGeminate uint8

ConsonantGeminate is whether a consonant is a singleton or geminate

const (
	UnspecifiedCG ConsonantGeminate = iota
	SingletonCG
	GeminateCG
)

ConsonantGeminate values

type ConsonantJSON

type ConsonantJSON struct {
	IPA         string `json:"ipa"`
	Manner      string `json:"manner"`
	Place       string `json:"place"`
	Voiced      bool   `json:"voiced"`
	NonPulmonic string `json:"nonpulmonic"`
	Aspirated   bool   `json:"aspirated"`
	Lateral     bool   `json:"lateral"`
	Sibilant    bool   `json:"sibilant"`
}

ConsonantJSON is an intermediate form of the Consonant type, mirroring the simplified version used on the frontend, used for marshalling and unmarshalling

func (ConsonantJSON) FromJSON

func (cj ConsonantJSON) FromJSON() Consonant

FromJSON converts ConsonantJSON structs into Consonant

type ConsonantLateral

type ConsonantLateral uint8

ConsonantLateral denotes whether a consonant is articulated centrally or laterally

const (
	UnspecifiedCL ConsonantLateral = iota
	CentralCL
	LateralCL
)

ConsonantLateral values

type ConsonantManner

type ConsonantManner uint8

ConsonantManner is the manner of articulation for consonants

const (
	UnspecifiedCM ConsonantManner = iota
	NasalCM
	StopCM
	AffricateCM
	FricativeCM
	ApproximantCM
	TapCM
	TrillCM
	ClickCM
)

ConsonantManner values

type ConsonantNonPulmonic

type ConsonantNonPulmonic uint8

ConsonantNonPulmonic denotes non-pulmonic articulations, like ejectives and clicks

const (
	UnspecifiedCNP ConsonantNonPulmonic = iota
	PulmonicCNP
	EjectiveCNP
	ImplosiveCNP
	VelaricCNP
)

ConsonantNonPulmonic values

type ConsonantPlace

type ConsonantPlace uint8

ConsonantPlace is the place of articulation for consonants

const (
	UnspecifiedCP ConsonantPlace = iota
	BilabialCP
	LabioDentalCP
	DentalCP
	AlveolarCP
	PostAlveolarCP
	RetroflexCP
	PalatalCP
	VelarCP
	UvularCP
	PharyngealCP
	GlottalCP
)

ConsonantPlace values

type ConsonantVoice

type ConsonantVoice uint8

ConsonantVoice is whether a consonant is voiced or not

const (
	UnspecifiedCV ConsonantVoice = iota
	UnvoicedCV
	VoicedCV
	PrevoicedCV // this could alternatively be included in Aspiration
)

ConsonantVoice values

type ConsononantSibilance

type ConsononantSibilance uint8

ConsononantSibilance is whether a consonant is sibilant or not

const (
	UnspecifiedCS ConsononantSibilance = iota
	NonsibilantCS
	SibilantCS
)

ConsononantSibilance values

type Inventory

type Inventory struct {
	LanguageID string      `json:"lang_id" bson:"lang_id"`
	Vowels     []Vowel     `json:"vowels" bson:"vowels"`
	Consonants []Consonant `json:"consonants" bson:"consonants"`
}

Inventory represents the phonological inventory of a language, essentially just lists of consonant and vowel phonemes

func NewInventory

func NewInventory(phonemes []string) *Inventory

NewInventory creates a pointer to a phonological Inventory out of a slice of IPA strings

func (*Inventory) ToIPA

func (i *Inventory) ToIPA() InventoryIPA

ToIPA converts a Inventory struct to an InventoryIPA struct to send to the frontend

type InventoryIPA

type InventoryIPA struct {
	LanguageID string   `json:"lang_id" bson:"lang_id"`
	Vowels     []string `json:"vowels" bson:"vowels"`
	Consonants []string `json:"consonants" bson:"consonants"`
}

InventoryIPA ...

type Phoneme

type Phoneme interface {
	ToIPA() string
	Match(Phoneme) bool
	// contains filtered or unexported methods
}

Phoneme is a consonant or a vowel that can be represented with IPA, and perhaps with XSAMPA and various orthographies in the future The Match method returns whether a Phoneme matches the specified features, and the asVowel, asConsonant methods are slightly hacky ways to make Match work across Phoneme types

type Vowel

type Vowel struct {
	Height    VowelHeight    `json:"height" bson:"height"`       // Close, NearClose, CloseMid, etc.
	Frontness VowelFrontness `json:"frontness" bson:"frontness"` // Front, Mid, Back
	Phonation VowelPhonation `json:"phonation" bson:"phonation"` // Modal, Breathy, Creaky, Devoiced
	Rounding  VowelRounding  `json:"rounding" bson:"rounding"`   // Rounded / Unrounded
	Nasal     VowelNasality  `json:"nasal" bson:"nasal"`         // Nasal / Oral
	Length    VowelLength    `json:"length" bson:"length"`       // Long / Short
}

Vowel represents a vowel phoneme

func NewVowelFromIPA

func NewVowelFromIPA(s string) (Vowel, error)

NewVowelFromIPA creates a Vowel from an IPA string

func (Vowel) MarshalJSON

func (v Vowel) MarshalJSON() ([]byte, error)

MarshalJSON to implement Marshaler interface for type Vowel converts Vowel structs into the JS format used on the frontend

func (Vowel) Match

func (v Vowel) Match(pattern Phoneme) bool

Match returns true if the Vowel matches the specified features in the pattern Each field's zero value denotes an unspecified feature, such that Vowel{} as a pattern param will match any vowel. If the pattern is not a Vowel, however, it will be caught with the asVowel() Phoneme method and return false Note that the pattern param may be partially described, but the receiver should not

func (Vowel) ToIPA

func (v Vowel) ToIPA() string

ToIPA returns the IPA representation of a Vowel struct

func (*Vowel) UnmarshalJSON

func (v *Vowel) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the Unmarshaler interface for type Vowel

type VowelFrontness

type VowelFrontness uint8

VowelFrontness is the frontness of the vowel

const (
	UnspecifiedVF VowelFrontness = iota
	FrontVF
	CentralVF
	BackVF
)

VowelFrontness values

type VowelHeight

type VowelHeight uint8

VowelHeight is the height of the vowel

const (
	UnspecifiedVH VowelHeight = iota
	CloseVH
	NearCloseVH
	CloseMidVH
	MidVH
	OpenMidVH
	NearOpenVH
	OpenVH
)

VowelHeight values

type VowelJSON

type VowelJSON struct {
	IPA       string `json:"ipa"`
	Height    string `json:"height"`
	Frontness string `json:"frontness"`
	Rounding  bool   `json:"rounding"`
	Nasal     bool   `json:"nasal"`
	Length    bool   `json:"long"`
}

VowelJSON is an intermediate form of the Vowel type, mirroring the simplified version used on the frontend, used for marshalling and unmarshalling

type VowelLength

type VowelLength uint8

VowelLength is whether a vowel is long or short

const (
	UnspecifiedVL VowelLength = iota
	ShortVL
	LongVL
	ExtraShortVL
	ExtraLongVL
)

VowelLength values

type VowelNasality

type VowelNasality uint8

VowelNasality is whether a vowel is nasal or oral

const (
	UnspecifiedVN VowelNasality = iota
	OralVN
	NasalVN
)

VowelNasality values

type VowelPhonation

type VowelPhonation uint8

VowelPhonation includes features such as creaky voice and devoiced vowels

const (
	UnspecifiedVP VowelPhonation = iota
	ModalVP
	DevoicedVP
	CreakyVP
	BreathyVP
)

VowelPhonation values

type VowelRounding

type VowelRounding uint8

VowelRounding is whether a vowel is rounded or not

const (
	UnspecifiedVR VowelRounding = iota
	RoundedVR
	UnroundedVR
)

VowelRounding values

type WordBoundary

type WordBoundary struct {
	Initial bool `json:"initial"`
}

WordBoundary is used as a dummy Phoneme for phonotactic trees to mark word boundaries and boundaries between syllables

func (WordBoundary) Match

func (b WordBoundary) Match(target Phoneme) bool

Match always returns whether a target Phoneme is a WordBoundary by checking that the target is not a Consonant or Vowel

func (WordBoundary) ToIPA

func (b WordBoundary) ToIPA() string

ToIPA for SyllableBoundary, either a "." for word-medial syllable breaks, or empty string for word-boundaries

Jump to

Keyboard shortcuts

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