Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Brassica.Paradigm
Contents
Synopsis
- data Process
- type Affix = [Process]
- data Grammeme
- newtype AbstractGrammeme = AbstractGrammeme String
- data Condition
- data Feature = Feature Condition (Maybe FeatureName) [Grammeme]
- newtype FeatureName = FeatureName String
- data Statement
- type Paradigm = [Statement]
- applyParadigm :: Paradigm -> String -> [String]
- parseParadigm :: String -> Either (ParseErrorBundle String Void) Paradigm
- errorBundlePretty :: (VisualStream s, TraversableStream s, ShowErrorComponent e) => ParseErrorBundle s e -> String
Types
Represents a single morphophonological process: currently, either
prefixation or suffixation of a String
. The Int
gives the
distance of the affix from the root.
Instances
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.)
Constructors
Concrete Affix | |
Abstract AbstractGrammeme |
newtype AbstractGrammeme Source #
An abstract identifier for a Grammeme
.
Constructors
AbstractGrammeme String |
Instances
IsString AbstractGrammeme Source # | |
Defined in Brassica.Paradigm.Types Methods fromString :: String -> AbstractGrammeme # | |
Show AbstractGrammeme Source # | |
Defined in Brassica.Paradigm.Types Methods showsPrec :: Int -> AbstractGrammeme -> ShowS # show :: AbstractGrammeme -> String # showList :: [AbstractGrammeme] -> ShowS # | |
Eq AbstractGrammeme Source # | |
Defined in Brassica.Paradigm.Types Methods (==) :: AbstractGrammeme -> AbstractGrammeme -> Bool # (/=) :: AbstractGrammeme -> AbstractGrammeme -> Bool # |
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 |
Not FeatureName Grammeme | Satisfied when the specified feature has not been assigned
to the specified |
A grammatical feature, which may be realised by one of a
selection of Grammeme
s. 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.
Constructors
Feature Condition (Maybe FeatureName) [Grammeme] |
Instances
newtype FeatureName Source #
Constructors
FeatureName String |
Instances
IsString FeatureName Source # | |
Defined in Brassica.Paradigm.Types Methods fromString :: String -> FeatureName # | |
Show FeatureName Source # | |
Defined in Brassica.Paradigm.Types Methods showsPrec :: Int -> FeatureName -> ShowS # show :: FeatureName -> String # showList :: [FeatureName] -> ShowS # | |
Eq FeatureName Source # | |
Defined in Brassica.Paradigm.Types |
Each statement in a paradigm description specifies either a new
Feature
, or a new mapping from a set of abstract grammemes to
their realisation.
Constructors
NewFeature Feature | |
NewMapping [AbstractGrammeme] Affix |
type Paradigm = [Statement] Source #
A paradigm is specified as a list of Statement
s. 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.1.0/Documentation.md#paradigm-builder.
Re-export
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 ParseError
s 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