freedic a symbianos based multilingual dictionary for the nokia 7710 chong poh kit ; dao yuan;...

18
FREEDIC A SymbianOS based multilingual dictionary for the Nokia 7710 Chong Poh Kit ; Dao Yuan; SeungHyun Whang

Upload: marlene-mitchell

Post on 17-Dec-2015

222 views

Category:

Documents


1 download

TRANSCRIPT

FREEDIC

A SymbianOS based multilingual dictionary for the Nokia 7710

Chong Poh Kit ; Dao Yuan; SeungHyun Whang

Contents

GUI Background monitoring Classes design Loading dictionary Lookup Function Advantages Future work

GUI Format of Dictionary fil

e The main GUI window

will be used for users to input text and to display output for dictionary searches.

Top combobox pane : word to search

Bottom textbox: Output of search function

Buttons

Clear List Clears the

searched words list Background

Sends the dictionary to the background but leave it running

Exit Permanently end the

dictionary session

Menu About

A short message about the dictionary

Copy Copy the selected

text Background

Sends the dictionary to the background but leave it running

Exit Permanently end the

dictionary session

Copying

Background monitoring

Monitor for key-press events from the background

Wakes up the dictionary and puts it to the foreground to display the text

Dictionary class design The dictionary will be divide into following classes.

Application core class contains GUI, and it generally describes all functions of the e-dictionary.

Libs class contains all dictionaries, and it handles all the function calls from AppCore, and forward them to each Dictionary.

Dict class contains everything about a particular dictionary, the INDEX file, the DATA file, and how to lookup a key word in dictionary.

Index class only deal with index file, constructing the page table, looking up words from index and return its offset in DATA file.

Load Dictionary file Format of Dictionary file

Contain three files - .ifo .idx .dict .ifo file describe general information about the

dictionary. # of word entries, etc. .idx file is a index file of .dict file. It record word s

tring and its offset in .dict file. .dict file contain the detail translation and expla

nation of each word.

Example of loading .ifo file

Load Dictionary file How is it loaded into memory?

Very important to reduce memory consumption.

Data file: ( 4.3 MB)

offset=========word_1_data_1_dataword_1_data_2_dataword_2_data_1_dataword_2_data_2_data

......==============

like

1000==========apple [Apl]

A delicious fruit......

==============

Index file: ( 600 KB)

============== word_str; apple(a utf-8 string terminated by '\0'.) word_data_offset; 1000 // word data's offset in .dict file word_data_size; 500// word data's total size in .dict file......

==============

Memory-page table: (19 KB)

============== word_str; page number; page size;

==============

Memory-page: ( 560 B)

page 1========== word_str; word_data_offset; word_data_size; //64 entry per page.

==============

Database Lookup Function

SimpleLookup Compare the searching word in INDEX file and than read the o

ffset to the DATA file. Interface of SimpleLookup Function

TBool SimpleLookupWord(TDesC & sWordsWord, TInt32 & iWordIniWordIndexdex, TInt iLibiLib);

sWord is the string of the keyword, iWordIndex will return the offset to the DATA file iLib will determine which dictionary to search.

(Since it is will load several dictionary page table into memory.)

Lookup Function Call (Simple lookup function:)

<A word is inputed for search>

<Libs> <Dict> <offset_index><AppCore::>

for (int iLib=0; iLib<oLibs.ndicts(); iLib++) oLibs.SimpleLookupWord(word, offset of that dictionary, dictionary number);

Forward the search to the corresponding dictionary

oLib[iLib]->Lookup(word, offset)

Forward the Lookup in its index file

idx_file->lookup(str, idx)

Event: A searching key word i s entered

Look up in every dictionary:

Look up the page number in page_table

Load the page into memory

Look up the entry in the page

With the offset value to DATA file, explanation can be read from it to the memory.Then, display the explanation in textbox.

Database Lookup Function

Source code to lookup page table & entries within a page

while (iFrom<=iTo) {iThisIndex=(iFrom+iTo)/2; //divide the table into halfcmpint = stardict_strcmp(str, get_first_on_page_key(iThisIndex)); //compar

ingif (cmpint>0) // if the word is in second half,iFrom=iThisIndex+1; //reduce searching range by cutting first half else if (cmpint<0) // if the word is in first half,iTo=iThisIndex-1; //reduce searching range by cutting second half else { // if the word is foundbFound=true; //mark the flagbreak; //need no more search, break the loop}}

Advantages

Configurable Faster Multilingual Free dictionary files Background function Copying

Future work

Loading dictionary Automatically load all possible dictionary files

from the user specified directory. For large index file (>4MB), use segmented

loading method. Change the “entry per page” according to the

total number of word entry in all dictionary.

Searching algorithm Adding rule search and fuzzy search function.

Future work

New dictionary file addition through one-click function.

Dictionary file creation code. Camera support for dictionary

search. Support for more languages in the

menu. Currently, only English is used in the menus.