You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/man/rhythmic_analysis.md
+12-7Lines changed: 12 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ The prevalence of poetry in Arabic literature necessitates scientific tool to st
5
5
## Arabic Poetry
6
6
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.
7
7
## 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`.
9
9
```@example abc
10
10
using Yunir
11
11
@transliterator :default
@@ -68,15 +68,15 @@ poem = """
68
68
"""
69
69
```
70
70
## 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.
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:
76
76
```@repl abc
77
-
syllable = Syllable(1, 0, 3)
77
+
syllable = Syllable(1, 0, 10)
78
78
```
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.
80
80
```@repl abc
81
81
r = Syllabification(false, syllable)
82
82
```
@@ -95,11 +95,11 @@ From the output above, there are two syllables, the first being `أَ` and the s
95
95
!!! warning "Caution"
96
96
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.
97
97
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:
99
99
```@example abc
100
100
# Process only the first 3 lines for demonstration
101
101
line_syllables = Array[]
102
-
for line in texts[1:3]
102
+
for line in texts
103
103
words = string.(split(line, " "))
104
104
105
105
word_syllables = Segment[]
@@ -121,7 +121,12 @@ To extract the syllables of the words in first line of the poem, we run the foll
121
121
```@repl abc
122
122
line_syllables[1]
123
123
```
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.
0 commit comments