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

Brassica.Paradigm

Contents

Synopsis

Documentation

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.)

data ResultsTree a Source #

Constructors

Node [ResultsTree a] 
Result a 

Instances

Instances details
Foldable ResultsTree Source # 
Instance details

Defined in Brassica.Paradigm.Apply

Methods

fold :: Monoid m => ResultsTree m -> m #

foldMap :: Monoid m => (a -> m) -> ResultsTree a -> m #

foldMap' :: Monoid m => (a -> m) -> ResultsTree a -> m #

foldr :: (a -> b -> b) -> b -> ResultsTree a -> b #

foldr' :: (a -> b -> b) -> b -> ResultsTree a -> b #

foldl :: (b -> a -> b) -> b -> ResultsTree a -> b #

foldl' :: (b -> a -> b) -> b -> ResultsTree a -> b #

foldr1 :: (a -> a -> a) -> ResultsTree a -> a #

foldl1 :: (a -> a -> a) -> ResultsTree a -> a #

toList :: ResultsTree a -> [a] #

null :: ResultsTree a -> Bool #

length :: ResultsTree a -> Int #

elem :: Eq a => a -> ResultsTree a -> Bool #

maximum :: Ord a => ResultsTree a -> a #

minimum :: Ord a => ResultsTree a -> a #

sum :: Num a => ResultsTree a -> a #

product :: Num a => ResultsTree a -> a #

Functor ResultsTree Source # 
Instance details

Defined in Brassica.Paradigm.Apply

Methods

fmap :: (a -> b) -> ResultsTree a -> ResultsTree b #

(<$) :: a -> ResultsTree b -> ResultsTree a #

Show a => Show (ResultsTree a) Source # 
Instance details

Defined in Brassica.Paradigm.Apply

applyParadigm :: Paradigm -> String -> ResultsTree String Source #

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

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.3.0/Documentation.md#paradigm-builder.

formatNested :: (a -> String) -> ResultsTree a -> String Source #

Formats a ResultsTree in a nested way, where the lowest-level elements are separated by one space, the second-lowest are separated by one newline, the third-lowest by two newlines, and so on.

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