info.ephyra.nlp.indices
Class IrregularVerbs

java.lang.Object
  extended by info.ephyra.nlp.indices.IrregularVerbs

public class IrregularVerbs
extends java.lang.Object

A dictionary of irregular verbs in English. For each verb, the infinitive, simple past and past participle forms are given.

The dictionary is case-insensitive, so it does not matter whether a verb that is looked up is in upper or lower case.

Version:
2005-09-26
Author:
Nico Schlaefer

Field Summary
private static java.util.ArrayList<java.lang.String> inf
          The infinitive forms of the irregular verbs.
private static java.util.ArrayList<java.lang.String> pp
          The past participle forms of the irregular verbs.
private static java.util.ArrayList<java.lang.String> sp
          The simple past forms of the irregular verbs.
 
Constructor Summary
IrregularVerbs()
           
 
Method Summary
private static int getIndex(java.lang.String verb)
          Returns the index of a verb or -1, if the verb is not in the dictionary.
static java.lang.String[] getInfinitive(java.lang.String verb)
          Returns the infinitive forms of a verb or null, if the verb is regular.
static java.lang.String[] getPastParticiple(java.lang.String verb)
          Returns the past participle forms of a verb or null, if the verb is regular.
static java.lang.String[] getSimplePast(java.lang.String verb)
          Returns the simple past forms of a verb or null, if the verb is regular.
static boolean loadVerbs(java.lang.String filename)
          Reads the irregular verbs from a text file of the following format: infinitive_of_verb_1 simple_past_of_verb_1 past_participle_of_verb_1
...
static java.lang.String lookup(java.lang.String verb)
          Looks up a verb in the dictionary.
private static boolean matches(java.lang.String word, java.lang.String words)
          Determines whether a word is in a list of words separated by "/".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inf

private static java.util.ArrayList<java.lang.String> inf
The infinitive forms of the irregular verbs.


sp

private static java.util.ArrayList<java.lang.String> sp
The simple past forms of the irregular verbs.


pp

private static java.util.ArrayList<java.lang.String> pp
The past participle forms of the irregular verbs.

Constructor Detail

IrregularVerbs

public IrregularVerbs()
Method Detail

matches

private static boolean matches(java.lang.String word,
                               java.lang.String words)
Determines whether a word is in a list of words separated by "/". Does not distinguish between lower and upper case.

Parameters:
word - word to test
words - words separated by "/"
Returns:
true, iff the word is in the list

getIndex

private static int getIndex(java.lang.String verb)
Returns the index of a verb or -1, if the verb is not in the dictionary.

Parameters:
verb - verb to check
Returns:
index or -1

loadVerbs

public static boolean loadVerbs(java.lang.String filename)

Reads the irregular verbs from a text file of the following format:

infinitive_of_verb_1 simple_past_of_verb_1 past_participle_of_verb_1
...
infinitive_of_verb_n simple_past_of_verb_n past_participle_of_verb_n

Equivalent forms of the same verb should be separated by "/", e.g.:

infinitive simple_past_1/simple_past_2 past_participle_1/past_participle_2

Parameters:
filename - name and path of the textfile
Returns:
true, iff the verbs were loaded successfully

lookup

public static java.lang.String lookup(java.lang.String verb)
Looks up a verb in the dictionary. Returns INF/SP/PP, if the verb is in its infinitive/simple past/past participle form or null, if the verb is not in the dictionary.

Parameters:
verb - verb to look up
Returns:
INF, SP, PP or null

getInfinitive

public static java.lang.String[] getInfinitive(java.lang.String verb)
Returns the infinitive forms of a verb or null, if the verb is regular.

Parameters:
verb - verb in infinitive, simple past or past participle
Returns:
infinitive forms of the verb or null

getSimplePast

public static java.lang.String[] getSimplePast(java.lang.String verb)
Returns the simple past forms of a verb or null, if the verb is regular.

Parameters:
verb - verb in infinitive, simple past or past participle
Returns:
simple past forms of the verb or null

getPastParticiple

public static java.lang.String[] getPastParticiple(java.lang.String verb)
Returns the past participle forms of a verb or null, if the verb is regular.

Parameters:
verb - verb in infinitive, simple past or past participle
Returns:
past participle forms of the verb or null