| Copyright | (c) OleksandrZhabenko 2020-2022 |
|---|---|
| License | MIT |
| Maintainer | olexandr543@yahoo.com |
| Stability | Experimental |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
| Extensions | MultiWayIf |
Data.Phonetic.Languages.PrepareText
Description
Helps to order the 7 or less phonetic language words (or their concatenations)
to obtain (to some extent) suitable for poetry or music text.
Earlier it has been a module DobutokO.Poetry.Ukrainian.PrepareText
from the dobutokO-poetry package.
In particular, this module can be used to prepare the phonetic language text
by applying the most needed grammar to avoid misunderstanding
for the produced text. The attention is paid to the prepositions, pronouns, conjunctions
and particles that are most commonly connected (or not) in a significant way
with the next text.
Uses the information from:
https://uk.wikipedia.org/wiki/%D0%A1%D0%BF%D0%BE%D0%BB%D1%83%D1%87%D0%BD%D0%B8%D0%BA
and
https://uk.wikipedia.org/wiki/%D0%A7%D0%B0%D1%81%D1%82%D0%BA%D0%B0_(%D0%BC%D0%BE%D0%B2%D0%BE%D0%B7%D0%BD%D0%B0%D0%B2%D1%81%D1%82%D0%B2%D0%BE)
Uses arrays instead of vectors.
A list of basic (but, probably not complete and needed to be extended as needed) English words (the articles, pronouns,
particles, conjunctions etc.) the corresponding phonetic language translations of which are intended to be used as a
Concatenations here is written to the file EnglishConcatenated.txt in the source tarball.
Synopsis
- type Concatenations = [[String]]
- concatWordsFromLeftToRight :: ConcatenationsArr -> String -> [String]
- splitLines :: [String] -> [String]
- splitLinesN :: Int -> [String] -> [String]
- isSpC :: Char -> Bool
- sort2Concat :: [[String]] -> Concatenations
- prepareText :: [[String]] -> [[String]] -> String -> String -> [String]
- prepareTextN :: Int -> [[String]] -> [[String]] -> String -> String -> [String]
- growLinesN :: Int -> [String] -> [String]
- prepareGrowTextMN :: Int -> Int -> [[String]] -> [[String]] -> String -> String -> [String]
- tuneLinesN :: Int -> [String] -> [String]
- prepareTuneTextMN :: Int -> Int -> [[String]] -> [[String]] -> String -> String -> [String]
- isPLL :: String -> Char -> Bool
Documentation
type Concatenations = [[String]] Source #
The lists in the list are sorted in the descending order by the word counts in the inner Strings. All the Strings
in each inner list have the same number of words, and if there is no String with some intermediate number of words (e. g. there
are Strings for 4 and 2 words, but there is no one for 3 words Strings) then such corresponding list is absent (since
the 0.9.0.0 version). Probably the maximum number of words can be not more than 4, and the minimum number is
not less than 1, but it depends. The Strings in the inner lists must be (unlike the inner
lists themselves) sorted in the ascending order for the data type to work correctly in the functions of the module.
Basic functions
concatWordsFromLeftToRight :: ConcatenationsArr -> String -> [String] Source #
splitLines :: [String] -> [String] Source #
The function is recursive and is applied so that all returned elements (String) are no longer than 7 words in them.
splitLinesN :: Int -> [String] -> [String] Source #
A generalized variant of the splitLines with the arbitrary maximum number of the words in the lines given as the first argument.
isSpC :: Char -> Bool Source #
A predicate to check whether the given character is one of the "' \x2019\x02BC-".
Arguments
| :: [[String]] | |
| -> Concatenations | Data used to concatenate the basic grammar preserving words and word sequences to the next word or to the previous word to leave the most of the meaning (semantics) of the text available to easy understanding while reading and listening to. |
The end-user functions
Arguments
| :: [[String]] | Is intended to become a valid |
| -> [[String]] | Is intended to become a valid |
| -> String | A sorted |
| -> String | |
| -> [String] |
Is used to convert a phonetic language text into list of String each of which is ready to be
used by the functions from the other modules in the package.
It applies minimal grammar links and connections between the most commonly used phonetic language
words that "should" be paired and not dealt with separately
to avoid the misinterpretation and preserve maximum of the semantics for the
"phonetic" language on the phonetic language basis.
Arguments
| :: Int | A maximum number of the words or their concatenations in the resulting list of |
| -> [[String]] | Is intended to become a valid |
| -> [[String]] | Is intended to become a valid |
| -> String | A sorted |
| -> String | |
| -> [String] |
A generalized variant of the prepareText with the arbitrary maximum number of the words in the lines given as the first argument.
growLinesN :: Int -> [String] -> [String] Source #
@ since 0.8.0.0
Given a positive number and a list tries to rearrange the list's Strings by concatenation of the several elements of the list
so that the number of words in every new String in the resulting list is not greater than the Int argument. If some of the
Strings have more than that number quantity of the words then these Strings are preserved.
Arguments
| :: Int | A maximum number of the words or their concatenations in the resulting list of |
| -> Int | A number of words in every |
| -> [[String]] | Is intended to become a valid |
| -> [[String]] | Is intended to become a valid |
| -> String | A sorted |
| -> String | |
| -> [String] |
@ since 0.8.0.0
The function combines the prepareTextN and growLinesN function. Applies needed phonetic language preparations
to the text and tries to 'grow' the resulting Strings in the list so that the number of the words in every
of them is no greater than the given first Int number.
Arguments
| :: Int | A maximum number of the words or their concatenations in the resulting list of |
| -> Int | A number of words in every |
| -> [[String]] | Is intended to become a valid |
| -> [[String]] | Is intended to become a valid |
| -> String | A sorted |
| -> String | |
| -> [String] |
@ since 0.6.0.0
The function combines the prepareTextN and tuneLinesN functions. Applies needed phonetic language preparations
to the phonetic language text and splits the list of Strings so that the number of the words in each of them (except the last one)
is equal the given first Int number.