phonetic-languages-phonetics-basics-0.9.1.0: A library for working with generalized phonetic languages usage.
Copyright(c) OleksandrZhabenko 2021
LicenseMIT
Maintainerolexandr543@yahoo.com
StabilityExperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010
Extensions
  • Cpp
  • UnboxedTuples
  • BangPatterns
  • MagicHash

Data.Phonetic.Languages.Base

Description

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

Phonetics representation data type for the phonetic languages approach.

data PhoneticsRepresentationPL Source #

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

data PhoneticsRepresentationPLX Source #

Extended variant of the PhoneticsRepresentationPL 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. While the char function can be used to group PhoneticRepresentationPLX that represents some phenomenae, for the phonetic languages approach the string1 is used in the most cases.

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 #

The intermediate representation of the phonetic languages data. Is used during conversions.

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.

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.

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.

Auxiliary functions

fHelp4 :: (a -> Bool) -> (a -> Bool) -> (a -> Bool) -> (a -> Bool) -> [a] -> ([a], [a], [a], [a]) Source #

Splits the given list using 4 predicates into tuple of 4 lists of elements satisfying the predicates in the order being preserved.

findSAI :: PhoneticRepresentationXInter -> (String, String) -> Array Int PhoneticsRepresentationPLX -> Maybe PhoneticsRepresentationPLX Source #

Finds and element in the Array that the corresponding PhoneticsRepresentationPLX from the first argument is ~= to the it. The String arguments inside the tuple pair are the beforeString and the afterString elements of it to be used in Right case.

Some class extensions for Eq and Ord type classes

(~=) :: PhoneticsRepresentationPL -> PhoneticsRepresentationPLX -> Bool Source #

Partial equivalence that is used to find the appropriate PhoneticsRepresentationPL for the class of PhoneticsRepresentationPLX values.

compareG :: PhoneticsRepresentationPL -> PhoneticsRepresentationPLX -> Ordering Source #

Partial equivalence that is used to find the appropriate PhoneticsRepresentationPL for the class of PhoneticsRepresentationPLX values.