README.md (2935 bytes)
1 # SubRead Dictionary 2 3 A pop-up dictionary for Android that reads Yomitan dictionaries. Select a text 4 in any app and choose "SubRead Dictionary" in the text selection menu, share a 5 text to it, or send a word from 6 [SubRead Overlay](https://github.com/equwal/subread-overlay). The pop-up 7 opens over the app and shows each term at the start of the text, the longest 8 first, with the reading, the pitch accent, the frequency, and a button for 9 the audio. A tap on a character of the text looks up from there. 10 11 Nothing leaves the device, except when a remote audio source is on. 12 13 ## How to use it 14 15 1. Import a dictionary: a Yomitan `.zip` (JMdict, Jitendex, a pitch accent 16 dictionary, a frequency list). The app reads format 3. The order of the 17 dictionaries in the settings is the order in the pop-up. 18 2. Local audio, optional: choose the `android.db` of the 19 [Local Audio Server for Yomitan](https://github.com/yomidevs/local-audio-yomichan), 20 the same file that AnkiConnect Android and Hoshi Reader use. The app copies 21 it into its folder. Or push it there with `adb`; the settings show the 22 folder. The order of the sources is a setting: `jpod, jpod_alternate, 23 nhk16, shinmeikai8, forvo`. 24 3. Remote audio, optional and off by default: one URL per line, with `{term}` 25 and `{reading}`. A URL can answer with an audio file (JapanesePod101 is 26 the default line), or with the JSON list of a Local Audio Server on the 27 network: `http://192.168.1.2:5050/?term={term}&reading={reading}`. The 28 remote sources come after the local ones. 29 30 In the pop-up, "Play" plays the first source that has the word. A long press 31 on "Play" lists every source. 32 33 ## How it works 34 35 `:core` is plain Kotlin, with no Android in it: 36 37 - `YomitanZip` reads the zip as a stream, one term at a time. 38 - `Deinflector` has the Japanese rules of Yomitan: 食べさせられた → 食べる, 39 with the word class of each step checked against the rules of the term. 40 - `Lookup` tries each prefix of the text, the longest first, and each 41 dictionary form of it, in one query. 42 - `Glossary` turns the structured content of a term into the simple HTML 43 that a `TextView` shows. 44 45 `:app` has the SQLite store of the terms, the settings screen, the pop-up and 46 the audio. 47 48 ## For other apps 49 50 Send a text with any of these; the pop-up opens over your app: 51 52 - `Intent.ACTION_PROCESS_TEXT` with `EXTRA_PROCESS_TEXT` (the text selection menu). 53 - `Intent.ACTION_SEND`, `text/plain`, with `EXTRA_TEXT` (the share sheet). 54 - The action `space.subread.dictionary.LOOKUP` with `EXTRA_TEXT`. 55 56 ## Build 57 58 ``` 59 ./gradlew :core:test :app:assembleDebug 60 ./gradlew :app:connectedDebugAndroidTest # the SQLite store, on a device 61 ``` 62 63 The device test installs the debug app again and removes its data: the 64 imported dictionaries of the debug build are gone after it. 65 66 `-PplayStore=true` leaves the Ko-fi link out of the build for Google Play. 67 68 ## Licence 69 70 AGPL-3.0. See `LICENSE`.