opennlp.maxent
Class DomainToModelMap

java.lang.Object
  extended by opennlp.maxent.DomainToModelMap

public class DomainToModelMap
extends java.lang.Object

A class which stores a mapping from ModelDomain objects to MaxentModels. This permits an application to replace an old model for a domain with a newly trained one in a thread-safe manner. By calling the getModel() method, the application can create new instances of classes which use the relevant models.

Version:
$Revision: 1.1.1.1 $, $Date: 2001/10/23 14:06:53 $
Author:
Jason Baldridge and Eric Friedman

Constructor Summary
DomainToModelMap()
           
 
Method Summary
 MaxentModel getModel(ModelDomain domain)
          Get the model mapped to by the given ModelDomain key.
 java.util.Set keySet()
          A set view of the ModelDomain keys contained in this map.
 void removeDomain(ModelDomain domain)
          Removes the mapping for this ModelDomain key from this map if present.
 void setModelForDomain(ModelDomain domain, MaxentModel model)
          Sets the model for the given domain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainToModelMap

public DomainToModelMap()
Method Detail

setModelForDomain

public void setModelForDomain(ModelDomain domain,
                              MaxentModel model)
Sets the model for the given domain.

Parameters:
domain - The ModelDomain object which keys to the model.
model - The MaxentModel trained for the domain.

getModel

public MaxentModel getModel(ModelDomain domain)
Get the model mapped to by the given ModelDomain key.

Parameters:
domain - The ModelDomain object which keys to the desired model.
Returns:
The MaxentModel corresponding to the given domain.

removeDomain

public void removeDomain(ModelDomain domain)
Removes the mapping for this ModelDomain key from this map if present.

Parameters:
domain - The ModelDomain key whose mapping is to be removed from the map.

keySet

public java.util.Set keySet()
A set view of the ModelDomain keys contained in this map.

Returns:
a set view of the ModelDomain keys contained in this map


Copyright © 2005 Jason Baldridge, Gann Bierner, and Thomas Morton. All Rights Reserved.