|
ewnpy is a command line interface to Eurowordnet for Dutch
written in Python .
This is the README file for ewnpy, version 1.0 beta.
--------------------------------------------------------------------------------
Description
--------------------------------------------------------------------------------
ewnpy is a command line interface to Eurowordnet for Dutch written in
Python.It allows you ask questions about lexical relations between
words, such as "Is word X a synonym of word Y?", "What are the
hyponyms of the verb X?", etc. It consists of several files:
- ewnparse.py: library to parse Eurowordnet database file in text format
- ewnlex.py: library to create a lexicon from the Eurowordnet database
files, and to query the lexicon.
- ewn2pickle: command line script to convert Eurowordnet database files to
a pickled lexicon
- ewnserver and ewnclient: client/server combination to query the
lexicon over a socket connection
--------------------------------------------------------------------------------
Platform
--------------------------------------------------------------------------------
Tested on Linux and OS X. Should work on any OS with a Python
interpreter, which includes MS windows.
--------------------------------------------------------------------------------
Requirements
--------------------------------------------------------------------------------
- Eurowordnet for Dutch, including the database files in text format
(.ewn). See http://www.illc.uva.nl/EuroWordNet/
- a recent version of Python (2.3 or later)
--------------------------------------------------------------------------------
License
--------------------------------------------------------------------------------
GNU Public License (see the file GPL)
--------------------------------------------------------------------------------
Author:
--------------------------------------------------------------------------------
Erwin Marsi (see the file CONTACT)
--------------------------------------------------------------------------------
Install
--------------------------------------------------------------------------------
1. unzip the zip file anywhere you like
2. change to the ewnpy directory
3. Use 'ewn2pickle' to create a a Python pickle from the Eurowordnet
database files in text format (.ewn). Assuming that your
Eurowordnet files are in '~/eurowordnet/dutch', you can type
ewn2pickle ~/eurowordnet/dutch/wn_nl_*.ewn wn_nl.pickle
--------------------------------------------------------------------------------
Usage
--------------------------------------------------------------------------------
There are basically three ways to use ewnpy.
1. From with the Python interpreter
Here's a simple sample session.
$ python
Python 2.3 (#1, Sep 13 2003, 00:49:11)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ewnlex
>>> lex = ewnlex.Lexicon()
>>> lex.load('wn_nl.pickle')
>>> lex.write_entry('python')
Word: python
Part-of-speech: n
Sense: 1
Relation: has_hyperonym:
slang (n,1)
>>> lex.write_entry('programmeren')
Word: programmeren
Part-of-speech: v
Sense: 1
Relation: has_hyponym:
voorprogrammeren (v,1)
Relation: has_hyperonym:
ontwerpen (v,1)
Sense: 2
Relation: involved_result:
planning (n,1)
Relation: has_hyperonym:
ontwerpen (v,1)
regelen (v,1)
Relation: has_hyponym:
afspreken (v,1)
omprogrammeren (v,1)
timen (v,2)
Relation: has_synonym:
plannen (v,1)
uitstippelen (v,1)
Relation: xpos_near_synonym:
planning (n,2)
Relation: is_subevent_of:
leiden (v,4)
beleid (n,1)
>>> lex.has_synonym('programmeren', 'plannen')
True
>>> lex.has_synonym('programmeren', 'plannen', senses='1')
False
>>> lex.hyperonyms_closure('programmeren')
[('denken', 'v', 1), ('bezighouden', 'v', 3), ('maken', 'v', 2),
('veroorzaken', 'v', 1), ('doen', 'v', 5), ('bedenken', 'v', 2),
('gebeuren', 'v', 2), ('regelen', 'v', 1), ('ontwerpen', 'v', 1),
('handelen', 'v', 2)]
To see documentation on other functions, type 'help(ewnlex)'
2. Using the client and server
Start the server with
ewnserver -v wn_nl.pickle &
Try 'ewnserver -h' for more info.
The client reads for standard input and writes to standard output. To
run an interactive session, simply run the client with
ewnclient
and type you queries.
Here's a sample session again:
$ ./ewnclient
programmeren has_hyperonym
ontwerpen v 1,ontwerpen v 1,regelen v 1
programmeren has_synonym plannen
1
programmeren has_transitive_hyperonym
denken v 1,bezighouden v 3,maken v 2,veroorzaken v 1,doen v 5,bedenken
v 2,gebeuren v 2,regelen v 1,ontwerpen v 1,handelen v 2
...
For more information on the format of the queries and options, type
'ewnclient -h'.
3. Usage in your own scripts
Of course, you can also import ewnlex to use its function in your own
Python scripts.
--------------------------------------------------------------------------------
Documentation
--------------------------------------------------------------------------------
All scripts all self-documenting: use the '-h' options. With respect
to the libraries, use the 'help' function from within the Python
interpreter (e.g. 'help(ewnlex)' after you did 'import ewnlex').
--------------------------------------------------------------------------------
PS
--------------------------------------------------------------------------------
If you find ewnpy useful, find bugs, or make improvements, please let
me know.
good luck!
Erwin
$Id: README,v 1.2 2004/07/13 19:55:35 emarsi Exp $
|