hu.birot.OTKit.performance
Class Production

java.lang.Object
  extended by hu.birot.OTKit.performance.Production

public abstract class Production
extends java.lang.Object

This abstract class realizes the language production capacity of an agent. It has a single method, Production.produce(Grammar G, Form f), which maps any input form f to some output form, given the grammar G.

Usually, the input is either the null Form, from which G.base first generates some random message (and underlying form); or directly an underlying form. The output, in turn, is usually a surface form or an over form (after having applied G.utter to the surface form).

The mapping can be deterministic or stochastic, and using any type of grammars (OT, HG or something else). Concrete implementations are offered by the class ProductionExamples.


Constructor Summary
Production()
           
 
Method Summary
 java.util.HashMap<Form,java.lang.Integer> distribution(Grammar G, Form f, int repetition)
          The Production method produces sample of size repetition.
 java.lang.String frequency(Grammar G, Form f, int repetition)
          A string containing the frequencies of a sample of size repetition.
static double JSD(java.util.HashMap<Form,java.lang.Integer> D1, java.util.HashMap<Form,java.lang.Integer> D2)
          This static method returns the Jensen-Shannon divergence of two distributions.
abstract  Form produce(Grammar G, Form f)
          This method maps the input Form f to some output Form, based on the grammar G.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Production

public Production()
Method Detail

produce

public abstract Form produce(Grammar G,
                             Form f)

This method maps the input Form f to some output Form, based on the grammar G. The mapping can be deterministic or stochastic.

Parameters:
G - Grammar to be used in the process of mapping.
f - Input form.
Returns:
Some output Form corresponding to f.

frequency

public java.lang.String frequency(Grammar G,
                                  Form f,
                                  int repetition)

A string containing the frequencies of a sample of size repetition. The Production method produces a surface form repetition times from underlying form f, employing grammar G. The frequencies obtained by this sampling process are reported in the form of a string. Each row has the form "form.toString : frequency".

Parameters:
G - Grammar being used to produce a sample.
f - Underlying form from which surface forms are generated.
repetition - Sample size.
Returns:
A string containing the frequency information, as described above.

distribution

public java.util.HashMap<Form,java.lang.Integer> distribution(Grammar G,
                                                              Form f,
                                                              int repetition)

The Production method produces sample of size repetition. The sample reflect Grammar G and underlying form f.

Parameters:
G - Grammar that is implemented by the Production method.
f - Underlying form from which surface forms are being produced.
repetition - Sample size.
Returns:
A hash map describing which surface form has been produced how often.

JSD

public static double JSD(java.util.HashMap<Form,java.lang.Integer> D1,
                         java.util.HashMap<Form,java.lang.Integer> D2)
This static method returns the Jensen-Shannon divergence of two distributions. Each distribution is given as a HashMap mapping from Forms to Integers. http://en.wikipedia.org/wiki/Jensen-Shannon_divergence Log: base-2. NB: 0 * log (0/x) = 0. Always finite and symmetric. 0 <= JSD <= 1. Additionally, JSD == 0 iff two distributions equal. Miert max 1???