@CreoleResource(name="Configurable Exporter", comment="Allows annotations to be exported according to a specified format.") public class ConfigurableExporter extends gate.creole.AbstractLanguageAnalyser implements gate.ProcessingResource, Serializable
{index}, {class}, "{content}"might result in an output file something like
10000004, A, "Some text .." 10000005, A, "Some more text .." 10000006, B, "Further text .." 10000007, B, "Additional text .." 10000008, B, "Yet more text .."Annotation features can also be specified using dot notation, for example;
{index}, {instance.class}, "{content}"The PR is useful for outputting data for use in machine learning, and so each line is considered an "instance". Instance is specified at run time, and by default is a document, but might be an annotation type. Instances are output one per line and the config file specifies how to output each instance. Annotations included in the output file are the first incidence of the specified type in the instance. If there is ever a need for it I might fix it so you can output more than one incidence of the same annotation type.
ANNOTATION_COREF_FEATURE_NAME, DATE_ANNOTATION_TYPE, DATE_POSTED_ANNOTATION_TYPE, DEFAULT_FILE, DOCUMENT_COREF_FEATURE_NAME, JOB_ID_ANNOTATION_TYPE, LOCATION_ANNOTATION_TYPE, LOOKUP_ANNOTATION_TYPE, LOOKUP_CLASS_FEATURE_NAME, LOOKUP_INSTANCE_FEATURE_NAME, LOOKUP_LANGUAGE_FEATURE_NAME, LOOKUP_MAJOR_TYPE_FEATURE_NAME, LOOKUP_MINOR_TYPE_FEATURE_NAME, LOOKUP_ONTOLOGY_FEATURE_NAME, MONEY_ANNOTATION_TYPE, ORGANIZATION_ANNOTATION_TYPE, PERSON_ANNOTATION_TYPE, PERSON_GENDER_FEATURE_NAME, PLUGIN_DIR, SENTENCE_ANNOTATION_TYPE, SPACE_TOKEN_ANNOTATION_TYPE, TOKEN_ANNOTATION_TYPE, TOKEN_CATEGORY_FEATURE_NAME, TOKEN_KIND_FEATURE_NAME, TOKEN_LENGTH_FEATURE_NAME, TOKEN_ORTH_FEATURE_NAME, TOKEN_STRING_FEATURE_NAME
Constructor and Description |
---|
ConfigurableExporter() |
Modifier and Type | Method and Description |
---|---|
void |
execute() |
URL |
getConfigFileURL() |
String |
getInputASName() |
String |
getInstanceName() |
URL |
getOutputURL() |
gate.Resource |
init() |
void |
interrupt() |
void |
setConfigFileURL(URL configFileURL) |
void |
setInputASName(String iasn) |
void |
setInstanceName(String inst) |
void |
setOutputURL(URL output) |
getCorpus, getDocument, setCorpus, setDocument
addProgressListener, addStatusListener, cleanup, fireProcessFinished, fireProgressChanged, fireStatusChanged, getRuntimeParameterValues, getRuntimeParameterValues, isInterrupted, reInit, removeProgressListener, removeStatusListener
checkParameterValues, flushBeanInfoCache, forgetBeanInfo, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
@CreoleParameter(comment="The configuration file specifying output format.", defaultValue="resources/configurableexporter/example.conf", suffixes=".conf") public void setConfigFileURL(URL configFileURL)
public URL getConfigFileURL()
@RunTime @Optional @CreoleParameter(comment="The file to which data will be output. Leave blank for output to messages tab or standard out.") public void setOutputURL(URL output)
public URL getOutputURL()
@RunTime @Optional @CreoleParameter(comment="The name for annotation set used as input to the exporter.") public void setInputASName(String iasn)
public String getInputASName()
@RunTime @Optional @CreoleParameter(comment="The annotation type to be treated as instance. Leave blank to use document as instance.") public void setInstanceName(String inst)
public String getInstanceName()
public gate.Resource init() throws gate.creole.ResourceInstantiationException
init
in interface gate.Resource
init
in class gate.creole.AbstractProcessingResource
gate.creole.ResourceInstantiationException
public void execute() throws gate.creole.ExecutionException
execute
in interface gate.Executable
execute
in class gate.creole.AbstractProcessingResource
gate.creole.ExecutionException
public void interrupt()
interrupt
in interface gate.Executable
interrupt
in class gate.creole.AbstractProcessingResource