com.googlecode.whatswrong.io
Interface CorpusFormat

All Known Implementing Classes:
BioNLP2009SharedTaskFormat, GaleAlignmentFormat, LispSExprFormat, TabFormat, TheBeastFormat

public interface CorpusFormat

The CorpusFormat interface describes objects that can load a list of NLPInstances from a file. The Corpus can also provide a GUI element that allows the user to configure how the file is to be loaded.

Author:
Sebastian Riedel

Nested Class Summary
static interface CorpusFormat.Monitor
          A Monitor monitors the progress of the load(java.io.File, int, int) method.
 
Method Summary
 javax.swing.JComponent getAccessory()
          Returns the GUI element that controls how this format is to be loaded.
 java.lang.String getLongName()
          Returns a longer name that may contain information about the configuration of this format.
 java.lang.String getName()
          Returns the name of this format.
 java.util.List<NLPInstance> load(java.io.File file, int from, int to)
          Loads a corpus from a file, starting at instance from and ending at instance to (exclusive).
 void loadProperties(java.util.Properties properties, java.lang.String prefix)
          Loads a configuration for this format from the given Properties object.
 void saveProperties(java.util.Properties properties, java.lang.String prefix)
          Saves the configuration of this format to a Properties object.
 void setMonitor(CorpusFormat.Monitor monitor)
          Sets the objects that monitors the progress of this format when loading a file.
 

Method Detail

getName

java.lang.String getName()
Returns the name of this format.

Returns:
the name of this format.

getLongName

java.lang.String getLongName()
Returns a longer name that may contain information about the configuration of this format.

Returns:
the long name of this format.

getAccessory

javax.swing.JComponent getAccessory()
Returns the GUI element that controls how this format is to be loaded.

Returns:
the GUI element that controls how this format is to be loaded.

setMonitor

void setMonitor(CorpusFormat.Monitor monitor)
Sets the objects that monitors the progress of this format when loading a file.

Parameters:
monitor - the monitor for this format.

loadProperties

void loadProperties(java.util.Properties properties,
                    java.lang.String prefix)
Loads a configuration for this format from the given Properties object.

Parameters:
properties - the Properties object to load from.
prefix - the prefix that properties for this format have in the Properties object.

saveProperties

void saveProperties(java.util.Properties properties,
                    java.lang.String prefix)
Saves the configuration of this format to a Properties object.

Parameters:
properties - the Properties object to store this configuration of this format to.
prefix - the prefix that the properties should have.

load

java.util.List<NLPInstance> load(java.io.File file,
                                 int from,
                                 int to)
                                 throws java.io.IOException
Loads a corpus from a file, starting at instance from and ending at instance to (exclusive). This method is required to call CorpusFormat.Monitor.progressed(int) after each instance that was processed.

Parameters:
file - the file to load the corpus from.
from - the starting instance index.
to - the end instance index.
Returns:
a list of NLP instances loaded from the given file in the given interval.
Throws:
java.io.IOException - if I/O goes wrong.


Copyright © 2010. All Rights Reserved.