-
Notifications
You must be signed in to change notification settings - Fork 7
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
ACTION_SEARCH_JMDICT API: Option to include reference to matched section of query #497
Comments
|
After actually spending quite a bit of time working with kuromoji and furigana, I've found that with the way they do it, it's a bit of a pain reassembling the words, so please just ignore my last comment. Finally I think giving two indices (start, stop) for each entry will be the most convenient for me: e.g. the following sentence Do you think this is something which you could add to the API relatively quickly? It's kind of crucial for me to proceed with my application |
Hi Tim, thanks for the feature request. I will revisit the API and I will let you know. Don't hold your breath though, this will be done next week soonest... sorry. |
Just to confirm: you use the ACTION_SEARCH_JMDICT api with "kanjis" set to "寿司が食べたい" and "return_results" set to true. Is it okay if in the resulting list of maps, each map would contain e.g. "origin_range" with the format of 0,2 (that is, start index, end index, no braces)? |
Yes, great!
|
Fixed in Aedict 3.19 |
The key will be called "position_in_sentence". |
Tim, can you please share a link to your application if it is on the Google Play? I'm quite interested. |
@mvysny |
If you do not wish to go public, no problem. In such case if this is okay with you, you can just send me the APK via e-mail. Thanks! |
Probably I'll make it available via the beta testing facilities on Google Play, just give me a few days. |
This doesn't appear to be working (I'm currently using a different analysis engine because I required this PR to proceed with Aedict)... I just sent the following query taken from Wikipedia:
The first hit has "position_in_sentence" -> "127,2" which is obviously wrong... others were wrong as well I also tried a simpler search: Whereas I'd expect to get back: |
The position of "127,2" is obviously wrong, I'll look at it. Regarding the simpler search: the second digit is actually the length of the matched string, so if you transcribe the 5,1 into the start,end notation then you will get 5,6. |
Ah! Thanks!! |
Hmm, I just tried the long long sentence from the wiki and the analyzer got it right: first hit was 漢字: かんじ with the range of 0,2... Can you please let me know which word had the position of 127,2 (which is 127,129 translated to the start,end notation). |
Here is the exact string getting sent through the (sk.baka.aedict3.action.ACTION_SEARCH_JMDICT) intent: I'm using Aedict v3.25 |
It seems to be working fine with the |
Yes, the _NOUI intent is handled by a different (invisible) Activity, but the search engine should be the same... Let me check the UI version. |
Gotcha. 漢字;かんじ was present multiple times in the sentence; the 127,2 was the last location. Fixed in Aedict 3.26 so that the first 漢字;かんじ will receive the correct location of 0,2 and the last 漢字;かんじ will receive 127,2 |
Hmmm, why was the NOUI intent returning the correct result though? |
The NOUI intent grabbed the result and fed it directly to the intent. The UI intent grabbed the result, transformed it into displayable list, displayed it, then transformed it into something that could be exported and fed that into the intent. The transformation at some point used a HashMap to retain the original information, including the original sentence position. Weird, I know, but currently the implementation is as this :) |
Ah I see, thanks! I'll use the NOUI version, which seems like it should be more reliable in general. |
By the way, I can see a ton of results like It's standard practice to refrain from printing all but the absolute necessary amount of logs in the released version of an app, as it can slow things down quite a lot. In AnkiDroid we use a library called Timber to disable all except warning and error level logs in the release version. It's also possible to filter them out automatically with proguard apparently. |
@mvysny It's using an online engine for the sentence analysis instead of Aedict due to performance reasons. However tapping on any of the analyzed words opens the word in Aedict. If I can get the sentence analysis with Aedict to work better and faster then I'd like to use that instead. |
Well, the sentence analysis is a tedious process and the offline analysis will be slower than online analysis (unless you are running some flagship phone), because of way slower hardware. Just out of curiosity: which online service are you using for the sentence analysis? |
When an inexact / compound query is searched, it would be useful to be able to match the result back to the query.
Example:
If I search for 寿司が食べたい then I'd want to get back 寿司、が、食べたい together with the search results 寿司、が、食べる. The start and stop indices of the match would work as well.
The text was updated successfully, but these errors were encountered: