leila.relations
Class SimpleFunction

java.lang.Object
  extended by leila.relations.Relation
      extended by leila.relations.SimpleFunction

public class SimpleFunction
extends Relation

This class is part of LEILA (http://mpii.de/yago-naga/leila). It is licensed under the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0) by the author Fabian M. Suchanek (http://suchanek.name).

SimpleFunction.java is a functional relation (i.e. a many-to-one relation), which reads its examples from a given file. It requires the following parameter in leila.ini:

By default, the file RelationData/SimpleFunction/examples.txt is read. The example pairs should be of the format
   first second
   ...
Since the relation is functional, any pair with a first component listed in the examples and a "wrong" second component is a counterexample. For example, suppose you store persons with their birth dates in the file. If Chopin is born in 1810, then Chopin/1811, Chopin/1812, ... are implicitly counterexamples.


Nested Class Summary
 
Nested classes/interfaces inherited from class leila.relations.Relation
Relation.WordPairType
 
Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> examples
          Holds the examples
 java.util.regex.Pattern pattern
          Pattern in the example file
 
Constructor Summary
SimpleFunction()
          Reads the examples from the file given by SimpleRelationExamples
 
Method Summary
 Relation.WordPairType assess(LinkageWord w1, LinkageWord w2)
          Tells whether a pair of words is an example, a counterexample or a candidate
 boolean possibleExample(LinkageWord w)
          Tells whether the word appears in the examples
 boolean requiresCounterexamples()
          Returns true
 
Methods inherited from class leila.relations.Relation
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

examples

protected java.util.Map<java.lang.String,java.lang.String> examples
Holds the examples


pattern

public java.util.regex.Pattern pattern
Pattern in the example file

Constructor Detail

SimpleFunction

public SimpleFunction()
               throws java.lang.Exception
Reads the examples from the file given by SimpleRelationExamples

Throws:
java.lang.Exception
Method Detail

requiresCounterexamples

public boolean requiresCounterexamples()
Returns true

Overrides:
requiresCounterexamples in class Relation

assess

public Relation.WordPairType assess(LinkageWord w1,
                                    LinkageWord w2)
Tells whether a pair of words is an example, a counterexample or a candidate

Overrides:
assess in class Relation

possibleExample

public boolean possibleExample(LinkageWord w)
Tells whether the word appears in the examples

Overrides:
possibleExample in class Relation