Skip to content

Commit

Permalink
Added +ln ... -ln command line group
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr-Zhabenko committed Sep 22, 2024
1 parent d288991 commit b28bae9
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 11 deletions.
13 changes: 8 additions & 5 deletions Aftovolio/General/Simple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import Data.Char (isDigit,isSpace)
import CLI.Arguments
import CLI.Arguments.Get
import CLI.Arguments.Parsing
import GHC.Int (Int8)
import Data.Ord (comparing)
import GHC.Int (Int8)
import GHC.Word (Word8)
import Aftovolio.ConstraintsEncoded
import Aftovolio.PermutationsArr
import Aftovolio.StrictVG
Expand All @@ -45,7 +46,7 @@ import Control.DeepSeq
generalF
:: Int -- ^ A power of 10. The resulting distance using next ['Word8'] argument is quoted by 10 in this power. The default one is 0. The proper values are in the range [0..4].
-> Int -- ^ A 'length' of the next argument here.
-> [Word8] -- ^ A list of non-negative values normed by 255 (the greatest of which is 255) that the line options are compared with. If null, then the program works as for version 0.12.1.0 without this newly-introduced argument since the version 0.13.0.0. The length of it must be a least common multiplier of the (number of syllables plus number of \'_digits\' groups) to work correctly. Is not used when the next 'FilePath' and 'String' arguments are not null.
-> [Word8] -- ^ A list of positive values normed by 255 (the greatest of which is 255) that the line options are compared with. If null, then the program works as for version 0.12.1.0 without this newly-introduced argument since the version 0.13.0.0. The length of it must be a least common multiplier of the (number of syllables plus number of \'_digits\' groups) to work correctly. Is not used when the next 'FilePath' and 'String' arguments are not null.
-> Bool -- ^ If 'True' then adds \"<br>\" to line endings for double column output
-> FilePath -- ^ A path to the file to save double columns output to. If empty then just prints to 'stdout'.
-> String -- ^ If not null than instead of rhythmicity evaluation using hashes and and feets, there is computed a diversity property for the specified 'String' here using the 'selectSounds' function. For more information, see: 'https://oleksandr-zhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.html#types'
Expand Down Expand Up @@ -251,7 +252,9 @@ argsProcessing wrs ks arr gs us vs h ysss zsss xs = do
let line2comparewith
| oneC "+l2" argsC || null linecomp3 = unwords . getC "+l2" $ argsC
| otherwise = linecomp3
basecomp = force . read3 (not . null . filter (not . isSpace)) 1.0 (mconcat . h . createSyllablesPL wrs ks arr gs us vs) $ line2comparewith
basecomp
| oneC "+ln" argsC = force . catMaybes . map (\xs -> readMaybe xs::Maybe Word8) . getC "+ln" $ argsC -- to read positive Word8 values as a list of them.
| otherwise = force . read3 (not . null . filter (not . isSpace)) 1.0 (mconcat . h . createSyllablesPL wrs ks arr gs us vs) $ line2comparewith
(filesave,codesave)
| null filedata = ("",-1)
| length filedata == 2 = (head filedata, fromMaybe 0 (readMaybe (last filedata)::Maybe Int))
Expand Down Expand Up @@ -301,7 +304,7 @@ processingF selFun wrs ks arr gs us vs h numTest hc (grps,mxms) ysss zsss descen
-- PhLADiPreLiO constraints. For more information, see:
-- https://oleksandr-zhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.html#constraints
cSpecs :: CLSpecifications
cSpecs = zip ["+a","+b","+l2"] . cycle $ [-1]
cSpecs = zip ["+a","+b","+l2","+ln"] . cycle $ [-1]

bSpecs :: CLSpecifications
bSpecs = [("+f",2),("+m",2),("+m2",2),("+m3",3),("+ul",1),("+w",1),("+dc",2),("+q",1),("-cm",1)]
Expand Down Expand Up @@ -351,7 +354,7 @@ outputWithFile
-> String -- ^ Corresponds to the 100 delimiter in the @ukrainian-phonetics-basic-array@ package.
-> String -- ^ Corresponds to the 101 delimiter in the @ukrainian-phonetics-basic-array@ package.
-> String -- ^ If not null than instead of rhythmicity evaluation using hashes and and feets, there is computed a diversity property for the specified 'String' here using the 'selectSounds' function. For more information, see: 'https://oleksandr-zhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.html#types'
-> [Word8] -- ^ A list of non-negative values normed by 255 (the greatest of which is 255) that the line options are compared with. If null, then the program works as for version 0.12.1.0 without this newly-introduced argument since the version 0.13.0.0. The length of it must be a least common multiplier of the (number of syllables plus number of \'_digits\' groups) to work correctly. Is not used when the next 'FilePath' and 'String' arguments are not null.
-> [Word8] -- ^ A list of positive values normed by 255 (the greatest of which is 255) that the line options are compared with. If null, then the program works as for version 0.12.1.0 without this newly-introduced argument since the version 0.13.0.0. The length of it must be a least common multiplier of the (number of syllables plus number of \'_digits\' groups) to work correctly. Is not used when the next 'FilePath' and 'String' arguments are not null.
-> [AftovolioGen]
-> Int
-> a1
Expand Down
2 changes: 1 addition & 1 deletion Aftovolio/Ukrainian/IO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import Control.DeepSeq
generalF
:: Int -- ^ A power of 10. The distance value is quoted by 10 in this power if the next ['Word8'] argument is not empty. The default one is 0. The right values are in the range [0..4].
-> Int -- ^ A 'length' of the next argument here.
-> [Word8] -- ^ A list of non-negative values normed by 255 (the greatest of which is 255) that the line options are compared with. If null, then the program works as for version 0.12.1.0 without this newly-introduced argument since the version 0.13.0.0. The length of it must be a least common multiplier of the (number of syllables plus number of \'_digits\' groups) to work correctly. Is not used when the next 'FilePath' and 'String' arguments are not null.
-> [Word8] -- ^ A list of positive values normed by 255 (the greatest of which is 255) that the line options are compared with. If null, then the program works as for version 0.12.1.0 without this newly-introduced argument since the version 0.13.0.0. The length of it must be a least common multiplier of the (number of syllables plus number of \'_digits\' groups) to work correctly. Is not used when the next 'FilePath' and 'String' arguments are not null.
-> Bool -- ^ If 'True' then adds \"<br>\" to line endings for double column output
-> FilePath -- ^ A path to the file to save double columns output to. If empty then just prints to 'stdout'.
-> String -- ^ If not null than instead of rhythmicity evaluation using hashes and and feets, there is computed a diversity property for the specified 'String' here using the 'selectSounds' function. For more information, see: 'https://oleksandr-zhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.html#types'
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@

* First version. Released on an unsuspecting world.

## 0.2.0.0 -- 2024-09-22

* Second version. Added possibility to specify sequence of Word8 numbers as durations to be compared with in the +ln ... -ln command line arguments group.

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Oleksandr Zhabenko

# Introduction

Here is a brief introduction of AFTOVolio ideas and usage (that is Dutch 'Aanpak van Fonetische Talen voor het Ontdekken van de VOorkeursLIneOpties' — Phonetic Languages Approach for Discovering the Preferred Line Options).
Here is a brief introduction of AFTOVolio ideas and usage (that is Dutch 'Aanpak van Fonetische Talen voor het Ontdekken van de VOorkeursLIjnOpties' (Dutch people consider ji as a one letter and consequently one sound, but we use just first one for good readability) — Phonetic Languages Approach for Discovering the Preferred Line Options).

Using AFTOVolio lets a person learn how to write the texts with the desired properties in pronunciation.

Expand Down Expand Up @@ -957,6 +957,9 @@ OR:
OR:
- aftovolioUkr [[+a <AFTOVolio constraints> -a] [+b <extended algebraic AFTOVolio constraints> -b] [+n] [+l] [+d <FilePath to file with durations>] [+s <syllable durations function number>] [-p] [+w <splitting parameter>] [+q <power of 10 for multiplier in [2..6]>] [+f <FilePath to the file to be appended the resulting String> <control parameter for output parts>] [+x <maximum number of words taken>] [+dc <whether to print <br> tag at the end of each line for two-column output> <FilePath to the file where the two-column output will be written in addition to stdout>] [+l2 <a Ukrainian text line to compare similarity with> -l2]] <Ukrainian textual line>

OR:
- aftovolioUkr [[+a <AFTOVolio constraints> -a] [+b <extended algebraic AFTOVolio constraints> -b] [+n] [+l] [+d <FilePath to file with durations>] [+s <syllable durations function number>] [-p] [+w <splitting parameter>] [+q <power of 10 for multiplier in [2..6]>] [+f <FilePath to the file to be appended the resulting String> <control parameter for output parts>] [+x <maximum number of words taken>] [+dc <whether to print <br> tag at the end of each line for two-column output> <FilePath to the file where the two-column output will be written in addition to stdout>] [+ln <a sequence of positive Word8 values not greater than 255 e. g. 24 157 45 68 45 56 59 to compare similarity with> -ln]] <Ukrainian textual line>

OR:
- aftovolioUkr [[+a <AFTOVolio constraints> -a] [+b <extended algebraic AFTOVolio constraints> -b] [+n] [+l] [+d <FilePath to file with durations>] [+s <syllable durations function number>] [-p] [+w <splitting parameter>] [+q <power of 10 for multiplier in [2..6]>] [+f <FilePath to the file to be appended the resulting String> <control parameter for output parts>] [+x <maximum number of words taken>] [+dc <whether to print <br> tag at the end of each line for two-column output> <FilePath to the file where the two-column output will be written in addition to stdout>] [+m <FilePath> <num1> +m2 <num2>]]

Expand Down Expand Up @@ -999,6 +1002,8 @@ in Ukrainian.

- +l2 \... -l2 — if present and has inside Ukrainian text then the line options are compared with it using the idea of lists similarity. The greater values correspond to the less similar and more different lines. Has no effect with +dc group of command line arguments. Has precedence over +t, +r, +k, +c etc. groups of command line options so that these latter ones have no effect when +l2 \... -l2 is present.

- +ln \... -ln — if present and has inside a sequence of positive Word8 values not greater than 255 then the line options are compared with it using the idea of lists similarity. The greater values correspond to the less similar and more different lines. Has no effect with +dc group of command line arguments. Has precedence over +t, +r, +k, +c etc. groups of command line options so that these latter ones have no effect when +ln \... -ln is present.

- +q — if present with +l2 \... -l2 group of arguments then the next argument is a power of 10 which the distance between line option and the predefined line is quoted by. The default one is 0 (that means no change). You can specify not less than 0 and not greater than 4. Otherwise, these limit numbers are used instead. The greater value here leads to more groupped options output.

- +ul — afterwards there is a string that encodes which sounds are used for diversity property evaluation. If used, then +r group has no meaning and is not used. Unlike in the link, the argument "1" means computing the property for all the sound representations included (for all of the present representations, so the value is maximal between all other strings instead of "1"). For more information, [see](https://oleksandr-zhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.html#types)
Expand Down
Binary file added aftovolio-0.1.0.0.tar
Binary file not shown.
2 changes: 1 addition & 1 deletion aftovolio.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: aftovolio
version: 0.1.0.0
version: 0.2.0.0

-- A short (one-line) description of the package.
synopsis: An AFTOVolio implementation for creating texts with special phonetic / prosodic properties.
Expand Down
Loading

0 comments on commit b28bae9

Please sign in to comment.