Class TwitterNLPPos
- java.lang.Object
-
- weka.filters.Filter
-
- weka.filters.SimpleFilter
-
- weka.filters.SimpleBatchFilter
-
- weka.filters.unsupervised.attribute.AbstractTweetContentFilter
-
- weka.filters.unsupervised.attribute.TwitterNLPPos
-
- All Implemented Interfaces:
Serializable
,weka.core.CapabilitiesHandler
,weka.core.CapabilitiesIgnorer
,weka.core.CommandlineRunnable
,weka.core.OptionHandler
,weka.core.RevisionHandler
public class TwitterNLPPos extends AbstractTweetContentFilter
Adds attributes based on POS tags generate by TweetNLP POS tagger. Original code taken from here- Version:
- $Revision$
- Author:
- Felipe Bravo, FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected File
m_Model
the model to use.protected cmu.arktweetnlp.Tagger
m_Tagger
the tagger.protected List<String>
m_Vocabulary
the vocabulary.static String
MODEL
static String
POS_PREFIX
-
Fields inherited from class weka.filters.unsupervised.attribute.AbstractTweetContentFilter
ATT_NAME, m_AttributeName
-
-
Constructor Summary
Constructors Constructor Description TwitterNLPPos()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allowAccessToFullInputFormat()
Returns whether to allow the determineOutputFormat(Instances) method access to the full dataset rather than just the header.protected weka.core.Instances
determineOutputFormat(weka.core.Instances inputFormat)
Determines the output format based on the input format and returns this.weka.core.Capabilities
getCapabilities()
Returns the Capabilities of this filter.protected File
getDefaultModel()
Returns the default model file.File
getModel()
Returns the model file to load and use.String[]
getOptions()
Gets the current option settings for the OptionHandler.String
getRevision()
Returns the revision string.String
globalInfo()
Returns a string describing this filter.Enumeration
listOptions()
Returns an enumeration describing the available options.static void
main(String[] args)
Main method for testing this class.String
modelTipText()
Returns the tip text for this property.protected weka.core.Instances
process(weka.core.Instances instances)
Processes the given data (may change the provided dataset) and returns the modified version.protected void
reset()
Resets the scheme.void
setModel(File value)
Sets the model file to load and use.void
setOptions(String[] options)
Sets the OptionHandler's options using the given list.-
Methods inherited from class weka.filters.unsupervised.attribute.AbstractTweetContentFilter
attributeNameTipText, checkInputFormat, getAttributeName, getDefaultAttributeName, setAttributeName
-
Methods inherited from class weka.filters.SimpleBatchFilter
batchFinished, hasImmediateOutputFormat, input, input
-
Methods inherited from class weka.filters.Filter
batchFilterFile, bufferInput, copyValues, copyValues, debugTipText, doNotCheckCapabilitiesTipText, filterFile, flushInput, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapper
-
-
-
-
Field Detail
-
MODEL
public static final String MODEL
- See Also:
- Constant Field Values
-
POS_PREFIX
public static final String POS_PREFIX
- See Also:
- Constant Field Values
-
m_Model
protected File m_Model
the model to use.
-
m_Tagger
protected transient cmu.arktweetnlp.Tagger m_Tagger
the tagger.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this filter.- Specified by:
globalInfo
in classweka.filters.SimpleFilter
- Returns:
- a description of the filter suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceweka.core.OptionHandler
- Overrides:
listOptions
in classAbstractTweetContentFilter
- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Sets the OptionHandler's options using the given list. All options will be set (or reset) during this call (i.e. incremental setting of options is not possible).- Specified by:
setOptions
in interfaceweka.core.OptionHandler
- Overrides:
setOptions
in classAbstractTweetContentFilter
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
getOptions
public String[] getOptions()
Gets the current option settings for the OptionHandler.- Specified by:
getOptions
in interfaceweka.core.OptionHandler
- Overrides:
getOptions
in classAbstractTweetContentFilter
- Returns:
- the list of current option settings as an array of strings
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classweka.filters.SimpleFilter
-
getDefaultModel
protected File getDefaultModel()
Returns the default model file.- Returns:
- the default
-
setModel
public void setModel(File value)
Sets the model file to load and use.- Parameters:
value
- the model
-
getModel
public File getModel()
Returns the model file to load and use.- Returns:
- the model
-
modelTipText
public String modelTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
allowAccessToFullInputFormat
public boolean allowAccessToFullInputFormat()
Returns whether to allow the determineOutputFormat(Instances) method access to the full dataset rather than just the header.- Overrides:
allowAccessToFullInputFormat
in classAbstractTweetContentFilter
- Returns:
- whether determineOutputFormat has access to the full input dataset
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns the Capabilities of this filter. Derived filters have to override this method to enable capabilities.- Specified by:
getCapabilities
in interfaceweka.core.CapabilitiesHandler
- Overrides:
getCapabilities
in classAbstractTweetContentFilter
- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
determineOutputFormat
protected weka.core.Instances determineOutputFormat(weka.core.Instances inputFormat) throws Exception
Determines the output format based on the input format and returns this. In case the output format cannot be returned immediately, i.e., immediateOutputFormat() returns false, then this method will be called from batchFinished().- Specified by:
determineOutputFormat
in classweka.filters.SimpleFilter
- Parameters:
inputFormat
- the input format to base the output format on- Returns:
- the output format
- Throws:
Exception
- in case the determination goes wrong
-
process
protected weka.core.Instances process(weka.core.Instances instances) throws Exception
Processes the given data (may change the provided dataset) and returns the modified version. This method is called in batchFinished().- Specified by:
process
in classweka.filters.SimpleFilter
- Parameters:
instances
- the data to process- Returns:
- the modified data
- Throws:
Exception
- in case the processing goes wrong
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceweka.core.RevisionHandler
- Overrides:
getRevision
in classweka.filters.Filter
- Returns:
- the revision
-
main
public static void main(String[] args)
Main method for testing this class.- Parameters:
args
- should contain arguments to the filter: use -h for help
-
-