1 / 20

FREEDIC

FREEDIC. A SymbianOS based multilingual dictionary for the Nokia 7710. Contents. Load Dictionary file Dictionary class design Database Lookup Function Plan to show main GUI window Implementing main GUI Window and source code. Load Dictionary file. Format of Dictionary file

zuzana
Télécharger la présentation

FREEDIC

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FREEDIC A SymbianOS based multilingual dictionary for the Nokia 7710

  2. Contents • Load Dictionary file • Dictionary class design • Database Lookup Function • Plan to show main GUI window • Implementing main GUI Window and source code

  3. 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 string and its offset in .dict file. • .dict file contain the detail translation and explanation of each word.

  4. Load Dictionary file • How is it load into memory? • Very important to reduce memory consumption.

  5. 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.

  6. Database Lookup Function • Three type of lookup function

  7. Database Lookup Function • Interface of Lookup Function • bool SimpleLookupWord(const gchar* sWord, glong & iWordIndex, int iLib); • 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.) • bool LookupWithFuzzy(const gchar *sWord, gchar *reslist[], gint reslist_size); • sWord is the string of the keyword, • reslist[] will return a group of similar word entries. • reslist_size will determine maximum similar words to find. • gint LookupWithRule(const gchar *sWord, gchar *reslist[]);

  8. Database Lookup Function (Simple lookup function:)

  9. Database Lookup Function • Source code for lookup page table & entries within a page while (iFrom<=iTo) { iThisIndex=(iFrom+iTo)/2; //divide the table into half cmpint = stardict_strcmp(str, get_first_on_page_key(iThisIndex)); //comparing if (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 found bFound=true; //mark the flag break; //need no more search, break the loop } }

  10. Plan to show • Format of Dictionary file • The main GUI window will be used for users to input text for dictionary searches. • Left pane : text editor for search word and list of matches • Right pane : contents or details for the currently selected word • As the focus moves within the List pane, the right pane updates dynamically.

  11. Implementation Main Window • Main menu • Dictionary file • Select Language • Background • Exit

  12. Main Menu details • Dictionary file • Select the dictionary database among several dictionaries • Select Language • Select the language what we want to know that’s meaning • Background • Call the background process function • This will be explained later. • Exit

  13. Source code for main window - 1 • Code for Text Edit Box RESOURCE CONTROLS texteditor_view { controls = { EDWIN { flags=0; width=5; lines=1; maxlength=20; } }; } RESOURCE TBUF texteditor_view_label { buf="Input:"; } CEikEdwin* iEdwin; iEdwin = new ( ELeave ) CEikEdwin(TGulBorder::ENone); iEdwin->ConstructL(CEikEdwin::EOnlyASCIIChars,10,32,5); iEdwin->SetContainerWindowL(*this); iEdwin->SetPosition(TPoint(20,20)); RESOURCE TBUF texteditor_view_label { buf=""; }

  14. Source code for main window - 2 • Code for Text List Box RESOURCE ARRAY r_textlist_array_strings { items= { TBUF { buf="My List Item 1"; }, TBUF { buf="My List Item 2"; } }; } RESOURCE LISTBOX r_freedic_textlist { array_id=r_textlist_array_strings; } RESOURCE DIALOG r_textlist_dialog { // specify the title, flags, and buttons if needed items= { DLG_LINE { type=EEikCtListBox; id=EMyTextListbox; control=r_textlistbox; } }; }

  15. Background monitoring • Monitor the clipboard and events from the background • Currently works on the emulator but not on the hardware

  16. Background monitor slides

  17. Background monitor slides

  18. Future work • Loading dictionary • Read index and dict file. By 4.8 • Construct page table. By 4.15 • Searching algorithm • Port simple search algorithm By 4.29 • Port other search algorithm By 5.6 • Implement B-plus-tree structure for Asian word searching. (Optional)

  19. Future work • Problem in Main GUI Windows • Controls like Text edit box and Text list box was not viewed • Searching the solution of this problem in several sample source code and posted Q&A in Nokia Forum webpage • Implementing “Select Language” menu with Combo Box

  20. Future work • Display Asian fonts • Monitor events from the background in hardware

More Related