05-21-2008, 05:01 PM | #46 | |
Stats:
Posts: 233
Karma: 1189
Join Date: Nov 2007
Device: Sony PRS-505
|
Quote:
This is pretty similar to what I would have suggested as a search algorithm, though I think there's a way of programming slightly smarter "jumping" in a set of data this large and of this type. If we can figure out a way to get it to jump to a line, then I'll give my best shot at describing one. |
|
05-22-2008, 06:07 AM | #47 |
eWriter
Posts: 267
Karma: 175607
Join Date: May 2007
Location: Frankfurt, FRG
Device: PB-IQ / Sony PRS-500
|
readline-problem
Hi!
I did -some time ago- try to get "readline" to jump to a specific line - w/o success. If anyone finds a working way, THAT would be the most elegant solution IMHO... In order to make search faster anyway, I looked into some general javascript docu and found/tested "match"; that works a lot faster but did not "like" larger dictionary files (that ran with the original "readline" w/o problems). Hmmmm. So here's the altered code from my function "getDict": Code:
{try {var stream = new Stream.File(dPath); var binSea = String(stream); var aaa = eval("/\\n"+this.cNum+".*/"); var Ergebnis = binSea.match(aaa)+""; if (Ergebnis != null) found=1; [...] Thanks for any help / proactive development! |
Advert | |
|
05-22-2008, 07:40 AM | #48 |
Junior Member
Posts: 4
Karma: 10
Join Date: May 2008
Location: Spires - Germany
Device: PSR 505
|
Hi,
at first a big greeting from germany to germany :-) I just tried your dicitionary and it's a really useful enhancement to the reader. I will use it more intensivly if I find a good dicitionary (and when I read my next english book of course ) I hope that the problem with the long searchtime is solved soon. If there is no way to jump to a specific position in the file, it would be although possible to use several files instead of just one (e.g. one foreach letter, this would speed up the search by a factor of up to 26) Another improvement would be to change the input method and to one similiar to cellular phones: press 1 once for A, twice for B and three times for C if you want to write letters which are nearby, (e.g AB, EF, ...) it would be necessary to use a timer or to press another button to indicate that one letter is finished and you want to type another one. But this would be of course just a nice addon feature, the improved search is for sure much more important. So have a nice holiday Greetings Bube |
05-22-2008, 08:12 PM | #49 |
Wizard
Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
|
To read a line in middle you first need to determine all line ends before that. And to do that you need to read all the data up to that point, so it kinda defeats the purpose. You could try to use byte-granular binary search I guess... but why not just use grep as it's fast enough?
|
05-23-2008, 04:45 AM | #50 | |
eWriter
Posts: 267
Karma: 175607
Join Date: May 2007
Location: Frankfurt, FRG
Device: PB-IQ / Sony PRS-500
|
Quote:
how would I invoke grep from a .js file? And doesn't "match" (which uses regular expressions) do the same, basically? (I have only a vague knowledge of Unix/Linux; sorry.) |
|
Advert | |
|
05-23-2008, 05:06 AM | #51 | |
Wizard
Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
|
I linked to the alternate dictionary implementation above, why not have a look at it?
Anyway, here's the line which does the lookup: Quote:
Code:
abbacy = n должность или звание аббата abbe = n фр. церк. 1) аббат; 2) отец (обращение к священнику) abbess = n настоятельница монастыря, аббатиса |
|
05-23-2008, 03:43 PM | #52 | ||
eWriter
Posts: 267
Karma: 175607
Join Date: May 2007
Location: Frankfurt, FRG
Device: PB-IQ / Sony PRS-500
|
Quote:
I DID look up the link when you posted it some time ago - but the site for me only has a lot of question marks (no Russian fonts here on my HD) and a further-going link did not work with me... BUT: I will try your code example below asap! Quote:
|
||
05-23-2008, 04:36 PM | #53 |
Connoisseur
Posts: 98
Karma: 10
Join Date: Apr 2008
Device: sony prs 505
|
xxxxx
Last edited by scottsan; 05-23-2008 at 04:54 PM. Reason: reposted the message |
05-23-2008, 04:51 PM | #54 |
Connoisseur
Posts: 98
Karma: 10
Join Date: Apr 2008
Device: sony prs 505
|
Pardon my ignorance, but what is version .05? I have a prs505; which file do I use and where do I put the dictionary. I tried DictioLauncher05_505_SP1.zip (544.3 KB, 203 views), placed the dictionary (.txt) in the software folder, but when I inserted the sd card into the device nothing happened. I'm just hoping that if SONY ever releases a firmware update it will have a dictionary function.
Keep up the good work. Scott |
05-23-2008, 05:30 PM | #55 |
Member
Posts: 20
Karma: 140
Join Date: Apr 2008
Device: Sony PRS-505
|
Please note that you also have to include the definitions of all support functions (originaly taken form universal flasher utility, I think) & addon library libfskLoad.so as well - getComandResult is not a native javascript function.
I did a few tests and it should be fairly easy to reuse that code, but so far I didn't have the chance to get it running properly. |
05-24-2008, 02:18 AM | #56 | |
Member
Posts: 20
Karma: 140
Join Date: Apr 2008
Device: Sony PRS-505
|
Quote:
Clemenseken, let me know whether you intend to release a new version with this feature (I can provide you with my code, if you'd like to use it) or if you're busy so I shall continue with the tweaking. Some things will have to be reworked (eg. previous/next buttons), but it shouldn't be a big problem, I think. Last edited by lisak; 05-24-2008 at 04:35 PM. Reason: grammar... |
|
05-24-2008, 10:05 AM | #57 | ||
Wizard
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
|
@igorsk
That's why you da man! Yes calling a binary to do the search would be way faster than having an interpreted language do all of the work. @clemente If you already know this please ignore. But you will have to get rid of the '=' sign form igorsk original post for the search to work, since the dictionaries do not have an '=' after the definition word. Quote:
Quote:
Last edited by =X=; 05-24-2008 at 10:07 AM. Reason: updated grammer |
||
05-25-2008, 02:32 PM | #58 | |
eWriter
Posts: 267
Karma: 175607
Join Date: May 2007
Location: Frankfurt, FRG
Device: PB-IQ / Sony PRS-500
|
Quote:
well, I'm afraid it would be best (for us all) if I accept your offer to let you (and maybe others...) do the further "tweaking". I think it would make sense if you post your version here, and I place a link (or your original file) on the starting page of this thread. Then, I'd prefer it (from sentimental reasons) that you somehow give your "code" an - at least slightly - different name. (Especially as this may be the start of an "open project" among members here at mobileread...) I am busy with other things now and then; I will probably understand your code rather well - but might not be able to implement it myself very easily. |
|
05-30-2008, 03:13 PM | #59 |
Wizard
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
|
PRS-505 Speed Hack
@lisak
The first time I read your post, I didn't realize you had it working. Would have saved me several hours. Hi Clement/All, Since you mentioned you did not have much time to work on the speed issue, I spent some time updating the Dictionary to work using the 'grep' tool. This has speed up the search from ~45sec to ~1 sec. (there is a 10sec hit for the first search). Clement feel free to merge what you like from the code and discard what you do not like. NOTE: The changes where only tested on the PRS-505. PRS-500 users please let me know if you have any issues. INSTALL STEPS Unzip the file in the <Card >\Sony Reader\software folder this will create a "Dictionary" sub folder <Card >\Sony Reader\software\Dictionary Copy the autorun.* files up one directory copy autorun.* <Card >\Sony Reader\software\ Create a directory 'dict' sub directory under <SONY>\database\ and place the dictioanry *.txt files in that new directory copy <Card>\Sony Reader\software\dictonary\*.txt <SONY>\database\dict CHANGES
BROKEN Next/Prev word does not work as before. Now the next/prev word will start from the beginning of the dictionary =X= Last edited by =X=; 05-30-2008 at 03:16 PM. Reason: updated text for clarification |
05-31-2008, 09:36 AM | #60 | |
eWriter
Posts: 267
Karma: 175607
Join Date: May 2007
Location: Frankfurt, FRG
Device: PB-IQ / Sony PRS-500
|
Than=X=!
Quote:
I just downloaded your improved ***speed version*** of the dictionary software but did not have time, yet, to look into your code... I AM REALLY GLAD, YOU DID THE IMPLEMENTATION as I'm totally inexperienced with linux/grep. And I learned that even minor faults with syntax can take you hours/days to get it running... I just yesterday finished a game I was doing for sony-PRSs and will have time from coming week on to get your code mixed into my "older version". But I will put a link to this your previous post on page 1 of this thread right away! Than=X= again! (& pardon the pun,) Clemens |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Christmas gift: MahJonG game (starting from SD card via autorun) | Clemenseken | Sony Reader Dev Corner | 19 | 05-06-2011 04:09 PM |
Code to launch autorun from SD without pullin the card out | mkaluza | Sony Reader Dev Corner | 1 | 08-12-2008 12:05 PM |
PRS-500 Dictionary for Sony PRS500/5 (autorun from SD card) with onscreen keyboard | Clemenseken | Sony Reader Dev Corner | 3 | 07-05-2008 08:33 AM |
Dictionary for Sony PRS500/5 - new version next week ... | Clemenseken | Sony Reader Dev Corner | 1 | 04-15-2008 07:42 AM |
Dictionary for Sony PRS500/5 (runs from SD card) | Clemenseken | Sony Reader | 0 | 03-27-2008 05:58 PM |