-
Notifications
You must be signed in to change notification settings - Fork 4
LexDbInitialize
- Obtain lexicon in LexDB dump format
- Create initialise PostgreSQL LexDB
- Set LKB lexicon to LexDB
Either
-
you have an existing grammar for which these are provided; or
-
you must convert an existing .tdl lexicon to LexDB dump format:
-
Run the LKB.
-
Load the grammar with the existing .tdl lexicon file(s) 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.)
-
The dump files (.rev, .dfn, .fld, .meta) will be created in your "LKB temp" directory. 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.)
-
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 LexDB config files ~/erg/lexdb.*; if you do not yet have a .fld and a .dfn file you must create these before proceeding (see LexDbFieldMappings); you also need a .rev file with which to populate the database.
- At shell prompt (M$ Windows users will need Cygwin):
$ cd lkb/lexdb
$ bash install-lexdb.sh erg ~/erg lexdb
(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;
slot | field | path | type
-------+---------------+--------------------------------+------------
id | name | | sym
orth | orthography | | str-rawlst
unifs | alt2key | (synsem lkeys alt2keyrel pred) | mixed
unifs | altkey | (synsem lkeys altkeyrel pred) | mixed
unifs | altkeytag | (synsem lkeys altkeyrel carg) | str
unifs | compkey | (synsem lkeys --compkey) | sym
unifs | keyrel | (synsem lkeys keyrel pred) | mixed
unifs | keytag | (synsem lkeys keyrel carg) | str
unifs | ocompkey | (synsem lkeys --ocompkey) | sym
unifs | orthography | (stem) | str-lst
unifs | pronunciation | (synsem phon onset) | sym
unifs | type | nil | sym
(12 rows)
As above, but use an empty .rev file. This can be created with a shell command such as the following:
echo '' > lexdb.rev
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.
Home | Forum | Discussions | Events