edu.illinois.cs.cogcomp.lbj.coref.features
Class Matches

java.lang.Object
  extended by edu.illinois.cs.cogcomp.lbj.coref.features.Matches
Direct Known Subclasses:
Capitals, Nicknames

public class Matches
extends java.lang.Object

Stores pairings of equivalent strings, loaded from a file.


Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> m_aToB
           
protected  java.util.Map<java.lang.String,java.lang.String> m_bToA
           
 
Constructor Summary
Matches()
          Creates an empty matching.
Matches(java.lang.String filename)
          Creates the mapping and loads it from the specified file.
 
Method Summary
 boolean doMatch(java.lang.String s, java.lang.String t)
          Determines whether a pair of strings is a match.
protected  void load(java.lang.String filename)
          Loads the matchings into this from a file.
protected  java.lang.String removeParenthetical(java.lang.String full)
          Removes all parenthetical phrases not containing any nested parentheses.
 java.lang.String toString()
          Converts this mapping to a string in an unspecified format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_aToB

protected java.util.Map<java.lang.String,java.lang.String> m_aToB

m_bToA

protected java.util.Map<java.lang.String,java.lang.String> m_bToA
Constructor Detail

Matches

public Matches()
Creates an empty matching.


Matches

public Matches(java.lang.String filename)
Creates the mapping and loads it from the specified file.

Parameters:
filename - The file specifying the mapping, in the format specified by the load method.
Method Detail

doMatch

public boolean doMatch(java.lang.String s,
                       java.lang.String t)
Determines whether a pair of strings is a match. This method is symmetric: doMatch(s,t) == doMatch(t,s). For now, this method is not case sensitive.

Parameters:
s - One string
t - Another string.
Returns:
Whether the pair of strings is a match.

toString

public java.lang.String toString()
Converts this mapping to a string in an unspecified format. This format is likely to be similar to the file format of the input, except that both orders a to b and b to a may be displayed.

Overrides:
toString in class java.lang.Object
Returns:
A string representing the mapping.

load

protected void load(java.lang.String filename)
Loads the matchings into this from a file. The format of each line of the file is a:b Optionally, b may be a comma-space (", ") separated list, in which case, each element of that list will be associated with a, while a will be associated with b treated as a single string.

Parameters:
filename - The name of the file, which must be relative to the classpath.

removeParenthetical

protected java.lang.String removeParenthetical(java.lang.String full)
Removes all parenthetical phrases not containing any nested parentheses.

Parameters:
full - The full string.
Returns:
The string with parentheticals removed.