Copyright | (c) OleksandrZhabenko 2021 |
---|---|
License | MIT |
Maintainer | olexandr543@yahoo.com |
Stability | Experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extensions | BangPatterns |
This is a computational scheme for generalized usage of the phonetic languages approach. It is intended to be exported qualified, so that the functions in every language implementation have the same names and signatures as these ones and the data type used here. It is may be not the most efficient implementation.
Synopsis
- data PhoneticsRepresentationPL
- = PR {
- string :: String
- afterString :: String
- beforeString :: String
- | PRAfter {
- string :: String
- afterString :: String
- | PRBefore {
- string :: String
- beforeString :: String
- | PREmpty { }
- = PR {
- data PhoneticsRepresentationPLX
- type Generations = Int8
- type InterGenerationsString = String
- type WritingSystemPRPLX = [PhoneticsRepresentationPLX]
- type GWritingSystemPRPLX = [([PhoneticsRepresentationPLX], Generations)]
- type PhoneticRepresentationXInter = Either PhoneticsRepresentationPLX InterGenerationsString
- type IGWritingSystemPRPLX = [(PhoneticRepresentationXInter, Generations)]
- fromX2PRPL :: PhoneticsRepresentationPLX -> PhoneticsRepresentationPL
- fromPhoneticRX :: [PhoneticsRepresentationPLX] -> [PhoneticRepresentationXInter] -> [PhoneticsRepresentationPLX]
- isPRC :: PhoneticsRepresentationPLX -> Bool
- isPRAfterC :: PhoneticsRepresentationPLX -> Bool
- isPRBeforeC :: PhoneticsRepresentationPLX -> Bool
- isPREmptyC :: PhoneticsRepresentationPLX -> Bool
- stringToXSG :: GWritingSystemPRPLX -> Generations -> String -> IGWritingSystemPRPLX
- stringToXG :: GWritingSystemPRPLX -> String -> [PhoneticsRepresentationPLX]
- stringToXS :: WritingSystemPRPLX -> String -> [String]
- string2X :: WritingSystemPRPLX -> String -> [PhoneticsRepresentationPLX]
- rulesX :: PhoneticsRepresentationPLX -> Char
Phonetics representation data type for the phonetic languages approach.
data PhoneticsRepresentationPL Source #
The intended conversion to the syllables for a written word is:
toSyllables . map rulesPR . stringToPRPL
The syllable after this is encoded with the representation with every Char
being some phonetic language phenomenon.
To see its usual written representation, use the defined showRepr
function (please, implement your own one).
PR | |
| |
PRAfter | |
| |
PRBefore | |
| |
PREmpty | |
Instances
data PhoneticsRepresentationPLX Source #
Extended variant of the PhoneticRepresentationPL
data type where the information for the Char
is encoded into the
data itself. Is easier to implement the rules in the separate file by just specifying the proper and complete list of
PhoneticsRepresentationPLX
values.
PRC | |
| |
PRAfterC | |
PRBeforeC | |
PREmptyC | |
Instances
type Generations = Int8 Source #
Each generation represents a subset of rules for representation transformation. The PhoneticsRepresentationPLX
are groupped by the generations so that in every group with the same generation number (Int8
value, typically starting
from 1) the rules represented have no conflicts with each other (this guarantees that they can be applied simultaneously
without the danger of incorrect interference). Usage of Generations
is a design decision and is inspired by the
GHC RULES pragma and the GHC compilation multistage process.
type InterGenerationsString = String Source #
Each value represents temporary intermediate resulting String
data to be transformed further into the representation.
type WritingSystemPRPLX = [PhoneticsRepresentationPLX] Source #
If the list here is proper and complete, then it usually represents the whole writing system of the language. For proper usage, the list must be sorted in the ascending order.
type GWritingSystemPRPLX = [([PhoneticsRepresentationPLX], Generations)] Source #
The 'dynamic' representation of the general writing system that specifies what transformations are made simultaneously
during the conversion to the phonetic languages phonetics representation. During transformations those elements that have
greater Generations
are used earlier than others. The last ones are used those elements with the Generations
element
equal to 0 that must correspond to the PREmptyC
constructor-built records. For proper usage, the lists on the first
place of the tuples must be sorted in the ascending order.
type PhoneticRepresentationXInter = Either PhoneticsRepresentationPLX InterGenerationsString Source #
type IGWritingSystemPRPLX = [(PhoneticRepresentationXInter, Generations)] Source #
The 'dynamic' representation of the process of transformation for the general writing system during the conversion. Is not intended to be produced by hand, but automatically by programs.
fromPhoneticRX :: [PhoneticsRepresentationPLX] -> [PhoneticRepresentationXInter] -> [PhoneticsRepresentationPLX] Source #
Functions to work with the one.
Predicates
Convert to the PhoneticsRepresentationPLX
.
stringToXG :: GWritingSystemPRPLX -> String -> [PhoneticsRepresentationPLX] Source #
The full conversion function. Applies conversion into representation using the GWritingSystemPRPLX
provided.
stringToXS :: WritingSystemPRPLX -> String -> [String] Source #
string2X :: WritingSystemPRPLX -> String -> [PhoneticsRepresentationPLX] Source #
Uses the simplest variant of the GWritingSystemPRPLX
with just two generations where all the PREmptyC
elements in the
WritingSystemPRPLX
are used in the last order. Can be suitable for simple languages (e. g. Esperanto).
Apply conversion from PhoneticsRepresentationPLX
.
rulesX :: PhoneticsRepresentationPLX -> Char Source #
An analogue of the rulesPR
function for PhoneticsRepresentationPLX
.