brassica-0.0.3: Featureful sound change applier
Safe HaskellSafe-Inferred
LanguageHaskell2010

Brassica.Paradigm

Synopsis

Types

data Process Source #

Represents a single morphophonological process: currently, either prefixation or suffixation of a String. The Int gives the distance of the affix from the root.

Constructors

Prefix Int String 
Suffix Int String 

Instances

Instances details
Show Process Source # 
Instance details

Defined in Brassica.Paradigm.Types

Eq Process Source # 
Instance details

Defined in Brassica.Paradigm.Types

Methods

(==) :: Process -> Process -> Bool #

(/=) :: Process -> Process -> Bool #

type Affix = [Process] Source #

A single affix (using the term in a wide sense) can be thought of as a list of morphophonological processes. For instance, the Berber feminine circumfix t--t might be represented as [Prefix 1 "t", Suffix 1 "t"] :: Affix.

data Grammeme Source #

A Grammeme represents one value of a grammatical feature: for instance past, or dual. This can be realised as a Concrete affix, or can be left Abstract so that it can be encoded in a cumulative morph or similar.

(The name is from Wikipedia; it doesn’t seem widely-used, but I can find no better for this concept.)

Instances

Instances details
Show Grammeme Source # 
Instance details

Defined in Brassica.Paradigm.Types

Eq Grammeme Source # 
Instance details

Defined in Brassica.Paradigm.Types

data Condition Source #

A condition which must be satisfied before including a Feature in a word.

Constructors

Always

Condition which is always satisfied

Is FeatureName Grammeme

Satisfied when the specified feature (identified by its name) has been assigned to the specified Grammeme

Not FeatureName Grammeme

Satisfied when the specified feature has not been assigned to the specified Grammeme

Instances

Instances details
Show Condition Source # 
Instance details

Defined in Brassica.Paradigm.Types

Eq Condition Source # 
Instance details

Defined in Brassica.Paradigm.Types

data Feature Source #

A grammatical feature, which may be realised by one of a selection of Grammemes. A feature may be given a descriptive name, as well as a condition which must be satisfied for the Feature to be included in a word.

Instances

Instances details
Show Feature Source # 
Instance details

Defined in Brassica.Paradigm.Types

Eq Feature Source # 
Instance details

Defined in Brassica.Paradigm.Types

Methods

(==) :: Feature -> Feature -> Bool #

(/=) :: Feature -> Feature -> Bool #

newtype FeatureName Source #

Constructors

FeatureName String 

Instances

Instances details
IsString FeatureName Source # 
Instance details

Defined in Brassica.Paradigm.Types

Show FeatureName Source # 
Instance details

Defined in Brassica.Paradigm.Types

Eq FeatureName Source # 
Instance details

Defined in Brassica.Paradigm.Types

data Statement Source #

Each statement in a paradigm description specifies either a new Feature, or a new mapping from a set of abstract grammemes to their realisation.

Instances

Instances details
Show Statement Source # 
Instance details

Defined in Brassica.Paradigm.Types

Eq Statement Source # 
Instance details

Defined in Brassica.Paradigm.Types

type Paradigm = [Statement] Source #

A paradigm is specified as a list of Statements. The list is basically big-endian, in that the slowest-varying feature should be listed first. (So if e.g. tense is listed first, then first all words of tense 1 are listed, next all words of tense 2 are listed, and so on.)

Application

applyParadigm :: Paradigm -> String -> [String] Source #

Apply the given Paradigm to a root, to produce all possible derived forms.

Parsing

parseParadigm :: String -> Either (ParseErrorBundle String Void) Paradigm Source #

Parse a String in Brassica paradigm syntax into a Paradigm. Returns Left if the input string is malformed.

For details on the syntax, refer to https://github.com/bradrn/brassica/blob/v0.0.3/Documentation.md#paradigm-builder.

Re-export

errorBundlePretty #

Arguments

:: (VisualStream s, TraversableStream s, ShowErrorComponent e) 
=> ParseErrorBundle s e

Parse error bundle to display

-> String

Textual rendition of the bundle

Pretty-print a ParseErrorBundle. All ParseErrors in the bundle will be pretty-printed in order together with the corresponding offending lines by doing a single pass over the input stream. The rendered String always ends with a newline.

Since: megaparsec-7.0.0