- // TODO: maybe if user types capitalization, use it.
- assertSearchResult("aaac", "aaac", deIndex.findInsertionPoint("aaac", new AtomicBoolean(false)));
- assertSearchResult("aaac", "aaac", deIndex.findInsertionPoint("AAAC", new AtomicBoolean(false)));
- assertSearchResult("aaac", "aaac", deIndex.findInsertionPoint("AAAc", new AtomicBoolean(false)));
- assertSearchResult("aaac", "aaac", deIndex.findInsertionPoint("aAac", new AtomicBoolean(false)));
-
- // Before the beginning.
- assertSearchResult("40", "40" /* special case */, deIndex.findInsertionPoint("", new AtomicBoolean(false)));
- assertSearchResult("40", "40" /* special case */, deIndex.findInsertionPoint("__", new AtomicBoolean(false)));
-
- // After the end.
- assertSearchResult("Zweckorientiertheit", "zählen", deIndex.findInsertionPoint("ZZZZZ", new AtomicBoolean(false)));
-
- assertSearchResult("ab", "aaac", deIndex.findInsertionPoint("aaaca", new AtomicBoolean(false)));
- assertSearchResult("machen", "machen", deIndex.findInsertionPoint("m", new AtomicBoolean(false)));
- assertSearchResult("machen", "machen", deIndex.findInsertionPoint("macdddd", new AtomicBoolean(false)));
-
-
- assertSearchResult("überprüfe", "überprüfe", deIndex.findInsertionPoint("ueberprüfe", new AtomicBoolean(false)));
- assertSearchResult("überprüfe", "überprüfe", deIndex.findInsertionPoint("ueberpruefe", new AtomicBoolean(false)));
-
- assertSearchResult("überprüfe", "überprüfe", deIndex.findInsertionPoint("ueberpBLEH", new AtomicBoolean(false)));
- assertSearchResult("überprüfe", "überprüfe", deIndex.findInsertionPoint("überprBLEH", new AtomicBoolean(false)));
-
- assertSearchResult("überprüfen", "überprüfe", deIndex.findInsertionPoint("überprüfeBLEH", new AtomicBoolean(false)));
-
- // Check that search in lowercase works.
- assertSearchResult("Alibi", "Alibi", deIndex.findInsertionPoint("alib", new AtomicBoolean(false)));
- System.out.println(deIndex.findInsertionPoint("alib", new AtomicBoolean(false)).toString());
-
- raf.close();
- }
-
- private void assertSearchResult(final String insertionPoint, final String longestPrefix,
- final IndexEntry actual) {
- assertEquals(insertionPoint, actual.token);
- }
-
- public void testGermanTokenRows() throws IOException {
- final RandomAccessFile raf = new RandomAccessFile(TEST_OUTPUTS + "de-en.quickdic", "r");
- final Dictionary dict = new Dictionary(raf);
- final Index deIndex = dict.indices.get(0);
-
- // Pre-cache a few of these, just to make sure that's working.
- for (int i = 0; i < deIndex.rows.size(); i += 7) {
- deIndex.rows.get(i).getTokenRow(true);
- }
-
- // Do the exhaustive searching.
- TokenRow lastTokenRow = null;
- for (final RowBase row : deIndex.rows) {
- if (row instanceof TokenRow) {
- lastTokenRow = (TokenRow) row;
- }
- assertEquals(lastTokenRow, row.getTokenRow(true));
- }
+// public void testFr() throws IOException {
+// final RandomAccessFile raf = new RandomAccessFile(OUTPUTS + "FR.quickdic", "r");
+// final Dictionary dict = new Dictionary(raf);
+// final Index frIndex = dict.indices.get(0);
+//
+// // Now they're all cached, we shouldn't have to search.
+// for (final IndexEntry indexEntry : frIndex.sortedIndexEntries) {
+// System.out.println(indexEntry.token);
+// }
+//
+// raf.close();
+// }
+
+
+ public void testDeEnWiktionary() throws IOException {
+ final RandomAccessFile raf = new RandomAccessFile(OUTPUTS + "DE-EN.quickdic", "r");
+ final Dictionary dict = new Dictionary(raf);
+
+ final Index deIndex = dict.indices.get(0);
+
+ {
+ final IndexEntry searchResult = deIndex.findInsertionPoint("rot", new AtomicBoolean(
+ false));
+ HtmlEntry htmlEntry = searchResult.htmlEntries.get(0);
+ System.out.println("rot:\n" + htmlEntry.getHtml());
+ }