ewnUserManual

Aliaksandr Autayeu

About

ewn (edit WordNet) tool enables browsing and editing of dictionaries in WordNet format. ewn is a command-line tool written in Java and runs in Java Virtual Machine. It mimicks the syntax of the wnb tool from Princeton WordNet.

Online Documentation

Run ewn with no parameters to see built-in help message.

Running

ewn is launched by two shell scripts in the bin folder: ewn for Linux and other Unix-like systems and ewn.bat for Windows.

Configuration

ewn searches for dictionary using two methods:

  1. looking for ewn.xml configuration file in the current directory. This file is a standard extJWNL configuration file. Take file_properties.xml as an example, rename it and edit to suit your situation.
  2. looking for WNHOME environment variable and opening the dictionary using Dictionary.getFileBackedInstance(dictionaryPath)

Operation Modes

There are three operation modes:

  1. browsing
  2. editing using commands
  3. editing using a script

Browsing

In this mode ewn displays the content of the dictionary, such as words, glosses, relations, and various service information, such as sense keys, lexical ids or usage count. Basic command:

ewn word [-hgla] [-n#] -searchtype [-searchtype...]

Run ewn to see built-in help message for syntax.

For example

ewn glasses

if run against WordNet 3.0, produces the following overview

Information available for noun glasses
    -hypen  Hypernyms
    -hypon, -treen  Hyponyms & Hyponym Tree
    -synsn  Synonyms/Hypernyms (Ordered by Estimated Frequency)
    -smemn  Part of Holonyms
    -partn  Has Part Meronyms
    -meron  All Meronyms
    -domnn  Domain
    -famln  Familiarity & Polysemy Count
    -hmern  Hierarchical Meronyms
    -hholn  Hierarchical Holonyms
    -grepn  List of Compound Words
    -over   Overview of Senses

Information available for noun glass
    -hypen  Hypernyms
    -hypon, -treen  Hyponyms & Hyponym Tree
    -synsn  Synonyms/Hypernyms (Ordered by Estimated Frequency)
    -ssubn  Substance of Holonyms
    -smemn  Part of Holonyms
    -partn  Has Part Meronyms
    -meron  All Meronyms
    -holon  All Holonyms
    -derin  Derived Forms
    -famln  Familiarity & Polysemy Count
    -hmern  Hierarchical Meronyms
    -hholn  Hierarchical Holonyms
    -grepn  List of Compound Words
    -over   Overview of Senses

No information available for verb glasses

Information available for verb glass
    -hypev  Hypernyms
    -hypov, -treev  Hyponyms & Hyponym Tree
    -deriv  Derived Forms
    -famlv  Familiarity & Polysemy Count
    -framv  Verb Frames
    -grepv  List of Compound Words
    -over   Overview of Senses

No information available for adjective glasses

No information available for adverb glasses

The next example shows how to retrieve more information. Command

ewn goal -g -k -n1 -hypen

if run against WordNet 3.0, produces

Hypernyms of noun goal

4 of 4 senses of goal

Sense 1
goal [goal%1:09:00::], end [end%1:09:02::] -- (the state of affairs that a plan is intended to achieve and that (when achieved) terminates behavior intended to achieve it; "the ends justify the means")
    content [content%1:09:00::], cognitive content [cognitive_content%1:09:00::], mental object [mental_object%1:09:00::] -- (the sum or range of what has been perceived, discovered, or learned)
        cognition [cognition%1:03:00::], knowledge [knowledge%1:03:00::], noesis [noesis%1:03:00::] -- (the psychological result of perception and learning and reasoning)
            psychological feature [psychological_feature%1:03:00::] -- (a feature of the mental life of a living organism)
                abstraction [abstraction%1:03:00::], abstract entity [abstract_entity%1:03:00::] -- (a general concept formed by extracting common features from specific examples)
                    entity [entity%1:03:00::] -- (that which is perceived or known or inferred to have its own distinct existence (living or nonliving))

Command Editing

In this mode ewn edits the content of the dictionary, namely: adding and removing synsets, words, relations, editing glosses, usage counts, exceptional forms. Basic command for most operations:

ewn sensekey -command [value] [-command value] ... [sensekey -command ...]

is a sequence of sensekeys followed by commands and their values. Since dictionary loading and saving are expensive operations, one might want to combine many commands in one command line. In fact, the next mode, script editing is a better option for bulk editing. To work with exceptional forms, there is another basic form:

ewn pos#derivation -command value

Script Editing

This mode is convenient for bulk editing. Basic command:

ewn -script filename

This command points the ewn tool to a script file named filename, which contains the dictionary editing commands in the same syntax as in command editing mode. For example, a script file might contains the following commands:

goal%1:09:00:: -add -addword end -setgloss "the state of affairs that a plan ... achieve it; ""the ends justify the means"""
goal%1:09:00:: -addptr content%1:09:00:: @
n#oxen -addexc ox

The first line adds synset, identified by a sensekey goal%1:09:00:: to a dictionary, using -add command. WordNet man pages contain information about sense key format. Then it adds the word end to this synset, using command -addword end. Then it sets the gloss of the synset, using the command -setgloss ..... Notice it is possible to "chain" operations on the same synset without repeating the sensekey. Notice also the quotes. This escaping works in Windows shell. The outer pair of quotes is necessary for the shell to pass several words as a single argument. The inner quotes are therefore duplicated to be passed as normal quotes.

The second line adds a hypernym (specified by its key @) content (specified by its sensekey content%1:09:00::) of the word goal, using -addptr content%1:09:00:: @ command. WordNet man pages contain information about pointer keys.

The third line adds an exceptional form oxen to the word ox using n#oxen -addexc ox command.


Related

Wiki: Home