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
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ The prevalence of poetry in Arabic literature necessitates scientific tool to st
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
8
The following codes assigns the said poem of Al-Mutanabbi to a variable poem.
9
-
```@example abc
9
+
```julia
10
10
using Yunir
11
11
@transliterator:default
12
12
@@ -69,19 +69,19 @@ poem = """
69
69
```
70
70
## Extracting Syllables
71
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
-
```@repl abc
76
+
```julia
77
77
syllable =Syllable(1, 0, 3)
78
78
```
79
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,
80
-
```@repl abc
80
+
```julia
81
81
r =Syllabification(false, syllable)
82
82
```
83
83
Then, the following will syllabicize the first word in the said poem.
84
-
```@repl abc
84
+
```julia
85
85
r(
86
86
string(split(texts[1], "")[1]),
87
87
isarabic=true,
@@ -95,8 +95,8 @@ 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:
99
-
```@example abc
98
+
So that, if we want to extract the syllables of\ the first three lines, then:
99
+
```julia
100
100
# Process only the first 3 lines for demonstration
101
101
line_syllables = Array[]
102
102
for line in texts[1:3]
@@ -118,7 +118,7 @@ for line in texts[1:3]
118
118
end
119
119
```
120
120
To extract the syllables of the words in first line of the poem, we run the following code:
0 commit comments