edu.mit.jmwe.detect
Enum InflectionRule

java.lang.Object
  extended by java.lang.Enum<InflectionRule>
      extended by edu.mit.jmwe.detect.InflectionRule
All Implemented Interfaces:
IInflectionRule, Serializable, Comparable<InflectionRule>

public enum InflectionRule
extends Enum<InflectionRule>
implements IInflectionRule

Enumerates the ways in which MWEs with certain parts of speech are allowed to inflect. All but the last two rules are specified in Arranz, Asterias and Castillo 2005.

Since:
jMWE 1.0.0
Version:
$Id: InflectionRule.java 620 2011-05-08 21:13:58Z markaf $
Author:
N. Kulkarni

Enum Constant Summary
R1
           
R10
           
R11
           
R12
           
R13
           
R14
           
R15
           
R16
           
R17
           
R18
           
R19
           
R2
           
R20
           
R21
           
R3
           
R4
           
R5
           
R6
           
R7
           
R8
           
R9
           
 
Method Summary
<T extends IToken>
String
getTagPattern(IMWE<T> mwe)
          Concatenates the tags of each token in the MWE, separating each by underscores.
static
<T extends IToken>
boolean
inflects(T token, IMWE<T> mwe)
          Returns true if a the text of a token from an MWE does not equal the corresponding part lemma.
static boolean isInflectedByPattern(IMWE<?> mwe)
          Returns true if and only if (1) the given multi-word expressions syntactically matches a rule listed in the enumeration InflectionRule and (2) parts inflect according to that rule
static boolean isInflectedByPattern(IMWE<?> mwe, Collection<? extends IInflectionRule> rules)
          Returns true if the specified MWE inflects according to some rule in the specified collection; false otherwise.
<T extends IToken>
boolean
isValid(IMWE<T> mwe)
          Returns true if this MWE follows the rule; false otherwise.
<T extends IToken>
boolean
matches(IMWE<T> mwe)
          Returns true if the given MWE has the same syntax as this rule.
 String toString()
           
static InflectionRule valueOf(String name)
          Returns the enum constant of this type with the specified name.
static InflectionRule[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

R1

public static final InflectionRule R1

R2

public static final InflectionRule R2

R3

public static final InflectionRule R3

R4

public static final InflectionRule R4

R5

public static final InflectionRule R5

R6

public static final InflectionRule R6

R7

public static final InflectionRule R7

R8

public static final InflectionRule R8

R9

public static final InflectionRule R9

R10

public static final InflectionRule R10

R11

public static final InflectionRule R11

R12

public static final InflectionRule R12

R13

public static final InflectionRule R13

R14

public static final InflectionRule R14

R15

public static final InflectionRule R15

R16

public static final InflectionRule R16

R17

public static final InflectionRule R17

R18

public static final InflectionRule R18

R19

public static final InflectionRule R19

R20

public static final InflectionRule R20

R21

public static final InflectionRule R21
Method Detail

values

public static final InflectionRule[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(InflectionRule c : InflectionRule.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static InflectionRule valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name

isValid

public <T extends IToken> boolean isValid(IMWE<T> mwe)
Description copied from interface: IInflectionRule
Returns true if this MWE follows the rule; false otherwise.

Specified by:
isValid in interface IInflectionRule
Type Parameters:
T - the type of tokens in the MWE
Parameters:
mwe - the MWE to which the rule may/may not be applied
Returns:
true if this MWE follows the rule; false otherwise.

matches

public <T extends IToken> boolean matches(IMWE<T> mwe)
Description copied from interface: IInflectionRule
Returns true if the given MWE has the same syntax as this rule. In other words, returns true if this rule may be applied to the given MWE; false otherwise.

Specified by:
matches in interface IInflectionRule
Type Parameters:
T - the type of tokens in the MWE
Parameters:
mwe - the MWE to which the rule may/may not be applied
Returns:
returns true if this rule may be applied to the given MWE, false otherwise.

getTagPattern

public <T extends IToken> String getTagPattern(IMWE<T> mwe)
Concatenates the tags of each token in the MWE, separating each by underscores. The resulting string can be checked against the rules.

Type Parameters:
T - the type of tokens in the MWE
Parameters:
mwe - the MWE whose tags are being concatenated
Returns:
the tags of each token in the MWE, separated by underscores
Since:
jMWE 1.0.0

toString

public String toString()
Overrides:
toString in class Enum<InflectionRule>

inflects

public static <T extends IToken> boolean inflects(T token,
                                                  IMWE<T> mwe)
Returns true if a the text of a token from an MWE does not equal the corresponding part lemma. In other words, checks if the token is inflected relative to the base lemma of the MWE.

Type Parameters:
T - the type of tokens in the MWE
Parameters:
token - the token being checked
mwe - the MWE from which the token is drawn
Returns:
true if a the text of a token from an MWE does not equal the corresponding part lemma., false otherwise.
Since:
jMWE 1.0.0

isInflectedByPattern

public static boolean isInflectedByPattern(IMWE<?> mwe)
Returns true if and only if (1) the given multi-word expressions syntactically matches a rule listed in the enumeration InflectionRule and (2) parts inflect according to that rule

Parameters:
mwe - the multi-word expression to be tested
Returns:
true if the given multi-word expression inflects according to the rule it matches or if it does not match any rule; false otherwise.
Since:
jMWE 1.0.0

isInflectedByPattern

public static boolean isInflectedByPattern(IMWE<?> mwe,
                                           Collection<? extends IInflectionRule> rules)
Returns true if the specified MWE inflects according to some rule in the specified collection; false otherwise.

Parameters:
mwe - the mwe to check
rules - the set of rules to use; may not be null, but may be empty
Returns:
true if the specified MWE inflects according to some rule in the specified collection; false otherwise.
Since:
jMWE 1.0.0


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