Skip to content

Commit 721161a

Browse files
committed
update
1 parent 85a1cc6 commit 721161a

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

docs/src/man/rhythmic_analysis.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The prevalence of poetry in Arabic literature necessitates scientific tool to st
55
## Arabic Poetry
66
The first data is from a well known author, [Al-Mutanabbi المتنبّي](https://en.wikipedia.org/wiki/Al-Mutanabbi), who authored several poetry including the titled [*'Indeed, every woman with a swaying walk'*](https://www.youtube.com/watch?v=9c1IrQwfYFM), which will be the basis for this section.
77
## Loading Data
8-
The following codes assigns the said poem of Al-Mutanabbi to a variable poem.
8+
The following codes assigns the said poem of Al-Mutanabbi to a variable `poem`.
99
```@example abc
1010
using Yunir
1111
@transliterator :default
@@ -68,15 +68,15 @@ poem = """
6868
"""
6969
```
7070
## Extracting Syllables
71-
Now let's try extracting the syllables for the first line. To do this, let's convert the text into a vector of stanzas of the poem. We therefore split the text on the `";\n"` separator, where the `\n` is the code for line break. The function `strip` simply removes the whitespaces before and after each stanza.
71+
Now let's try extracting the syllables for the first line. To do this, let's convert the text into a vector of stanzas of the `poem`. We therefore split the text on the `";\n"` separator, where the `\n` is the code for line break. The function `strip` simply removes the whitespaces before and after each stanza.
7272
```@example abc
7373
texts = map(x -> strip(string(x)), split.(poem, "\n"))
7474
```
7575
Next is to initialize the syllabification for each stanza, suppose we want to capture the consonant before and after each vowel to represent one syllable. For example, for the word `basmala`, the syllabification if only the consonant preceding the vowel is considered then we have `ba`, `ma`, and `la`. To specify this configuration for the syllable, we do it as follows:
7676
```@repl abc
77-
syllable = Syllable(1, 0, 3)
77+
syllable = Syllable(1, 0, 10)
7878
```
79-
Here the first argument represents the number of characters prior to the vowel is considered, the next argument which is 0 is the number of character after the vowel, and 3 in the third argument simply mean how many vowels do we need to capture for each word. So that,
79+
Here the first argument represents the number of characters prior to the vowel is considered, the next argument which is 0 is the number of character after the vowel, and 10 in the third argument simply mean how many vowels do we need to capture for each word. So that, 10 here assures us that we capture all vowels of any word because most usually has less than 10 vowels.
8080
```@repl abc
8181
r = Syllabification(false, syllable)
8282
```
@@ -95,11 +95,11 @@ From the output above, there are two syllables, the first being `أَ` and the s
9595
!!! warning "Caution"
9696
It is important to note that syllabification works only on a fully diacritize text as in the input poem here, and that is because each syllable contain a vowel. If not fully diacritize, then the syllabification will consider a syllable with only consonant and no vowel.
9797

98-
So that, if we want to extract the syllables of\ the first three lines, then:
98+
So that, if we want to extract the syllables all lines in the poem, then:
9999
```@example abc
100100
# Process only the first 3 lines for demonstration
101101
line_syllables = Array[]
102-
for line in texts[1:3]
102+
for line in texts
103103
words = string.(split(line, " "))
104104
105105
word_syllables = Segment[]
@@ -121,7 +121,12 @@ To extract the syllables of the words in first line of the poem, we run the foll
121121
```@repl abc
122122
line_syllables[1]
123123
```
124-
There is a problem with this. TODO.
124+
And for the last line of the poem
125+
```@repl abc
126+
line_syllables[end-1]
127+
```
128+
!!! info "Note"
129+
The indexing is set to `end-1` because the last line of the `texts` variable is a blank line space as seen in the results of the `texts` variable assigned to the mapping function above.
125130
## References
126131
```@bibliography
127132
Pages = ["rhythmic_analysis.md"]

nb/quran-rhythmic/code1.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ poem = """
5858
"""
5959

6060
texts = map(x -> strip(string(x)), split.(poem, "\n"))
61-
syllable = Syllable(1, 0, 10)
61+
syllable = Syllable(1, 0, 3)
6262
r = Syllabification(false, syllable)
6363
out = r(string(split(texts[1], " ")[1]), isarabic=true, first_word=true, silent_last_vowel=false)
6464
dump(out)

0 commit comments

Comments
 (0)