opennlp.tools.coref.sim
Class SimilarityModel

java.lang.Object
  extended by opennlp.tools.coref.sim.SimilarityModel
All Implemented Interfaces:
TestSimilarityModel, TrainSimilarityModel

public class SimilarityModel
extends Object
implements TestSimilarityModel, TrainSimilarityModel

Models semantic similarity between two mentions and returns a score based on how semantically comparable the mentions are with one another.


Method Summary
 double compatible(Context mention1, Context mention2)
          Returns a number between 0 and 1 which represents the models belief that the specified mentions are compatible.
static void main(String[] args)
           
 void setExtents(Context[] extentContexts)
          Creates simialrity training pairs based on the specified extents.
static TestSimilarityModel testModel(String name)
           
 void trainModel()
          Train a model based on the previously supplied evidence.
static TrainSimilarityModel trainModel(String name)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

testModel

public static TestSimilarityModel testModel(String name)
                                     throws IOException
Throws:
IOException

trainModel

public static TrainSimilarityModel trainModel(String name)
                                       throws IOException
Throws:
IOException

setExtents

public void setExtents(Context[] extentContexts)
Description copied from interface: TrainSimilarityModel
Creates simialrity training pairs based on the specified extents. Extents are considered compatible is they are in the same coreference chain, have the same named-entity tag, or share a common head word. Incompatible extents are chosen at random from the set of extents which don't meet this criteria.

Specified by:
setExtents in interface TrainSimilarityModel

compatible

public double compatible(Context mention1,
                         Context mention2)
Returns a number between 0 and 1 which represents the models belief that the specified mentions are compatible. Value closer to 1 are more compatible, while values closer to 0 are less compatible.

Specified by:
compatible in interface TestSimilarityModel
Parameters:
mention1 - The first mention to be considered.
mention2 - The second mention to be considered.
Returns:
a number between 0 and 1 which represents the models belief that the specified mentions are compatible.

trainModel

public void trainModel()
                throws IOException
Train a model based on the previously supplied evidence.

Specified by:
trainModel in interface TrainSimilarityModel
Throws:
IOException
See Also:
setExtents(Context[])

main

public static void main(String[] args)
                 throws IOException
Throws:
IOException


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.