com.twitter.common.text.extractor
Class EmoticonExtractor

java.lang.Object
  extended by org.apache.lucene.util.AttributeSource
      extended by com.twitter.common.text.token.TokenStream
          extended by com.twitter.common.text.extractor.RegexExtractor
              extended by com.twitter.common.text.extractor.EmoticonExtractor

public class EmoticonExtractor
extends RegexExtractor

Extracts emoticons (e.g., :), :-( ) from a text.


Nested Class Summary
static class EmoticonExtractor.Polarity
          The term of art for referring to {positive, negative} sentiment is polarity.
 
Nested classes/interfaces inherited from class com.twitter.common.text.extractor.RegexExtractor
RegexExtractor.AbstractBuilder<N extends RegexExtractor,T extends RegexExtractor.AbstractBuilder<N,T>>, RegexExtractor.Builder
 
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource
org.apache.lucene.util.AttributeSource.AttributeFactory, org.apache.lucene.util.AttributeSource.State
 
Field Summary
static Pattern EMOTICON_REGEX_PATTERN
           
static Pattern FROWNY_REGEX_PATTERN
           
static Pattern SMILEY_REGEX_PATTERN
           
 
Constructor Summary
EmoticonExtractor()
          Default constructor.
 
Method Summary
static EmoticonExtractor.Polarity getPolarityOf(CharSequence emoticon)
          Returns the polarity (happy, sad...) of a given emoticon.
 
Methods inherited from class com.twitter.common.text.extractor.RegexExtractor
incrementToken, reset, setRegexPattern, setRegexPattern, setTriggeringChar
 
Methods inherited from class com.twitter.common.text.token.TokenStream
getInstanceOf, toStringList
 
Methods inherited from class org.apache.lucene.util.AttributeSource
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, restoreState, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SMILEY_REGEX_PATTERN

public static final Pattern SMILEY_REGEX_PATTERN

FROWNY_REGEX_PATTERN

public static final Pattern FROWNY_REGEX_PATTERN

EMOTICON_REGEX_PATTERN

public static final Pattern EMOTICON_REGEX_PATTERN
Constructor Detail

EmoticonExtractor

public EmoticonExtractor()
Default constructor.

Method Detail

getPolarityOf

public static final EmoticonExtractor.Polarity getPolarityOf(CharSequence emoticon)
Returns the polarity (happy, sad...) of a given emoticon.

Parameters:
emoticon - emoticon text
Returns:
polarity of the emoticon