Qur'an | Word by Word | Audio | Prayer Times
__ Sign In
 
__

Java API - Token Count Example

__

This example uses an analysis table to tabulate the number of tokens in each chapter in the Quran.

Java Example

public class TokenCountExample {

    public static void main() {

        // Create a new analysis table.
        AnalysisTable table = new AnalysisTable(
            "ChapterNumber", "TokenCount");

        // Tabulate the number of tokens in each chapter.
        for (Chapter chapter : Document.getChapters()) {
            table.add(
                chapter.getChapterNumber(),
                chapter.getTokenCount());
        }

        // Display the results.
        System.out.println(table);
    }
}

Program Output

ChapterNumber TokenCount
------------- ----------
1             29
2             6116
3             3481
4             3747
5             2804
6             3050
7             3320
8             1233
9             2498
10            1833
11            1917
12            1777
13            853
14            830
15            655
16            1844
17            1556
18            1579
19            961
20            1335
21            1169
22            1274
23            1050
24            1316
25            893
26            1318
27            1151
28            1430
29            976
30            817
31            546
32            372
33            1287
34            883
35            775
36            725
37            860
38            733
39            1172
40            1219
41            794
42            860
43            830
44            346
45            488
46            643
47            539
48            560
49            347
50            373
51            360
52            312
53            360
54            342
55            351
56            379
57            574
58            472
59            445
60            348
61            221
62            175
63            180
64            241
65            287
66            249
67            333
68            300
69            258
70            217
71            226
72            285
73            199
74            255
75            164
76            243
77            181
78            173
79            179
80            133
81            104
82            80
83            169
84            107
85            109
86            61
87            72
88            92
89            137
90            82
91            54
92            71
93            40
94            27
95            34
96            72
97            30
98            94
99            36
100           40
101           36
102           28
103           14
104           33
105           23
106           17
107           25
108           10
109           26
110           19
111           23
112           15
113           23
114           20

Discussion

The Chapter.getTokenCount() method is used to get the number of tokens for each chapter. Each orthographic token is whitespace delimited Arabic text within a verse.

See Also

Language Research Group
University of Leeds
__