Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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]
- data ResultsTree a
- = Node [ResultsTree a]
- | Result a
- depth :: ResultsTree a -> Int
- applyParadigm :: Paradigm -> String -> ResultsTree String
- parseParadigm :: String -> Either (ParseErrorBundle String Void) Paradigm
- formatNested :: (a -> String) -> ResultsTree a -> String
- errorBundlePretty :: (VisualStream s, TraversableStream s, ShowErrorComponent e) => ParseErrorBundle s e -> String
Documentation
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
newtype AbstractGrammeme Source #
An abstract identifier for a Grammeme
.
Instances
IsString AbstractGrammeme Source # | |
Defined in Brassica.Paradigm.Types fromString :: String -> AbstractGrammeme # | |
Show AbstractGrammeme Source # | |
Defined in Brassica.Paradigm.Types showsPrec :: Int -> AbstractGrammeme -> ShowS # show :: AbstractGrammeme -> String # showList :: [AbstractGrammeme] -> ShowS # | |
Eq AbstractGrammeme Source # | |
Defined in Brassica.Paradigm.Types (==) :: AbstractGrammeme -> AbstractGrammeme -> Bool # (/=) :: AbstractGrammeme -> AbstractGrammeme -> Bool # |
A condition which must be satisfied before including a Feature
in a word.
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 |
newtype FeatureName Source #
Instances
IsString FeatureName Source # | |
Defined in Brassica.Paradigm.Types fromString :: String -> FeatureName # | |
Show FeatureName Source # | |
Defined in Brassica.Paradigm.Types showsPrec :: Int -> FeatureName -> ShowS # show :: FeatureName -> String # showList :: [FeatureName] -> ShowS # | |
Eq FeatureName Source # | |
Defined in Brassica.Paradigm.Types (==) :: FeatureName -> FeatureName -> Bool # (/=) :: FeatureName -> FeatureName -> Bool # |
Each statement in a paradigm description specifies either a new
Feature
, or a new mapping from a set of abstract grammemes to
their realisation.
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.)
data ResultsTree a Source #
Node [ResultsTree a] | |
Result a |
Instances
depth :: ResultsTree a -> Int Source #
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
:: (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