leila.algorithm
Class Pair

java.lang.Object
  extended by leila.algorithm.Pair
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
EvaluatePair

public class Pair
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

This class is part of LEILA. The author Fabian M. Suchanek reserves all rights to the class. You may use this class if (1) it is not for commercial purposes, (2) you give credit to the author and (3) you use the class at your own risk. If you use the class for scientific purposes, please cite our paper "Combining Linguistic and Statistical Analysis to Extract Relations from Web Documents" (pdf, ppt, bib).

Pair.java stores a pair of words.

See Also:
Serialized Form

Field Summary
 java.lang.String comment
          Holds comment
 double confidence
          Holds the confidence that this pair is a valid pair
static NumberFormatter formy
          Holds the formatter
 java.lang.String word1
          Holds the first word
 java.lang.String word2
          Holds the second word
 
Constructor Summary
Pair(LinkageWord w1, LinkageWord w2, double c)
          Creates a new pair from two words and a confidence
Pair(LinkageWord w1, LinkageWord w2, double c, java.lang.String com)
          Creates a new pair from two words, a confidence and a comment
Pair(java.lang.String w1, java.lang.String w2)
          Creates a new pair from two words
Pair(java.lang.String f, java.lang.String s, double c, java.lang.String fi)
          Creates a new pair from two words, a confidence and a comment
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares by confidence
 boolean equals(java.lang.Object o)
          Tells if both words are strequal
 int hashCode()
          Returns the sum of the word hashcodes
static void main(java.lang.String[] args)
          Test routine
static boolean strequal(java.lang.String s1, java.lang.String s2)
          Returns true, if every component of the shorter String appears as a component in the longer one
 java.lang.String toString()
          Returns " [# comment]"
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

word1

public java.lang.String word1
Holds the first word


word2

public java.lang.String word2
Holds the second word


confidence

public double confidence
Holds the confidence that this pair is a valid pair


comment

public java.lang.String comment
Holds comment


formy

public static NumberFormatter formy
Holds the formatter

Constructor Detail

Pair

public Pair(java.lang.String f,
            java.lang.String s,
            double c,
            java.lang.String fi)
Creates a new pair from two words, a confidence and a comment


Pair

public Pair(LinkageWord w1,
            LinkageWord w2,
            double c,
            java.lang.String com)
Creates a new pair from two words, a confidence and a comment


Pair

public Pair(LinkageWord w1,
            LinkageWord w2,
            double c)
Creates a new pair from two words and a confidence


Pair

public Pair(java.lang.String w1,
            java.lang.String w2)
Creates a new pair from two words

Method Detail

strequal

public static boolean strequal(java.lang.String s1,
                               java.lang.String s2)
Returns true, if every component of the shorter String appears as a component in the longer one


compareTo

public int compareTo(java.lang.Object o)
Compares by confidence

Specified by:
compareTo in interface java.lang.Comparable

hashCode

public int hashCode()
Returns the sum of the word hashcodes

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Tells if both words are strequal

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns " [# comment]"

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
Test routine