Copyright | See LICENSE file |
---|---|
License | BSD3 |
Maintainer | Brad Neimann |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Brassica.SoundChange.Frontend.Internal
Description
Warning: This module is internal, and does not follow the Package Versioning Policy. It may be useful for extending Brassica, but be prepared to track development closely if you import this module.
This module exists primarily as an internal common interface for Brassica’s two ‘official’ GUI frontends (desktop and web). If you wish to make your own frontend to Brassica, it is probably easier to write it yourself rather than trying to use this.
Synopsis
- data ApplicationMode
- getOutputMode :: ApplicationMode -> OutputMode
- data HighlightMode
- data OutputMode
- data ApplicationOutput a r
- = HighlightedWords [Component (a, Bool)]
- | AppliedRulesTable [Log r]
- | ParseError (ParseErrorBundle String Void)
- data MDFHierarchy
- data InputLexiconFormat
- = Raw
- | MDF MDFHierarchy
- data ParseOutput a
- tokeniseAccordingToInputFormat :: InputLexiconFormat -> OutputMode -> SoundChanges Expanded GraphemeList -> String -> Either (ParseErrorBundle String Void) [Component PWord]
- parseTokeniseAndApplyRules :: (forall a b. (a -> b) -> [Component a] -> [Component b]) -> SoundChanges Expanded GraphemeList -> String -> InputLexiconFormat -> ApplicationMode -> Maybe [Component PWord] -> ApplicationOutput PWord (Statement Expanded GraphemeList)
Documentation
data ApplicationMode Source #
Rule application mode of the SCA.
Constructors
ApplyRules HighlightMode OutputMode String | Apply sound changes as normal, with the given modes and separator |
ReportRulesApplied | Apply reporting the rules which were applied (as HTML) |
Instances
Show ApplicationMode Source # | |
Defined in Brassica.SoundChange.Frontend.Internal Methods showsPrec :: Int -> ApplicationMode -> ShowS # show :: ApplicationMode -> String # showList :: [ApplicationMode] -> ShowS # | |
Eq ApplicationMode Source # | |
Defined in Brassica.SoundChange.Frontend.Internal Methods (==) :: ApplicationMode -> ApplicationMode -> Bool # (/=) :: ApplicationMode -> ApplicationMode -> Bool # |
getOutputMode :: ApplicationMode -> OutputMode Source #
Get the OutputMode
if one is set, otherwise default to
WordsOnlyOutput
.
data HighlightMode Source #
Mode for highlighting output words
Constructors
NoHighlight | |
DifferentToLastRun | |
DifferentToInput | NB. now labeled ‘any rule applied’ in GUI |
Instances
Enum HighlightMode Source # | |
Defined in Brassica.SoundChange.Frontend.Internal Methods succ :: HighlightMode -> HighlightMode # pred :: HighlightMode -> HighlightMode # toEnum :: Int -> HighlightMode # fromEnum :: HighlightMode -> Int # enumFrom :: HighlightMode -> [HighlightMode] # enumFromThen :: HighlightMode -> HighlightMode -> [HighlightMode] # enumFromTo :: HighlightMode -> HighlightMode -> [HighlightMode] # enumFromThenTo :: HighlightMode -> HighlightMode -> HighlightMode -> [HighlightMode] # | |
Show HighlightMode Source # | |
Defined in Brassica.SoundChange.Frontend.Internal Methods showsPrec :: Int -> HighlightMode -> ShowS # show :: HighlightMode -> String # showList :: [HighlightMode] -> ShowS # | |
Eq HighlightMode Source # | |
Defined in Brassica.SoundChange.Frontend.Internal Methods (==) :: HighlightMode -> HighlightMode -> Bool # (/=) :: HighlightMode -> HighlightMode -> Bool # |
data OutputMode Source #
Mode for reporting output words (and sometimes intermediate and input words too)
Constructors
MDFOutput | |
WordsOnlyOutput | |
MDFOutputWithEtymons | |
WordsWithProtoOutput | |
WordsWithProtoOutputPreserve |
Instances
Enum OutputMode Source # | |
Defined in Brassica.SoundChange.Frontend.Internal Methods succ :: OutputMode -> OutputMode # pred :: OutputMode -> OutputMode # toEnum :: Int -> OutputMode # fromEnum :: OutputMode -> Int # enumFrom :: OutputMode -> [OutputMode] # enumFromThen :: OutputMode -> OutputMode -> [OutputMode] # enumFromTo :: OutputMode -> OutputMode -> [OutputMode] # enumFromThenTo :: OutputMode -> OutputMode -> OutputMode -> [OutputMode] # | |
Show OutputMode Source # | |
Defined in Brassica.SoundChange.Frontend.Internal Methods showsPrec :: Int -> OutputMode -> ShowS # show :: OutputMode -> String # showList :: [OutputMode] -> ShowS # | |
Eq OutputMode Source # | |
Defined in Brassica.SoundChange.Frontend.Internal |
data ApplicationOutput a r Source #
Output of a single application of rules to a wordlist: either a list of possibly highlighted words, an applied rules table, or a parse error.
Constructors
HighlightedWords [Component (a, Bool)] | |
AppliedRulesTable [Log r] | |
ParseError (ParseErrorBundle String Void) |
Instances
data MDFHierarchy Source #
For MDF input, the hierarchy used
Instances
Show MDFHierarchy Source # | |
Defined in Brassica.SoundChange.Frontend.Internal Methods showsPrec :: Int -> MDFHierarchy -> ShowS # show :: MDFHierarchy -> String # showList :: [MDFHierarchy] -> ShowS # | |
Eq MDFHierarchy Source # | |
Defined in Brassica.SoundChange.Frontend.Internal |
data InputLexiconFormat Source #
Kind of input: either a raw wordlist, or an MDF file.
Constructors
Raw | |
MDF MDFHierarchy |
Instances
data ParseOutput a Source #
Instances
tokeniseAccordingToInputFormat :: InputLexiconFormat -> OutputMode -> SoundChanges Expanded GraphemeList -> String -> Either (ParseErrorBundle String Void) [Component PWord] Source #
Given the selected input and output modes, and the expanded sound changes, tokenise the input according to the format which was selected
parseTokeniseAndApplyRules Source #
Arguments
:: (forall a b. (a -> b) -> [Component a] -> [Component b]) | mapping function to use (for parallelism) |
-> SoundChanges Expanded GraphemeList | changes |
-> String | words |
-> InputLexiconFormat | |
-> ApplicationMode | |
-> Maybe [Component PWord] | previous results |
-> ApplicationOutput PWord (Statement Expanded GraphemeList) |
Top-level dispatcher for an interactive frontend: given a textual wordlist and a list of sound changes, returns the result of running the changes in the specified mode.