Fix trie lookup
app/src/main/java/eu/lepiller/nani/dictionary/FileDictionary.java
| 33 | 33 | ||
| 34 | 34 | interface TrieValsDecoder<T> { | |
| 35 | 35 | T decodeVals(RandomAccessFile file, long pos) throws IOException; | |
| 36 | + | void skipVals(RandomAccessFile file, long pos) throws IOException; | |
| 36 | 37 | } | |
| 37 | 38 | ||
| 38 | 39 | private String mUrl; | |
… | |||
| 254 | 255 | return decoder.decodeVals(file, triePos); | |
| 255 | 256 | } | |
| 256 | 257 | ||
| 257 | - | int valuesLength = file.readShort(); | |
| 258 | - | Log.v(TAG, "number of values: " + valuesLength); | |
| 259 | - | file.skipBytes(valuesLength * 4); | |
| 258 | + | decoder.skipVals(file, triePos); | |
| 260 | 259 | ||
| 261 | 260 | int transitionLength = file.readByte(); | |
| 262 | 261 | Log.v(TAG, "number of transitions: " + transitionLength); | |
app/src/main/java/eu/lepiller/nani/dictionary/ResultDictionary.java
| 105 | 105 | public ArrayList<Integer> decodeVals(RandomAccessFile file, long pos) throws IOException { | |
| 106 | 106 | return getValues(file, pos); | |
| 107 | 107 | } | |
| 108 | + | ||
| 109 | + | @Override | |
| 110 | + | public void skipVals(RandomAccessFile file, long pos) throws IOException { | |
| 111 | + | file.seek(pos); | |
| 112 | + | int valuesLength = file.readShort(); | |
| 113 | + | Log.v(TAG, "number of values: " + valuesLength); | |
| 114 | + | file.skipBytes(valuesLength * 4); | |
| 115 | + | } | |
| 108 | 116 | }); | |
| 109 | 117 | } | |
| 110 | 118 |
app/src/main/java/eu/lepiller/nani/dictionary/WadokuPitchDictionary.java
| 32 | 32 | @Override | |
| 33 | 33 | public String decodeVals(RandomAccessFile file, long pos) throws IOException { | |
| 34 | 34 | file.seek(pos); | |
| 35 | + | Log.d(TAG, "decoding at " + pos); | |
| 35 | 36 | return getHuffmanString(file, huffman); | |
| 36 | 37 | } | |
| 38 | + | ||
| 39 | + | @Override | |
| 40 | + | public void skipVals(RandomAccessFile file, long pos) throws IOException { | |
| 41 | + | file.seek(pos); | |
| 42 | + | getHuffmanString(file, huffman); | |
| 43 | + | } | |
| 37 | 44 | }); | |
| 38 | 45 | } | |
| 39 | 46 | ||
… | |||
| 63 | 70 | List<String> kanjis = r.getAlternatives(); | |
| 64 | 71 | ||
| 65 | 72 | for(String k: kanjis) { | |
| 66 | - | Log.d(TAG, "Searching pitch for " + k); | |
| 73 | + | Log.d(TAG, "Searching pitch for " + Arrays.toString(k.getBytes())); | |
| 67 | 74 | String pitch = findPitch(k, file); | |
| 68 | 75 | if(pitch != null) { | |
| 69 | 76 | Log.d(TAG, "Found " + pitch); | |
app/src/main/res/drawable/ic_pitch_border.xml unknown status 1
| 1 | + | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | + | <shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + | ||
| 4 | + | </shape> | |
| 4 | < | ||
| 0 | 5 | < | \ No newline at end of file |