javatools.parsers
Class NounGroup

java.lang.Object
  extended by javatools.parsers.NounGroup

public class NounGroup
extends java.lang.Object

This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). The class NounGroup splits a noun group (given by a String) into its modifiers and its head.
Example:

     System.out.println(new NounGroup("the United States of America").description());
     ->
      NounGroup:
        Original: the_United_States_of_America
        Determiner: the
        Head: State
        Plural: true
        preModifiers: United
        Adjective: 
        Preposition: of
        postModifier:
          NounGroup:
            Original: America
            Determiner:
            Head: America
            Plural: false
            preModifiers:
            Preposition:
            postModifier:


Nested Class Summary
static interface NounGroup.String2Boolean
          Defines just one function from a String to a boolean
 
Field Summary
static java.util.Set<java.lang.String> determiners
          Contains determiners
static NounGroup.String2Boolean isAdjective
          Tells whether a word is an adjective (currently by a simple heuristics
static FinalSet<java.lang.String> prepositions
          Holds prepositions (like "of" etc.)
 
Constructor Summary
NounGroup(java.util.List<java.lang.String> words)
          Constructs a noun group from a list of words
NounGroup(java.lang.String s)
          Constructs a noun group from a String
 
Method Summary
 java.lang.String adjective()
          Returns the adjective.
 java.lang.String description()
          Returns all fields in a String
 java.lang.String determiner()
          Returns the determiner.
 boolean equals(java.lang.Object o)
          Checks if the originals match
 java.lang.String head()
          Returns the head (lowercased singular).
static void main(java.lang.String[] args)
          Test method
 java.lang.String original()
          Returns the original.
 NounGroup postModifier()
          Returns the postModifier.
 java.lang.String preModifier()
          Returns the preModifier.
 java.lang.String preposition()
          Returns the preposition.
 boolean stemHead()
          Stems the head.
 java.lang.String stemmed()
          Returns the full name with the head word stemmed
 java.lang.String toString()
          Returns the original
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isAdjective

public static NounGroup.String2Boolean isAdjective
Tells whether a word is an adjective (currently by a simple heuristics


determiners

public static final java.util.Set<java.lang.String> determiners
Contains determiners


prepositions

public static final FinalSet<java.lang.String> prepositions
Holds prepositions (like "of" etc.)

Constructor Detail

NounGroup

public NounGroup(java.lang.String s)
Constructs a noun group from a String


NounGroup

public NounGroup(java.util.List<java.lang.String> words)
Constructs a noun group from a list of words

Method Detail

adjective

public java.lang.String adjective()
Returns the adjective.


determiner

public java.lang.String determiner()
Returns the determiner.


head

public java.lang.String head()
Returns the head (lowercased singular).


original

public java.lang.String original()
Returns the original.


postModifier

public NounGroup postModifier()
Returns the postModifier.


preModifier

public java.lang.String preModifier()
Returns the preModifier.


preposition

public java.lang.String preposition()
Returns the preposition.


stemmed

public java.lang.String stemmed()
Returns the full name with the head word stemmed


stemHead

public boolean stemHead()
Stems the head. TRUE if this had any effect


equals

public boolean equals(java.lang.Object o)
Checks if the originals match

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns the original

Overrides:
toString in class java.lang.Object

description

public java.lang.String description()
Returns all fields in a String


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test method

Throws:
java.lang.Exception