Class TwitterEmoticonScore

  • All Implemented Interfaces:
    Serializable, weka.core.CapabilitiesHandler, weka.core.CapabilitiesIgnorer, weka.core.CommandlineRunnable, weka.core.OptionHandler, weka.core.RevisionHandler

    public class TwitterEmoticonScore
    extends AbstractTweetContentFilter
    Computes the happiness score of tweets using the supplied emoticon lexicon model. It adds numeric attribute for the overall score, cumulative scores for happy and sad, count of neutral ones, and a nominal attribute (happy, neutral, sad). The emoticon lexicon is required to have two columns: emoticon string and associated score. The lexicon file itself is tab-separated and has no header.
    Version:
    $Revision$
    Author:
    Felipe Bravo, FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • TwitterEmoticonScore

        public TwitterEmoticonScore()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing this filter.
        Specified by:
        globalInfo in class weka.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 interface weka.core.OptionHandler
        Overrides:
        listOptions in class AbstractTweetContentFilter
        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 interface weka.core.OptionHandler
        Overrides:
        setOptions in class AbstractTweetContentFilter
        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 interface weka.core.OptionHandler
        Overrides:
        getOptions in class AbstractTweetContentFilter
        Returns:
        the list of current option settings as an array of strings
      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class weka.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 class AbstractTweetContentFilter
        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 interface weka.core.CapabilitiesHandler
        Overrides:
        getCapabilities in class AbstractTweetContentFilter
        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 class weka.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 class weka.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 interface weka.core.RevisionHandler
        Overrides:
        getRevision in class weka.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