//package hu.birot.OTKit.runableExamples;

import hu.birot.OTKit.dataType.Form;
import hu.birot.OTKit.grammarExamples.StringGrammar;
import hu.birot.OTKit.performance.*;


/**
 * <p>This program compares two parameter settings for SA-OT String Grammar.
 * It turns out that K_max = 18.0 yields a significantly (though, qualitatively
 * not) different distribution from the K_max = 18.5 case.</p>
 * 
 * @author <a href="http://www.birot.hu">Tamas Biro</a>
 * 
 */
public class Saot_test_stringgrammar {

	public static void main(String[] args) {
		
		// Define the Grammar:
		StringGrammar G = new StringGrammar(4, 4, "ot");
		G.setPragueHierarchy();
		G.hierarchy.kvalue2rank();
		G.hierarchy.sortByRank();
		
		// Define two different instances of Production:
		Production P1 = ProductionExamples.SAOTnm(18.0, 1, 3, 0, 0.1, 100);
		Production P2 = ProductionExamples.SAOTnm(18.5, 1, 3, 0, 0.1, 100);
		
		// Underlying form:
		int[] arrayuf = {0,0,0,0}; 
		Form uf = G.StrForm(arrayuf);
		
		// Alternatively:
		//uf = G.base.random(new Form(),Math.random());
		
		// Compare the outputs yourself:
		
		System.out.println("underlying form: " + uf);
		System.out.println();
		System.out.println("Production method 1:");
		System.out.println();
		System.out.println(P1.frequency(G, uf, 1000));
		System.out.println();
		System.out.println("Production method 2:");
		System.out.println();
		System.out.println(P2.frequency(G, uf, 1000));
		
	}

}

