| Copyright | (c) OleksandrZhabenko 2021 |
|---|---|
| License | MIT |
| Maintainer | olexandr543@yahoo.com |
| Stability | Experimental |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
| Extensions |
|
Data.Phonetic.Languages.Syllables
Description
This module works with syllable segmentation. The generalized version for the module
Arr from ukrainian-phonetics-basic-array package.
Synopsis
- data PRS = SylS {
- charS :: !Char
- phoneType :: !PhoneticType
- data PhoneticType = P !Int8
- type CharPhoneticClassification = Array Int PRS
- type StringRepresentation = [PRS]
- data SegmentationInfo1 = SI {
- fieldN :: !Int8
- predicateN :: Int8
- data SegmentationPredFunction = PF (SegmentationInfo1 -> [(Char, Char)] -> [PRS] -> Bool)
- data SegmentationPredFData a b
- = L Int [Int] (Array Int a)
- | NEC Int Int (Array Int a) [b]
- | C (SegmentationPredFData a b) (SegmentationPredFData a b)
- | D (SegmentationPredFData a b) (SegmentationPredFData a b)
- type SegmentationFDP = SegmentationPredFData PRS (Char, Char)
- class Eval2Bool a where
- type DListFunctionResult = ([PRS] -> [PRS], [PRS] -> [PRS])
- data SegmentationLineFunction = LFS {}
- data SegmentationRules1 = SR1 {}
- type SegmentRulesG = [SegmentationRules1]
- class DListRepresentation a b where
- toDLR :: b -> [a] -> ([a] -> [a], [a] -> [a])
- str2PRSs :: CharPhoneticClassification -> String -> StringRepresentation
- sndGroups :: [PRS] -> [[PRS]]
- groupSnds :: [PRS] -> [[PRS]]
- divCnsnts :: [(Char, Char)] -> SegmentRulesG -> [PRS] -> DListFunctionResult
- reSyllableCntnts :: [(Char, Char)] -> SegmentRulesG -> [[PRS]] -> [[PRS]]
- divSylls :: [[PRS]] -> [[PRS]]
- createSyllablesPL :: GWritingSystemPRPLX -> [(Char, Char)] -> CharPhoneticClassification -> SegmentRulesG -> String -> String -> String -> [[[PRS]]]
- gBF4 :: Ix i => (# Int#, PRS #) -> (# Int#, PRS #) -> Char -> Array i PRS -> Maybe PRS
- findC :: Char -> Array Int PRS -> Maybe PRS
- createsSyllable :: PRS -> Bool
- isSonorous1 :: PRS -> Bool
- isVoicedC1 :: PRS -> Bool
- isVoicelessC1 :: PRS -> Bool
- notCreatesSyllable2 :: PRS -> PRS -> Bool
- notEqC :: [(Char, Char)] -> PRS -> PRS -> Bool
- fromPhoneticType :: PhoneticType -> Int
Data types and type synonyms
Constructors
| SylS | |
Fields
| |
data PhoneticType Source #
Instances
| Read PhoneticType Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods readsPrec :: Int -> ReadS PhoneticType # readList :: ReadS [PhoneticType] # | |
| Show PhoneticType Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods showsPrec :: Int -> PhoneticType -> ShowS # show :: PhoneticType -> String # showList :: [PhoneticType] -> ShowS # | |
| Eq PhoneticType Source # | |
Defined in Data.Phonetic.Languages.Syllables | |
| Ord PhoneticType Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods compare :: PhoneticType -> PhoneticType -> Ordering # (<) :: PhoneticType -> PhoneticType -> Bool # (<=) :: PhoneticType -> PhoneticType -> Bool # (>) :: PhoneticType -> PhoneticType -> Bool # (>=) :: PhoneticType -> PhoneticType -> Bool # max :: PhoneticType -> PhoneticType -> PhoneticType # min :: PhoneticType -> PhoneticType -> PhoneticType # | |
type StringRepresentation = [PRS] Source #
data SegmentationInfo1 Source #
Constructors
| SI | |
Fields
| |
Instances
| Read SegmentationInfo1 Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods readsPrec :: Int -> ReadS SegmentationInfo1 # readList :: ReadS [SegmentationInfo1] # | |
| Show SegmentationInfo1 Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods showsPrec :: Int -> SegmentationInfo1 -> ShowS # show :: SegmentationInfo1 -> String # showList :: [SegmentationInfo1] -> ShowS # | |
| Eq SegmentationInfo1 Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods (==) :: SegmentationInfo1 -> SegmentationInfo1 -> Bool # (/=) :: SegmentationInfo1 -> SegmentationInfo1 -> Bool # | |
| PhoneticElement SegmentationInfo1 Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods | |
data SegmentationPredFunction Source #
We can think of SegmentationPredFunction in terms of f (. Comparing with
SI fN pN) ks [x_{1},x_{2},...,x_{i},...,x_{fN}]divCnsnts from the ukrainian-phonetics-basics-array we can postulate that it consists of the following logical terms in
the symbolic form:
1) phoneType x_{i} `elem` (X{...} = map P [Int8])
2) notEqC ks x_{i} x_{j} (j /= i)
combined with the standard logic Boolean operations of (&&), (||) and not. Further, the not can be transformed into the
positive (affirmative) form using the notion of the universal set for the task. This transformation needs that the similar
phonetic phenomenae (e. g. the double sounds -- the prolonged ones) belong to the one syllable and not to the different ones
(so they are not related to different syllables, but just to the one and the same). Since such assumption has been used,
we can further represent the function by the following data type and operations with it, see SegmentationPredFData.
data SegmentationPredFData a b Source #
Constructors
| L Int [Int] (Array Int a) | |
| NEC Int Int (Array Int a) [b] | |
| C (SegmentationPredFData a b) (SegmentationPredFData a b) | |
| D (SegmentationPredFData a b) (SegmentationPredFData a b) |
Instances
| (Read a, Read b) => Read (SegmentationPredFData a b) Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods readsPrec :: Int -> ReadS (SegmentationPredFData a b) # readList :: ReadS [SegmentationPredFData a b] # readPrec :: ReadPrec (SegmentationPredFData a b) # readListPrec :: ReadPrec [SegmentationPredFData a b] # | |
| (Show a, Show b) => Show (SegmentationPredFData a b) Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods showsPrec :: Int -> SegmentationPredFData a b -> ShowS # show :: SegmentationPredFData a b -> String # showList :: [SegmentationPredFData a b] -> ShowS # | |
| (Eq a, Eq b) => Eq (SegmentationPredFData a b) Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods (==) :: SegmentationPredFData a b -> SegmentationPredFData a b -> Bool # (/=) :: SegmentationPredFData a b -> SegmentationPredFData a b -> Bool # | |
| Eval2Bool (SegmentationPredFData PRS (Char, Char)) Source # | |
Defined in Data.Phonetic.Languages.Syllables | |
type SegmentationFDP = SegmentationPredFData PRS (Char, Char) Source #
data SegmentationLineFunction Source #
Constructors
| LFS | |
Fields
| |
Instances
| Read SegmentationLineFunction Source # | |
Defined in Data.Phonetic.Languages.Syllables | |
| Show SegmentationLineFunction Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods showsPrec :: Int -> SegmentationLineFunction -> ShowS # show :: SegmentationLineFunction -> String # showList :: [SegmentationLineFunction] -> ShowS # | |
data SegmentationRules1 Source #
Constructors
| SR1 | |
Fields
| |
Instances
| Read SegmentationRules1 Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods readsPrec :: Int -> ReadS SegmentationRules1 # readList :: ReadS [SegmentationRules1] # | |
| Show SegmentationRules1 Source # | |
Defined in Data.Phonetic.Languages.Syllables Methods showsPrec :: Int -> SegmentationRules1 -> ShowS # show :: SegmentationRules1 -> String # showList :: [SegmentationRules1] -> ShowS # | |
type SegmentRulesG = [SegmentationRules1] Source #
List of the SegmentationRules1 sorted in the descending order by the fieldN SegmentationInfo1 data and where the
length of all the SegmentationPredFunction lists of PRS are equal to the fieldN SegmentationInfo1 data by definition.
class DListRepresentation a b where Source #
Basic functions
Arguments
| :: [(Char, Char)] | The pairs of the |
| -> SegmentRulesG | |
| -> [PRS] | |
| -> DListFunctionResult |
Function divCnsnts is used to divide groups of consonants into two-elements lists that later are made belonging to
different neighbour syllables if the group is between two vowels in a word. The group must be not empty, but this is not checked.
The example phonetical information for the proper performance in Ukrainian can be found from the:
https://msn.khnu.km.ua/pluginfile.php/302375/mod_resource/content/1/%D0%9B.3.%D0%86%D0%86.%20%D0%A1%D0%BA%D0%BB%D0%B0%D0%B4.%D0%9D%D0%B0%D0%B3%D0%BE%D0%BB%D0%BE%D1%81.pdf
The example of the divCnsnts can be found at: https://hackage.haskell.org/package/ukrainian-phonetics-basic-array-0.1.2.0/docs/src/Languages.Phonetic.Ukrainian.Syllable.Arr.html#divCnsnts
Arguments
| :: GWritingSystemPRPLX | Data used to obtain the phonetic language representation of the text. |
| -> [(Char, Char)] | The pairs of the |
| -> CharPhoneticClassification | |
| -> SegmentRulesG | |
| -> String | Corresponds to the 100 delimiter in the |
| -> String | Corresponds to the 101 delimiter in the |
| -> String | Actually the converted |
| -> [[[PRS]]] |
The function actually creates syllables using the provided data. Each resulting inner-most list is a phonetic language representation of the syllable according to the rules provided.
Auxiliary functions
gBF4 :: Ix i => (# Int#, PRS #) -> (# Int#, PRS #) -> Char -> Array i PRS -> Maybe PRS Source #
Is somewhat rewritten from the gBF3 function (not exported) from the mmsyn2-array package.
createsSyllable :: PRS -> Bool Source #
Function-predicate createsSyllable checks whether its argument is a phoneme representation that
every time being presented in the text leads to the creation of the new syllable (in the PRS format).
Usually it is a vowel, but in some languages there can be syllabic phonemes that are not considered to be
vowels.
isSonorous1 :: PRS -> Bool Source #
Function-predicate isSonorous1 checks whether its argument is a sonorous consonant representation in the PRS format.
isVoicedC1 :: PRS -> Bool Source #
Function-predicate isVoicedC1 checks whether its argument is a voiced consonant representation in the PRS format.
isVoicelessC1 :: PRS -> Bool Source #
Function-predicate isVoiceless1 checks whether its argument is a voiceless consonant representation in the PRS format.
notCreatesSyllable2 :: PRS -> PRS -> Bool Source #
Binary function-predicate notCreatesSyllable2 checks whether its arguments are both consonant representations in the PRS format.
Arguments
| :: [(Char, Char)] | The pairs of the |
| -> PRS | |
| -> PRS | |
| -> Bool |
Binary function-predicate notEqC checks whether its arguments are not the same consonant sound representations (not taking palatalization into account).
fromPhoneticType :: PhoneticType -> Int Source #