edu.mit.jmwe.index
Class MWEIndex

java.lang.Object
  extended by edu.mit.jmwe.index.InMemoryMWEIndex
      extended by edu.mit.jmwe.index.MWEIndex
All Implemented Interfaces:
IMWEIndex

public class MWEIndex
extends InMemoryMWEIndex

Simple implementation of IMWEIndex that reads an index, possibly with internal comments prefixed by '//' or ';;', from a URL.

Since:
jMWE 1.0.0
Version:
$Id: MWEIndex.java 616 2011-05-07 01:00:47Z markaf $
Author:
M.A. Finlayson

Field Summary
 
Fields inherited from class edu.mit.jmwe.index.InMemoryMWEIndex
lifecycleLock
 
Fields inherited from interface edu.mit.jmwe.index.IMWEIndex
commentDoubleSemicolon, commentDoubleSlash
 
Constructor Summary
MWEIndex(File file)
          Constructs the index from the given source file pointing to a list of multi-word expressions.
MWEIndex(Iterable<String> origData)
          Constructs the index from a String of multi-word expressions.
MWEIndex(Map<IMWEDescID,? extends IRootMWEDesc> rootDescs)
          Constructs the index from a map of IMWEDescIDs to IRootMWEDescs.
MWEIndex(String... rootDescs)
          Constructs this index from an array of multi-word expression strings.
MWEIndex(URL url)
          Constructs a new MWE index that uses the data from the specified URL to construct its index.
 
Method Summary
protected  Map<IMWEDescID,? extends IRootMWEDesc> createData()
           
 URL getSource()
          Returns the URL used by this index.
 
Methods inherited from class edu.mit.jmwe.index.InMemoryMWEIndex
checkOpen, close, createData, createData, createIndex, get, get, getAll, getIndexIterator, getInflectedMWEDesc, getRootIterator, getRootMWEDesc, insert, isComment, isOpen, open
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MWEIndex

public MWEIndex(String... rootDescs)
Constructs this index from an array of multi-word expression strings. The parts and part of speech of each multi-word expression should be separated by underscores and each multi-word expression, if there is more than one, should be separated by a space character. If the String is formatted incorrectly, the index will not open.

Parameters:
rootDescs - the array of multi-word expression strings this index will be constructed from.
Since:
jMWE 1.0.0

MWEIndex

public MWEIndex(Iterable<String> origData)
Constructs the index from a String of multi-word expressions. The parts and part of speech of each multi-word expression should be separated by underscores and each multi-word expression, if there is more than one, should be separated by a space character. If the string is formatted incorrectly, the index will not open. For example:
 this_and_that_R
 

Parameters:
origData - iterable of multi-word expression definitions. The parts and part of speech of each multi-word expression should be separated by underscores and each multi-word expression, if there is more than one, should be separated by a space character.
Since:
jMWE 1.0.0

MWEIndex

public MWEIndex(Map<IMWEDescID,? extends IRootMWEDesc> rootDescs)
Constructs the index from a map of IMWEDescIDs to IRootMWEDescs.

Parameters:
rootDescs - a map of IMWEDescIDs to IRootMWEDescs. May not be /null.
Since:
jMWE 1.0.0

MWEIndex

public MWEIndex(File file)
Constructs the index from the given source file pointing to a list of multi-word expressions.

Parameters:
file - the list of multi-word expressions. May not be null.
Since:
jMWE 1.0.0

MWEIndex

public MWEIndex(URL url)
Constructs a new MWE index that uses the data from the specified URL to construct its index.

Parameters:
url - the URL at which the index data is found
Throws:
NullPointerException - if the specified URL is null
Since:
jMWE 1.0.0
Method Detail

getSource

public URL getSource()
Returns the URL used by this index.

Returns:
the URL, non-null, used by this index
Since:
jMWE 1.0.0

createData

protected Map<IMWEDescID,? extends IRootMWEDesc> createData()
                                                     throws IOException
Specified by:
createData in class InMemoryMWEIndex
Throws:
IOException


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