edu.mit.jmwe.index
Interface IMWEIndex

All Known Implementing Classes:
InMemoryMWEIndex, MWEIndex

public interface IMWEIndex

An index of multi-word expressions (MWEs). The individual components of a multi-word expression are called the MWE's parts. This interface provides methods for retrieving MWEs based on their constituent parts, and for testing for the inclusion of a particular MWE in the index.

Since:
jMWE 1.0.0
Version:
$Id: IMWEIndex.java 620 2011-05-08 21:13:58Z markaf $
Author:
Nidhi Kulkarni, M.A. Finlayson

Field Summary
static String commentDoubleSemicolon
          Denotes that the following text is a comment.
static String commentDoubleSlash
          Denotes that the following text is a comment.
 
Method Summary
 void close()
          Closes the index if open.
 IMWEDesc get(IMWEDescID id)
          Returns the MWE description for the specified ID, or null if this index does not contain said description.
 Set<? extends IRootMWEDesc> get(String part)
          Returns a set of IRootMWEDesc objects whose MWEs contain the specified part.
 Set<? extends IMWEDesc> getAll(String part)
          Returns a set containing both IRootMWEDesc and IInfMWEDesc objects that the given string is a part of.
 Iterator<String> getIndexIterator()
          Returns an iterator that will iterate over all MWE parts in the index, in order.
 IInfMWEDesc getInflectedMWEDesc(String lemma, MWEPOS pos, String inflected)
          Returns the inflected MWE description for the specified root lemma, part of speech, and inflected form, or null if this index does not contain said description.
 Iterator<IRootMWEDesc> getRootIterator()
          Returns an iterator that will iterate over all root MWE descriptions in the index, in order.
 IRootMWEDesc getRootMWEDesc(String lemma, MWEPOS pos)
          Returns the root MWE description for the specified lemma and part of speech, or null if this index does not contain said description.
 boolean isOpen()
          Returns whether the index is open.
 boolean open()
          Prepares the index for use.
 

Field Detail

commentDoubleSlash

static final String commentDoubleSlash
Denotes that the following text is a comment.

Since:
jMWE 1.0.0
See Also:
Constant Field Values

commentDoubleSemicolon

static final String commentDoubleSemicolon
Denotes that the following text is a comment.

Since:
jMWE 1.0.0
See Also:
Constant Field Values
Method Detail

open

boolean open()
             throws IOException
Prepares the index for use. Mounts necessary files, opens sockets, or loads other data into memory that allows this index to service calls to its methods without throwing an IllegalStateException. Once open, an index can be closed by calling the close() method.

Returns:
true if the call succeeded, and the index is ready to service calls; false otherwise.
Throws:
IOException - if an IO exception is thrown while opening the index
Since:
jMWE 1.0.0

isOpen

boolean isOpen()
Returns whether the index is open. This method can be called at any time.

Returns:
true if the index is open and ready to accept calls; false otherwise.
Throws:
IOException - if an IO exception is thrown while opening the index
Since:
jMWE 1.0.0

close

void close()
Closes the index if open. If the index is not open, this method does nothing. Once closed, and index may be reopened.

Since:
jMWE 1.0.0

get

IMWEDesc get(IMWEDescID id)
Returns the MWE description for the specified ID, or null if this index does not contain said description.

Parameters:
id - the id for the MWE description desired; may not be null
Returns:
the MWE description for the specified ID, or null if none
Throws:
IllegalStateException - if this method is called when the index is closed
Since:
jMWE 1.0.0

getRootMWEDesc

IRootMWEDesc getRootMWEDesc(String lemma,
                            MWEPOS pos)
Returns the root MWE description for the specified lemma and part of speech, or null if this index does not contain said description.

Parameters:
lemma - the lemma for the MWE description desired; may not be null
pos - the part of speech for the MWE description desired; may not be null
Returns:
the root MWE description matching the specified lemma and part of speech, or null if none
Throws:
IllegalStateException - if this method is called when the index is closed
Since:
jMWE 1.0.0

getInflectedMWEDesc

IInfMWEDesc getInflectedMWEDesc(String lemma,
                                MWEPOS pos,
                                String inflected)
Returns the inflected MWE description for the specified root lemma, part of speech, and inflected form, or null if this index does not contain said description.

Parameters:
lemma - the lemma for the MWE description desired; may not be null
pos - the part of speech for the MWE description desired; may not be null
inflected - the inflected form of the MWE description desired; may not be null
Returns:
the inflected MWE description matching the specified arguments, or null if none
Throws:
IllegalStateException - if this method is called when the index is closed
Since:
jMWE 1.0.0

get

Set<? extends IRootMWEDesc> get(String part)
Returns a set of IRootMWEDesc objects whose MWEs contain the specified part. Retrieval is insensitive to case. If no entries are found, this method returns an empty set. The order of the returned set is implementation dependent.

Parameters:
part - a string representing the part for which entries should be retrieved
Returns:
a set of MWE entry objects that contain the specified part and are of the specified part of speech
Throws:
NullPointerException - if the specified part is null
IllegalArgumentException - if the specified part is empty or all whitespace
IllegalStateException - if this method is called when the index is closed
Since:
jMWE 1.0.0

getAll

Set<? extends IMWEDesc> getAll(String part)
Returns a set containing both IRootMWEDesc and IInfMWEDesc objects that the given string is a part of. Retrieval is insensitive to case. If no entries are found, this method returns an empty set. The order of the returned set is implementation dependent.

Parameters:
part - a string representing the part for which entries should be retrieved
Returns:
a set of MWE entry objects that contain the specified part
Throws:
NullPointerException - if the specified part is null
IllegalArgumentException - if the specified part is empty or all whitespace
IllegalStateException - if this method is called when the index is closed
Since:
jMWE 1.0.0

getRootIterator

Iterator<IRootMWEDesc> getRootIterator()
Returns an iterator that will iterate over all root MWE descriptions in the index, in order.

Returns:
an iterator that will iterate over all root MWE descriptions in the index, in order.
Since:
jMWE 1.0.0

getIndexIterator

Iterator<String> getIndexIterator()
Returns an iterator that will iterate over all MWE parts in the index, in order.

Returns:
an iterator that will iterate over all MWE parts in the index, in order.
Since:
jMWE 1.0.0


Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.