edu.mit.jmwe.detect
Class ProperNouns

java.lang.Object
  extended by edu.mit.jmwe.detect.ProperNouns
All Implemented Interfaces:
IMWEDetector

public class ProperNouns
extends Object
implements IMWEDetector

Detects the proper nouns in an ISentence. For this detector to work, the ITokens in the sentence must be tagged with a part of speech.

Since:
jMWE 1.0.0
Version:
$Id: ProperNouns.java 610 2011-05-06 20:05:20Z markaf $
Author:
N. Kulkarni

Constructor Summary
protected ProperNouns()
          This constructor is marked protected so that this class may be subclassed, but not directly instantiated.
 
Method Summary
<T extends IToken>
List<IMWE<T>>
detect(List<T> sentence)
          Given a list of tokens, the detector searches for the MWEs in the list.
static ProperNouns getInstance()
          Returns the singleton instance of this class, instantiating if necessary.
static
<T extends IToken>
boolean
isProperNoun(T token)
          Checks if the token represents a proper noun by checking its part of speech tag.
protected
<T extends IToken>
boolean
isValidInterstitial(T token, LinkedList<T> tokens)
          Checks if a token that is not a proper noun may still be a part of a proper noun MWE.
protected
<T extends IToken>
void
removeIncorrectInterstitials(LinkedList<T> cs)
          Removes all the tokens from the end of the given list that are not proper nouns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProperNouns

protected ProperNouns()
This constructor is marked protected so that this class may be subclassed, but not directly instantiated.

Since:
jMWE 1.0.0
Method Detail

getInstance

public static ProperNouns getInstance()
Returns the singleton instance of this class, instantiating if necessary.

Returns:
the singleton instance of this class
Since:
jMWE 1.0.0

detect

public <T extends IToken> List<IMWE<T>> detect(List<T> sentence)
Description copied from interface: IMWEDetector
Given a list of tokens, the detector searches for the MWEs in the list. It returns a set of IMWE objects representing these multi-word expressions. The method returns an empty list if no MWEs are found; the method should never return null.

Specified by:
detect in interface IMWEDetector
Type Parameters:
T - the type of the tokens in the sentence
Parameters:
sentence - a sentence which the detector should search for multi-word expressions.
Returns:
a list of IMWE objects representing the multi-word expressions found in the sentence. Returns an empty list if no multi-word expressions are found; never returns null

isValidInterstitial

protected <T extends IToken> boolean isValidInterstitial(T token,
                                                         LinkedList<T> tokens)
Checks if a token that is not a proper noun may still be a part of a proper noun MWE. A valid interstitial is a preposition, number, determiner, 's, or . after a middle initial.

Type Parameters:
T - the type of token
Parameters:
token - is the token to check
tokens - List of IToken objects representing a possible MWE
Returns:
True if the token is a preposition, number, determiner, 's, or . after a middle initial.
Since:
jMWE 1.0.0

removeIncorrectInterstitials

protected <T extends IToken> void removeIncorrectInterstitials(LinkedList<T> cs)
Removes all the tokens from the end of the given list that are not proper nouns. Stops removing tokens as soon as the last element of the list is a proper noun.

Type Parameters:
T - the type of tokens in the list
Parameters:
cs - the list from which tokens will be removed until the last token is a proper noun
Since:
jMWE 1.0.0

isProperNoun

public static <T extends IToken> boolean isProperNoun(T token)
Checks if the token represents a proper noun by checking its part of speech tag.

Type Parameters:
T - the type of token
Parameters:
token - is the token to check
Returns:
true if the token is a proper noun
Since:
jMWE 1.0.0


Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.