Differences between revisions 15 and 32 (spanning 17 versions)
Revision 15 as of 2005-06-09 08:52:02
Size: 4846
Comment:
Revision 32 as of 2009-04-10 16:51:33
Size: 4429
Editor: AnnCopestake
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
(Please note: POWER USERS only. BenWaldron is responsible for this module.) The LexDB is useful for grammars with large lexicons. Rather than storing the lexicon in a .tdl file, which has to be loaded each time the lexicon is changed, the LexDB stores the lexical entries in a postgres database. The instructions for using the LexDB are somewhat sparse and it is not expected that novice LKB users will make use of the system. The best approach for users who want to make use of the LexDB for their own grammars is to start by getting a LexDB going with an existing grammar in order to become familiar with the set up. The initial choice that
has to be made is whether to use the LexDB in the 'single user' or 'multiple user' modes. In the multiple user mode, the revisions are stored in the database itself. The assumption is that the database is running on a server to which multiple users may have access. This mode assumes that the database is set up with its own id (something that system administrators may dislike because of potential security risks). In single user mode, the database user may be the actual user. Revisions are not stored in the database (the assumption is that Subversion or CVS will be used to manage changes).
Line 5: Line 6:
'''NEW: The LKB/LexDB module now tested under both Linux and M$ Windows'''  * [http://www.cl.cam.ac.uk/~bmw20/Papers/ Papers]
Line 7: Line 8:
If running the LKB runtime binary:  * LkbLexDbSingleUser for basic instructions for the SINGLE USER LexDB
Line 9: Line 10:
 * Download and install (LkbInstallation) the latest LKB, taking care to install/extract the `lkb_data.tgz` archive into the lkb installation directory (henceforth [Linux] `~/lkb`).  * LkbLexDbMultiUser for basic instructions for the MULTI USER LexDB
Line 11: Line 12:
If running the LKB from source:
 * Download and compile (LkbCompilation) the LKB, ensuring that
   * your `.clinit.cl` file contains `(pushnew :psql *features*)`
 * JacyLexDb

 * LexDbEmacsInterface

 * LexDbFieldMappings
Line 15: Line 18:
Now initialize the database server (LexDbPsqlInitialize) and the lexical database itself (LexDbInitialize).  * LexDbInternals

The remainder of this page contains miscellaneous information about use of the LexDb.

== LKB Compilation ==

The LexDB code requires that *features* includes :psql. This is now true by default for supported platforms.
Line 18: Line 27:
''LexDB -> Filter'' ''LexDB -> Set Filter''
Line 29: Line 38:
(Note: the default is `TRUE`. This represents the empty condition and will select all available entries.) (Note: the default is `NULL`. Change this to a non-NULL value to select a subset of the lexical database.)
Line 31: Line 40:
The filter determines the entries in the lexicon as seen by a particular user. Only revision entries matching the filter conditions in filter can form part of the lexicon (of these, the most recent revision is the one actually used). The filter determines the entries in the lexicon as seen by a particular user. Only revision entries matching the filter conditions in filter can form part of the lexicon (of these, the most recent revision is the one actually used).  The filter is not available in single-user mode.
Line 53: Line 62:
2. ''LexDB -> Merge new entries'' 2. ''LexDB -> Load ('rev' entries)''
Line 57: Line 66:
== HOW TO dump LexDB as TDL file == == HOW TO export LexDB to TDL file ==
Line 59: Line 68:
''LexDB -> Dump (TDL format)'' ''LexDB -> Export (TDL file)''
Line 63: Line 72:
== HOW TO edit entries in the LexDB == == HOW TO import TDL entries from a file ==
Line 65: Line 74:
The LexDB-Emacs interface allows editing of lexical entries from within an Emacs environment (with browsing functionality, field completion, etc.). New revision entries are first stored in the users private schema, and hence are visible only to the particular user.

0. Add the following line to your `.emacs` file:

`(load "pg-interface")`

1. In [http://www.gnu.org/software/emacs/emacs.html GNU Emacs]: ''M-x lexdb'' to enter LexDB major mode. Then see the PG menu.

Available commands in LexDB major mode are:

''C-l'' : load (active revision of lexical entry) into Emacs

''C-c'' : commit (edited/new revision of) lexical entry into LexDB

''TAB'' : field completion

''M-TAB l'' : get (ring of) entries in table lex where value of current field matches that in buffer

''M-TAB r'' : get (ring of) entries in union of rev tables where value of current field matches that in buffer

''M-n'' : cycle through ring of entries obtained above

''M-s'' : as M-TAB, but explicitly specify field value

''M-va'' : view entries added in merge operation from dump file

''M-vs'' : view entries in user's privat rev

To remove a lexical entry from the current lexicon ''lex'', create a (head) revision where the `dead` field is set to `t` (true) rather than `f` (false). In this manner we keep a revision history even for entries which are no longer used (and such entries can be reactivated if necessary). No revision entry should ever be deleted from the lexical database itself.

== HOW TO load TDL entries into private rev ==

To add a small number of new (revision) entries from a `.tdl` file: ''LexDB -> Import TDL entries''. You will be queried to provide values for other certain non-grammar fields.
To add a small number of new (revision) entries from a `.tdl` file: ''LexDB -> Import (TDL file)''. You will be queried to provide values for other certain non-grammar fields. The entries will go into the private ''rev'' table.
Line 101: Line 78:
The LexDB consists of a single public schema and a set of private schemas, one per user. New (revision) entries are placed initially in your private schema. To commit (all) entries in your private schema to the public table: ''LexDB -> Commit private rev'' The LexDB consists of a single public schema and a set of private schemas, one per user. New (revision) entries are placed initially in your private schema. To commit (all) entries in your private schema to the public table: ''LexDB -> Commit private 'rev' ''
Line 106: Line 83:
From LKB: ''LexDB -> View private rev'' From LKB: ''LexDB -> Display private 'rev' ''
Line 114: Line 91:
''LexDB -> Clear private rev'' ''LexDB -> Clear private 'rev'''
Line 116: Line 93:
== Further Topics == == Troubleshooting ==
Line 118: Line 95:
LexDbInternals
[[BR]]["MWEs and Idiomatic Expressions"]
[[BR]] [http://www.cl.cam.ac.uk/~bmw20/DT/Papers/ Papers]
 * If M-x lexdb results in "no connection to LexDb", make sure that a working grammar is loaded.

LexDB Usage Instructions

The LexDB is useful for grammars with large lexicons. Rather than storing the lexicon in a .tdl file, which has to be loaded each time the lexicon is changed, the LexDB stores the lexical entries in a postgres database. The instructions for using the LexDB are somewhat sparse and it is not expected that novice LKB users will make use of the system. The best approach for users who want to make use of the LexDB for their own grammars is to start by getting a LexDB going with an existing grammar in order to become familiar with the set up. The initial choice that has to be made is whether to use the LexDB in the 'single user' or 'multiple user' modes. In the multiple user mode, the revisions are stored in the database itself. The assumption is that the database is running on a server to which multiple users may have access. This mode assumes that the database is set up with its own id (something that system administrators may dislike because of potential security risks). In single user mode, the database user may be the actual user. Revisions are not stored in the database (the assumption is that Subversion or CVS will be used to manage changes).

The remainder of this page contains miscellaneous information about use of the LexDb.

LKB Compilation

The LexDB code requires that *features* includes :psql. This is now true by default for supported platforms.

HOW TO set the filter

LexDB -> Set Filter

The filter specified is interpreted as an SQL WHERE clause. Examples:

     userid = 'danf'
     userid = 'danf' AND dialect = 'my_dialect'
     userid IN ('danf', 'aac')
     confidence > 0.5

(Note: the default is NULL. Change this to a non-NULL value to select a subset of the lexical database.)

The filter determines the entries in the lexicon as seen by a particular user. Only revision entries matching the filter conditions in filter can form part of the lexicon (of these, the most recent revision is the one actually used). The filter is not available in single-user mode.

HOW TO store LexDB in CVS

The LexDB may be dumped to text files which can then be uploaded to storage in CVS.

1. LexDB -> Dump

(This will dump public schema tables to text files -- eg. lexdb.rev, lexdb.rev_key, lexdb.dfn, lexdb.fld, lexdb.meta) BR(Note: the dump mechanism will also produce a .tdl file if *lexdb-dump-tdl* is set to t) BR(Note: the database dump files are tab-separated with null as \N)

2. Run the cvs commit command. E.g.

  • cvs commit ~/erg/lexdb.*

HOW TO retrieve LexDB from CVS

1. Run the cvs update command to retrieve the latest dump file. E.g.

  • cvs update ~/erg/lexdb.*

2. LexDB -> Load ('rev' entries)

These steps update the LexDB (public schema) to include all new revisions stored in a CVS dump file. The new entries will be copied to the table public.rev_new. Any changes made to your copy of the LexDB since the last update will be preserved.

HOW TO export LexDB to TDL file

LexDB -> Export (TDL file)

Dumps active LexDB entries (determined by filter) to .tdl file.

HOW TO import TDL entries from a file

To add a small number of new (revision) entries from a .tdl file: LexDB -> Import (TDL file). You will be queried to provide values for other certain non-grammar fields. The entries will go into the private rev table.

HOW TO commit entries to public rev

The LexDB consists of a single public schema and a set of private schemas, one per user. New (revision) entries are placed initially in your private schema. To commit (all) entries in your private schema to the public table: LexDB -> Commit private 'rev'

HOW TO list entries in private rev

From LKB: LexDB -> Display private 'rev'

or

from Emacs LexDB major mode: M-vs

HOW TO clear entries in private rev

LexDB -> Clear private 'rev

Troubleshooting

  • If M-x lexdb results in "no connection to LexDb", make sure that a working grammar is loaded.

LkbLexDb (last edited 2011-10-08 21:12:12 by localhost)

(The DELPH-IN infrastructure is hosted at the University of Oslo)