Re: [NTLK] AddWordToDictionary

From: M. Horvat <redjazz_slo_at_yahoo.com>
Date: Sat Mar 14 2009 - 05:29:45 EDT

--- On Sat, 3/14/09, Valerio Paris Mitritsakis wrote:
> I think it would benefit anyone on this list that might try
> to use the
> same function in the future if you explained how
> you got to the number 31.

Hmmm, you are right. I found the number 31 on page "10-44" of the Newton Programmer's Guide 2.0 (page 420 if you have the PDF version like I do). Here are all the values (put in a nice ASCII table):

DictionaryID Constant Value Contents
------------ -------------- --------
kUserDictionary 31 Words added by the user.
kCommonDictionary 0 Commonly-used words.
kCountriesDictionary 8 Names of countries.
kDaysMonthsDictionary 34 Names of days and months.
kFirstNamesDictionary 48 First names.
kLocalCitiesDictionary 41 Names of cities.
kLocalPropersDictionary 2 Proper names.
kLocalStatesDictionary 43 Names of states, provinces, etc.
kSharedPropersDictionary 1 Proper names, company names, state or province names and abbreviations.

First I tried 0 and 1, but it didn't work, because it turns out, 0 and 1 are dictionaries stored in ROM, therefore they cannot be written to.

Oh, and if anyone wants to know why I needed that function, well, it was a quick way to add a thousand words to the user word list. I'm Slovenian and I use OS 1.x, therefore I couldn't make a dictionary package to use Slovenian words. I added my words like this:

dummy := GetRoot().reviewDict;
if dummy then
  begin
    AddWordToDictionary(31, "firstexampleword");
    AddWordToDictionary(31, "secondexampleword");
    // insert other words here
    AddWordToDictionary(31, "lastexampleword");
  end;

This is NOT the official way to do this - in the book it says that "this way might not be supported in future NOS versions" or something like that, but, since there was no NOS 3, it doesn't matter at all.

Hope that helps.

-Matej Horvat

      

====================================================================
The NewtonTalk Mailing List - http://www.newtontalk.net/
The Official Newton FAQ - http://www.splorp.com/newton/faq/
The Newton Glossary - http://www.splorp.com/newton/glossary/
WikiWikiNewt - http://tools.unna.org/wikiwikinewt/
====================================================================
Received on Sat Mar 14 05:29:53 2009

This archive was generated by hypermail 2.1.8 : Sat Mar 14 2009 - 07:30:00 EDT