LBJ2.nlp
Class POS

java.lang.Object
  extended by LBJ2.nlp.POS
All Implemented Interfaces:
java.io.Serializable

public class POS
extends java.lang.Object
implements java.io.Serializable

This class converts the String names of POS tags into discrete integer values.

See Also:
Serialized Form

Field Summary
static POS CC
          POS object representing the "coordinating conjunction" tag.
static POS CD
          POS object representing the "cardinal number" tag.
static POS closeDoubleQuote
          POS object representing the "close double quote" tag.
static POS colon
          POS object representing the "(semi-)colon" tag.
static POS comma
          POS object representing the "comma" tag.
static POS dollar
          POS object representing the "dollar sign" tag.
static POS DT
          POS object representing the "determiner" tag.
static POS EX
          POS object representing the "existential there" tag.
private static java.util.HashMap fromTokens
          Map from String tokens to POS objects.
static POS FW
          POS object representing the "foreign word" tag.
static POS IN
          POS object representing the "preposition" tag.
static POS JJ
          POS object representing the "adjective" tag.
static POS JJR
          POS object representing the "comparative adjective" tag.
static POS JJS
          POS object representing the "superlative adjective" tag.
static POS leftBracket
          POS object representing the "left bracket" tag.
static POS LS
          POS object representing the "list item marker" tag.
static POS MD
          POS object representing the "modal" tag.
static java.lang.String[] names
          An array of all names of part of speech tags.
static POS NN
          POS object representing the "singular noun" tag.
static POS NNP
          POS object representing the "proper singular noun" tag.
static POS NNPS
          POS object representing the "proper plural noun" tag.
static POS NNS
          POS object representing the "plural noun" tag.
static POS openDoubleQuote
          POS object representing the "open double quote" tag.
static POS PDT
          POS object representing the "predeterminer" tag.
static POS period
          POS object representing the "final punctuation" tag.
static POS POS
          POS object representing the "possesive ending" tag.
static POS pound
          POS object representing the "pound sign" tag.
static POS PRP
          POS object representing the "personal pronoun" tag.
static POS PRP_DOLLAR
          POS object representing the "possessive pronoun" tag.
static POS RB
          POS object representing the "adverb" tag.
static POS RBR
          POS object representing the "comparative adverb" tag.
static POS RBS
          POS object representing the "superlative adverb" tag.
static POS rightBracket
          POS object representing the "right bracket" tag.
static POS RP
          POS object representing the "particle" tag.
static POS SYM
          POS object representing the "symbol" tag.
static POS TO
          POS object representing the "to" tag.
static java.lang.String[] tokens
          An array of all tokens that represent parts of speech as found in corpora.
static POS UH
          POS object representing the "interjection" tag.
private  int value
          The actual part of speech is encoded as an integer.
static POS VB
          POS object representing the "base form verb" tag.
static POS VBD
          POS object representing the "verb past tense" tag.
static POS VBG
          POS object representing the "verb gerund / present participle" tag.
static POS VBN
          POS object representing the "verb past participle" tag.
static POS VBP
          POS object representing the "verb non 3rd ps sing present" tag.
static POS VBZ
          POS object representing the "verb 3rd ps sing present" tag.
static POS WDT
          POS object representing the "wh-determiner" tag.
static POS WP
          POS object representing the "wh-pronoun" tag.
static POS WP_DOLLAR
          POS object representing the "possesive wh-pronoun" tag.
static POS WRB
          POS object representing the "wh-adverb" tag.
 
Constructor Summary
POS(int v)
          Constructor that initializes the value variable.
 
Method Summary
 boolean equals(java.lang.Object o)
          Two POS objects are equal iff their value variables are equal.
static POS fromToken(java.lang.String s)
          Converts a token to the POS object that represents the same part of speech.
 int getValue()
          Returns the integer used to represent this part of speech tag.
 int hashCode()
          Simply returns the value variable.
 java.lang.String toString()
          Returns the name of the part of speech represented by this object.
 java.lang.String toToken()
          Returns the token that represents the same part of speech.
static java.lang.String toToken(POS tag)
          Converts a POS object to the token that represents the same part of speech.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

private int value
The actual part of speech is encoded as an integer.


names

public static final java.lang.String[] names
An array of all names of part of speech tags.

Those names are:
  1. pound sign
  2. dollar sign
  3. open double quote
  4. close double quote
  5. comma
  6. left bracket
  7. right bracket
  8. final punctuation
  9. (semi-)colon
  10. coordinating conjunction
  11. cardinal number
  12. determiner
  13. existential there
  14. foreign word
  15. preposition
  16. adjective
  17. comparative adjective
  18. superlative adjective
  19. list item marker
  20. modal
  21. singular noun
  22. proper singular noun
  23. proper plural noun
  24. plural noun
  25. predeterminer
  26. possesive ending
  27. possesive pronoun
  28. personal pronoun
  29. adverb
  30. comparative adverb
  31. superlative adverb
  32. particle
  33. symbol
  34. to
  35. interjection
  36. base form verb
  37. verb past tense
  38. verb gerund / present participle
  39. verb past participle
  40. verb non 3rd ps. sing. present
  41. verb 3rd ps. sing. present
  42. wh-determiner
  43. wh-pronoun
  44. possesive wh-pronoun
  45. wh-adverb


tokens

public static final java.lang.String[] tokens
An array of all tokens that represent parts of speech as found in corpora.

Those tokens are:
  1. "#"
  2. "$"
  3. "``"
  4. "''"
  5. ","
  6. "-LRB-"
  7. "-RRB-"
  8. "."
  9. ":"
  10. "CC"
  11. "CD"
  12. "DT"
  13. "EX"
  14. "FW"
  15. "IN"
  16. "JJ"
  17. "JJR"
  18. "JJS"
  19. "LS"
  20. "MD"
  21. "NN"
  22. "NNP"
  23. "NNPS"
  24. "NNS"
  25. "PDT"
  26. "POS"
  27. "PRP"
  28. "PRP$"
  29. "RB"
  30. "RBR"
  31. "RBS"
  32. "RP"
  33. "SYM"
  34. "TO"
  35. "UH"
  36. "VB"
  37. "VBD"
  38. "VBG"
  39. "VBN"
  40. "VBP"
  41. "VBZ"
  42. "WDT"
  43. "WP"
  44. "WP$"
  45. "WRB"


fromTokens

private static java.util.HashMap fromTokens
Map from String tokens to POS objects.


pound

public static final POS pound
POS object representing the "pound sign" tag.


dollar

public static final POS dollar
POS object representing the "dollar sign" tag.


openDoubleQuote

public static final POS openDoubleQuote
POS object representing the "open double quote" tag.


closeDoubleQuote

public static final POS closeDoubleQuote
POS object representing the "close double quote" tag.


comma

public static final POS comma
POS object representing the "comma" tag.


leftBracket

public static final POS leftBracket
POS object representing the "left bracket" tag.


rightBracket

public static final POS rightBracket
POS object representing the "right bracket" tag.


period

public static final POS period
POS object representing the "final punctuation" tag.


colon

public static final POS colon
POS object representing the "(semi-)colon" tag.


CC

public static final POS CC
POS object representing the "coordinating conjunction" tag.


CD

public static final POS CD
POS object representing the "cardinal number" tag.


DT

public static final POS DT
POS object representing the "determiner" tag.


EX

public static final POS EX
POS object representing the "existential there" tag.


FW

public static final POS FW
POS object representing the "foreign word" tag.


IN

public static final POS IN
POS object representing the "preposition" tag.


JJ

public static final POS JJ
POS object representing the "adjective" tag.


JJR

public static final POS JJR
POS object representing the "comparative adjective" tag.


JJS

public static final POS JJS
POS object representing the "superlative adjective" tag.


LS

public static final POS LS
POS object representing the "list item marker" tag.


MD

public static final POS MD
POS object representing the "modal" tag.


NN

public static final POS NN
POS object representing the "singular noun" tag.


NNP

public static final POS NNP
POS object representing the "proper singular noun" tag.


NNPS

public static final POS NNPS
POS object representing the "proper plural noun" tag.


NNS

public static final POS NNS
POS object representing the "plural noun" tag.


PDT

public static final POS PDT
POS object representing the "predeterminer" tag.


POS

public static final POS POS
POS object representing the "possesive ending" tag.


PRP

public static final POS PRP
POS object representing the "personal pronoun" tag.


PRP_DOLLAR

public static final POS PRP_DOLLAR
POS object representing the "possessive pronoun" tag.


RB

public static final POS RB
POS object representing the "adverb" tag.


RBR

public static final POS RBR
POS object representing the "comparative adverb" tag.


RBS

public static final POS RBS
POS object representing the "superlative adverb" tag.


RP

public static final POS RP
POS object representing the "particle" tag.


SYM

public static final POS SYM
POS object representing the "symbol" tag.


TO

public static final POS TO
POS object representing the "to" tag.


UH

public static final POS UH
POS object representing the "interjection" tag.


VB

public static final POS VB
POS object representing the "base form verb" tag.


VBD

public static final POS VBD
POS object representing the "verb past tense" tag.


VBG

public static final POS VBG
POS object representing the "verb gerund / present participle" tag.


VBN

public static final POS VBN
POS object representing the "verb past participle" tag.


VBP

public static final POS VBP
POS object representing the "verb non 3rd ps sing present" tag.


VBZ

public static final POS VBZ
POS object representing the "verb 3rd ps sing present" tag.


WDT

public static final POS WDT
POS object representing the "wh-determiner" tag.


WP

public static final POS WP
POS object representing the "wh-pronoun" tag.


WP_DOLLAR

public static final POS WP_DOLLAR
POS object representing the "possesive wh-pronoun" tag.


WRB

public static final POS WRB
POS object representing the "wh-adverb" tag.

Constructor Detail

POS

public POS(int v)
Constructor that initializes the value variable. This constructor should never be called, since all possible parts of speech are numerated by name as public static final variables.

Parameters:
v - The value of the new part of speech object.
Method Detail

toString

public java.lang.String toString()
Returns the name of the part of speech represented by this object.

Overrides:
toString in class java.lang.Object

toToken

public java.lang.String toToken()
Returns the token that represents the same part of speech.


getValue

public int getValue()
Returns the integer used to represent this part of speech tag.


equals

public boolean equals(java.lang.Object o)
Two POS objects are equal iff their value variables are equal.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object to compare against this POS object.
Returns:
true iff the input object is a POS object with the same value.

hashCode

public int hashCode()
Simply returns the value variable.

Overrides:
hashCode in class java.lang.Object

toToken

public static java.lang.String toToken(POS tag)
Converts a POS object to the token that represents the same part of speech.

Parameters:
tag - The POS object to convert.
Returns:
The token representing the same part of speech.

fromToken

public static POS fromToken(java.lang.String s)
Converts a token to the POS object that represents the same part of speech.

Parameters:
s - The token to convert.
Returns:
The POS object representing the same part of speech.