-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project cannot read old dictionaries #4
Comments
From klausw#901 (comment)
Would having the original HK dictionaries help? Some are still on GPlay, I use another (which WFM), but (I assume) @klausw might have the complete set someplace? 🙇🏾♂️ |
Having the source code or at least a source on how the |
For building the dictionaries, I had found an old mailing list comment, quoted in klausw#939 (comment)
For a sample input XML file, see https://github.com/klausw/hackerskeyboard/blob/287291e300a930fc6283eac875bf72c6347c3882/dictionaries/sample.xml#L2 <!-- This is a sample wordlist that can be converted to a binary dictionary
for use by the Latin IME.
The format of the word list is a flat list of word entries.
Each entry has a frequency between 255 and 0.
Highest frequency words get more weight in the prediction algorithm.
You can capitalize words that must always be capitalized, such as "January".
You can have a capitalized and a non-capitalized word as separate entries,
such as "robin" and "Robin".
-->
<wordlist>
<w f="255">this</w>
<w f="255">is</w>
<w f="128">sample</w>
<w f="1">wordlist</w>
</wordlist> The f= number is the relative word frequency, from 255 (most frequent) to 0 (least frequent). |
I'm having a hard time finding the exact version of makedict that I used back then - I have files datestamped around Nov 14 2011, and it's probably approximately this: https://android.googlesource.com/platform/packages/inputmethods/LatinIME/+/refs/heads/ics-plus-aosp/tools/makedict/ I still have the shell script and jar file locally, let me know if you want me to send you a copy. |
That would be great, thanks
Yeah, I passed by that when I was looking around, and once I plan to move the dictionary into the project itself, somewhere around there would probably be where I look to place dictionaries unless I find any other issues. Still given the intermediary step of converting to a dict file, I figured knowing that wouldn't be good enough |
makedict uploaded here: https://drive.google.com/drive/folders/1tHl2989lk7DrobuTQonkmVfQqPsl1uq6?usp=sharing The wrapper shell script doesn't seem necessary - a simple
|
Ok, Going through that code. Interesting stuff, some stuff is obviously not update to date with current java practices, some of it is just plain weird (there's a missing function in there with fully made JDocs, there's a lot of That said, there are some aspects of it that I wish they did better. E.g., I can't tell if the dictionary is just broken or you didn't use this version. I say that because it doesn't recognize the dictionary as a binary dictionary. And instead of figuring this out via an error or by looking at the file extension or something, it figures it out by... not having a matching first 2 bytes and never checking anything else in the file. They don't even provide a separate argument for binary files. I got the whole thing converted to Kotlin, so I'm this close to seeing how to plug in the stuff to gradle and forcibly have a fixed version of the script that at least tries (and probably fail at) brute force checking the file. But this is probably not worth my time. Now... where can I find a good word list... I hope converting Anysoft's into an xml file isn't too annoying |
@SeventhM https://github.com/kkrypt0nn/wordlists ? 🙇🏾♂️ |
Closing as of ecaf6ee
|
https://developer.android.com/training/package-visibility Turns out, yes, I cannot see the dictionaries of other apps. This is a security change for apps targeting newer versions. I can work around this, but I'd need to find the package names of all of the various dictionaries that was created to do so. I can see why other dictionaries stopped offering it separately now |
Currently I've been double checking everything to figure out how to get suggestions working on this fork. So far I've narrowed the issue down to one of a few possible problems
In later versions of Android, it seems google changed the expectations of when a keyboard should be expected request showing prediction candidates (see here. As noted by the linked issue and by klausw#901, this has a simple suggestion: call
setCandidatesViewShown
at the end ofonCreateCandidatesView
andonStartInput
. However, hacker keyboard has some limitations towards this approach:As noted by the issue in google's issuetracker linked above, some devs notice that this causes problems with the back button in certain apps. These issues also appears in Hacker's Keyboard. It seems that in some apps (notably apps based on the Chromium project, including many browsers and even apps such as Discord), the keyboard is often called in places where no text is selected. This will hide the keyboard at the bottom of the screen, but not dismiss it, making it still active, Often there is no way to interact with the keyboard in this state (I've even seen the keyboard just crash in some cases). Some do recommend workarounds for such cases (such as getting rid of the keyboard ourselves with
requestHideSelf(0)
). However it would be nice to not need to do any of thatThe good news is Hacker's Keyboard already has a prebuilt way to avoid this problem. Our version of
setCandidatesViewShown
actually handles quite a bit more code than it appears to. Notably, it only shows candidates if we meet the following criteriaIf all of those checks are good, then we first do some setup of the candidates strip, then call
super.setCandidatesViewShown
. If these checks fail, then we actually go out of our way to delete the candidates strip before calling super. In theory, this seems to fix all of the issues as we should only have a candidates strip if the keyboard is showing or if we explicitly shouldn't care. In practice, it seemed to not work, leading to some trying to bypass this function by calling super directly. What's going on?I'll keep it short, as this does seem to me to be a bit of a red herring as I'll get to. But it seems the check that prediction is turned on in the first place. Even if all of the settings says predictions should be on, sometimes it just doesn't report that prediction is on. This may be because my fork is struggling to actually read dictionaries, however
It turns out that my attempts to read the dictionary (whether it's on a device whether I needed to go digging around for a link to the dictionary or on a device that can confirm it still had a legitimate copy of the old dictionary) have turned into failures. While it can read the dictionary just fine, it reports the dictionary as only having a couple words maximum, which does not satisfy the check for a dictionary (which does have an arbitrary word minimum to not catch test dictionaries or such). I haven't made a function yet to print out these words, but I'd imagine the logcat to claim these words are pretty corrupted. Something for me to check later. As such, HK is not allowing me to use its features for the candidates strip, even when it shows by brute force, since it doesn't believe I have a dictionary to use the strip with
I am aware that it should still show the list of symbols at the top of the candidates strip. I haven't fully figured why it won't work for that either.
The text was updated successfully, but these errors were encountered: