-
Notifications
You must be signed in to change notification settings - Fork 4
LexDbInitialize
- Create skeletal LexDB
- Populate LexDB
- Set LKB lexicon to LexDB
- Update LexDB version as necessary
You must create a new database to hold the LexDB. The LexDB-specific database structures must then be initialized. For the purpose of these instructions assume the LexDB will be called erg with field definition file ~/erg/lexdb.fld (see LexDbFieldMappings).
- At shell prompt (M$ Windows users will need Cygwin):
$ cd lkb/lexdb
$ chmod u+x install-lexdb.sh
$ bash install-lexdb.sh erg ~/erg/lexdb.fld ~/erg/lexdb.dfn
(Note: The encoding for the lexical database will be set to UNICODE.)
- You can view the field mappings in the field dfn just to make sure:
erg=> select * from dfn;
mode | slot | field | path | type
------+-------+------------+----------------------------------+-------------
erg | id | name | | symbol
erg | orth | orthography | | string-list
erg | unifs | alt2key | (synsem lkeys alt2keyrel pred) | mixed
erg | unifs | altkey | (synsem lkeys altkeyrel pred) | mixed
erg | unifs | altkeytag | (synsem lkeys altkeyrel carg) | string
erg | unifs | compkey | (synsem lkeys --compkey) | symbol
erg | unifs | keyrel | (synsem lkeys keyrel pred) | mixed
erg | unifs | keytag | (synsem lkeys keyrel carg) | string
erg | unifs | ocompkey | (synsem lkeys --ocompkey) | symbol
erg | unifs | orthography | (stem) | string-fs
erg | unifs | pronunciation | (synsem phon onset) | symbol
erg | unifs | type | nil | symbol
(10 rows)
erg=>
After performing the above initialization steps you have an empty database skeleton. This must be populated. Either:
- Populate LexDB using existing dump files;
- Convert TDL lexicon file to LexDB dump format, then populate LexDB using newly created dump files.
Retrieve the LexDB dump files (lexdb.rev, lexdb.rev_key, lexdb.dfn, lexdb.fld, lexdb.meta) from your CVS repository.
-
Run the LKB.
-
Load the grammar script file, ensuring LKB lexicon is set to LexDB (below).
-
From LexDB menu (Options->Expand Menu), select Merge new entries and choose the lexdb.rev file to load.
(The final step copies the contents of lexdb.rev into the database table public.rev. You can view this table using the tool LexDbPgAccess.)
(Note: generate such a file only for the purpose of initializing the database contents.)
Follow these steps to generate a new .rev file from an existing .tdl lexicon :
-
Run the LKB.
-
Load the grammar with the existing lexicon.tdl file in normal manner.
-
Connect to the skeletal LexDB: (lkb::initialize-lexdb :dbname "erg")
-
Evaluate (lkb::export-lexicon) to create LexDB dump files. (You will be asked to provide values for certain meta-level database fields.)
A .rev file will then be created in ~/tmp containing the exported lexicon. Any entries which could not be exported (eg. their structure could not be fully described using the mapping in the .dfn field mapping file) will appear in a corresponding .skip file (which can be treated as a standard TDL lexicon file).
(Note: If the grammar contains more than one lexicon each will be dumped separately.)
The LexDB functions as an alternative to the textual lexicon.tdl file. The lexical database functionality is configured via the LKB user parameter *lexdb-params* (LKB menu->Options->Set Options).
Specify the name of the lexical database we will connect to:
lkb::*lexdb-params* : ((:dbname "erg"))
In addition to :dbname, the following may also be set:
-
:user - username for database server login - default is your shell login
-
:port - port of database server - defaults to PGPORT
-
:host - specify a non-local host
-
:table - specify active mode (see dfn table) - default is value of :dbname
-
Edit the script file to replace call of form
{{{ (read-cached-lex-if-available
-
(list
- (lkb-pathname (parent-directory) "lexicon.tdl")
))}}}
with the following
{{{ ;; optionally, use a lexical database;
- ;; to activate the DB set *lexdb-params* (see globals.lsp) (if
*lexdb-params*
- (load-lexdb-from-script) (read-cached-lex-if-available
- (list
- (lkb-pathname (parent-directory) "lexicon.tdl") )))}}}
- (list
- (load-lexdb-from-script) (read-cached-lex-if-available
- Load the grammar using modified script file.
-
dump all data in LexDB
-
drop database. eg. dropdb -U lexdb erg
-
run new install-lexdb script
-
repopulate lexdb
Home | Forum | Discussions | Events