Copyright | (c) OleksandrZhabenko 2021 |
---|---|
License | MIT |
Maintainer | olexandr543@yahoo.com |
Stability | Experimental |
Safe Haskell | None |
Language | Haskell2010 |
Extensions |
|
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
SylS | |
|
data PhoneticType Source #
Instances
Eq PhoneticType Source # | |
Defined in Data.Phonetic.Languages.Syllables (==) :: PhoneticType -> PhoneticType -> Bool # (/=) :: PhoneticType -> PhoneticType -> Bool # | |
Ord PhoneticType Source # | |
Defined in Data.Phonetic.Languages.Syllables compare :: PhoneticType -> PhoneticType -> Ordering # (<) :: PhoneticType -> PhoneticType -> Bool # (<=) :: PhoneticType -> PhoneticType -> Bool # (>) :: PhoneticType -> PhoneticType -> Bool # (>=) :: PhoneticType -> PhoneticType -> Bool # max :: PhoneticType -> PhoneticType -> PhoneticType # min :: PhoneticType -> PhoneticType -> PhoneticType # | |
Read PhoneticType Source # | |
Defined in Data.Phonetic.Languages.Syllables readsPrec :: Int -> ReadS PhoneticType # readList :: ReadS [PhoneticType] # | |
Show PhoneticType Source # | |
Defined in Data.Phonetic.Languages.Syllables showsPrec :: Int -> PhoneticType -> ShowS # show :: PhoneticType -> String # showList :: [PhoneticType] -> ShowS # |
type StringRepresentation = [PRS] Source #
data SegmentationInfo1 Source #
SI | |
|
Instances
Eq SegmentationInfo1 Source # | |
Defined in Data.Phonetic.Languages.Syllables (==) :: SegmentationInfo1 -> SegmentationInfo1 -> Bool # (/=) :: SegmentationInfo1 -> SegmentationInfo1 -> Bool # | |
Read SegmentationInfo1 Source # | |
Defined in Data.Phonetic.Languages.Syllables | |
Show SegmentationInfo1 Source # | |
Defined in Data.Phonetic.Languages.Syllables showsPrec :: Int -> SegmentationInfo1 -> ShowS # show :: SegmentationInfo1 -> String # showList :: [SegmentationInfo1] -> ShowS # | |
PhoneticElement SegmentationInfo1 Source # | |
Defined in Data.Phonetic.Languages.Syllables |
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 #
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
(Eq a, Eq b) => Eq (SegmentationPredFData a b) Source # | |
Defined in Data.Phonetic.Languages.Syllables (==) :: SegmentationPredFData a b -> SegmentationPredFData a b -> Bool # (/=) :: SegmentationPredFData a b -> SegmentationPredFData a b -> Bool # | |
(Read a, Read b) => Read (SegmentationPredFData a b) Source # | |
Defined in Data.Phonetic.Languages.Syllables 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 showsPrec :: Int -> SegmentationPredFData a b -> ShowS # show :: SegmentationPredFData a b -> String # showList :: [SegmentationPredFData a b] -> ShowS # | |
Eval2Bool (SegmentationPredFData PRS (Char, Char)) Source # | |
Defined in Data.Phonetic.Languages.Syllables |
type SegmentationFDP = SegmentationPredFData PRS (Char, Char) Source #
data SegmentationLineFunction Source #
LFS | |
|
Instances
data SegmentationRules1 Source #
SR1 | |
|
Instances
Read SegmentationRules1 Source # | |
Defined in Data.Phonetic.Languages.Syllables | |
Show SegmentationRules1 Source # | |
Defined in Data.Phonetic.Languages.Syllables 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
:: [(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
:: GWritingSystemPRPLX | Data used to obtain the phonetic language representation of the text. |
-> [(Char, Char)] | The pairs of the |
-> CharPhoneticClassification | |
-> SegmentRulesG | |
-> String | Corresponds to the '0' symbol delimiter in the |
-> String | Corresponds to the '1' and '-' symbol delimiters 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.
:: [(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 #