The example below shows how to use the search API to find tokens and ignore diacritics. The program looks for the word "reward" in the Holy Quran, using Buckwalter transliteration. The search criteria are Ajr (reward), wAjr (and reward) and wlAjr (and the reward). A TokenSearch instance is constructed using the RemoveDiacritics search option, and the crtieria are specified through calls to findToken().
Java Example
public class LetterSearchExample { public static void main() { // Create a new search. TokenSearch search = new TokenSearch( EncodingType.Buckwalter, SearchOptions.RemoveDiacritics); // Search for "Ajr" (reward), "wAjr" (and reward) // and "wlAjr" (and the reward). search.findToken("Ajr"); search.findToken("wAjr"); search.findToken("wlAjr"); // Display the results. AnalysisTable table = search.getResults(); System.out.println(table); System.out.println("Matches: " + table.getRowCount()); } }
Program Output
ChapterNumber VerseNumber TokenNumber Token ------------- ----------- ----------- ----- 3 136 14 >ajoru 3 171 10 >ajora 3 172 14 >ajorN 3 179 35 >ajorN 5 9 9 wa>ajorN 7 170 9 >ajora 8 28 9 >ajorN 9 22 7 >ajorN 9 120 51 >ajora 10 72 6 >ajorK 11 11 9 wa>ajorN 11 115 6 >ajora 12 56 16 >ajora 12 57 1 wala>ajoru 12 90 22 >ajora 12 104 5 >ajorK 16 41 13 wala>ajoru 18 30 9 >ajora 25 57 6 >ajorK 26 109 5 >ajorK 26 127 5 >ajorK 26 145 5 >ajorK 26 164 5 >ajorK 26 180 5 >ajorK 28 25 11 >ajora 29 58 16 >ajoru 34 47 5 >ajorK 35 7 12 wa>ajorN 36 11 11 wa>ajorK 38 86 6 >ajorK 39 74 15 >ajoru 41 8 7 >ajorN 49 3 16 wa>ajorN 57 7 14 >ajorN 57 11 11 >ajorN 57 18 11 >ajorN 64 15 7 >ajorN 67 12 8 wa>ajorN 84 25 7 >ajorN 95 6 7 >ajorN Matches: 40
Discussion
The program returns 40 results for Ajr (reward), including variations on the word (the reward, and the reward).
See Also
- Java API Examples
- Search API - Documentation explaining how to perform searches