Documentation of Genetomorph

*    

back to main page

Installation. 1

Introduction. 1

How to use the Gui Version. 1

Using the tool: 1

How to use the Command Line Version: 7

Command: 8

Options: 10

Examples: 12

How to use Genetomorph in your own program: 17

Classes and Methods. 18

Example. 32

 

Installation

A description how to install a module is available at the main page of the ASV Toolbox project.

The line you have to copy into the toolbox.start file looks like this:

de.uni_leipzig.asv.toolbox.genetoMorph.GenetoMorph

Introduction

Genetomorph uses a genetic algorithm to find morphologic structure, so called morphemes. Morphemes are composed by phonemes and building words by it part. The Genetic algorithm uses the following steps: initialising, evaluation, selection, recombination, mutation and creating of new individuals until a termination condition.

How to use the Gui Version

Using the tool:

The first step is loading data by clicking the Open File button(see figure 1)You find example input files in ./example/genetoMorph .

Open File button to open the File open dialog above.

 

File open dialog to laod data for the tool.

 
Loading data

figure 1

 

Now define the parameters of the algorithm(see figure 2).

 

all individuals

 

Information about the individuals.

 

Start button to start algorithm.

 

Select this to eliminate equal children.

 

parameters:

Sim Cycles: Numbers of the cycles for the simulation.

Mutation Rate: Number between 0 and 1, ratio used for mutation during the evolution process.

Numbers of Children: Defines how many “Children” are created from a parent.

 
parameters of the algorithm

figure 2

 

Start the algorithm repeatedly until you satisfied with the result. You can correct the result manually directly in the table(see figure 3).

 

Double-click a cell of the table to edit the entry. Use | to separate the functional unit from the prefix.

 
edit an entry

figure 3

 

You can let show you the statistics as graph by clicking on Show Statistics(see figure 4).

 

Statistic for the individuals showing the fitness in dependency of the generation. Blue is the average case and red is the best case.

 

Show Statistic button to open a statistic like above.

 
show statistic

figure 4

 

You can save you results to file by clicking the Save File button(see figure 5).

 

Save File button to open the file dialog above.

 

File dialog for saving the individuals.

 
save to file

figure 5

 

How to use the Command Line Version:

Command:

For starting the command line version of this tool use the following command:
java -Xmx500M -classpath .;./lib/ASV_Genetomorph.jar -Djava.ext.dirs=.;./lib de.uni_leipzig.asv.toolbox.genetoMorph.GenetoMorphCL -i inputfile [-o outputfile -nc numberOfChildren -mr mutationrate -sc simulationCycles -ee]

Options:

-i inputfile specify the absolut path to the input file
-o outputfile specify the absolute path to the output file, if not specified output will print to screen(default: print to screen)
-nc NumberOfChildren specify the number of children for one simulation cycle, should be an integer(default: 10)
-mr muatationrate specify the mutation rate for the simulation, should be an integer(default: 1)
-sc simulationCycles specify the number of simulation cycles for this run(default 10)
-ee eliminate equals individuals, (default: not choosen)

Examples:

 

 

How to use Genetomorph in your own program:

Classes and Methods

It is easy to use Genetomorph for your own program. You only need the 3 classes Individual, Data and Simulator which you find in the package de.uni_leipzig.asv.toolbox.genetoMorph.

class.method/class.field

description

Data.loadWordData(String filename)

load all data from the given file

Data.loadConfigFile()

load the configuration file for the data

String[] Data.originalData

String array containing the data from the begining

Simulator.initialize()

initialised the simulator

Simulator.setEliminateEquals(boolean ee)

if ee is true equal individuals where eleminated

Simulator.setChildNum(int num)

set how many children will be created in every simulation cycle

Simulator.setMutationRate(int mr)

set the mutation rate for the simulation

Simulator.startSim()

starts one simulation cycle

Individual Simulator.getMyIndiviuals()

returns the individuals of the simulation

int[] Individual.getGenome()

returns and int array containing the position of the end of the morphemically structure

 

Example

 

Here are an example of a JAVA class(GenetomorphTest.java) using the Genetomorph tool. You can find the class GenetomorphTest.java in the package de.uni_leipzig.asv.toolbox.tests.

package de.uni_leipzig.asv.toolbox.tests;

 

import java.io.File;

 

import de.uni_leipzig.asv.toolbox.genetoMorph.Data;

import de.uni_leipzig.asv.toolbox.genetoMorph.Individual;

import de.uni_leipzig.asv.toolbox.genetoMorph.Simulator;

 

public class GenetomorphTest {

 

      /**

       * @param args

       */

      public static void main(String[] args) {

            //input file

            String inFile = "./examples/genetoMorph/nomen_short.txt";

            Data.loadWordData(new File(inFile));

            Data.loadConfigFile();

            Simulator sim = new Simulator();

            sim.initialize();

            //no equal data

            sim.setEleminateEqual(true);

            //2 children per simulation cycle

            sim.setChildNum(2);

            //mutation rate of 0

            sim.setMutationRate(0);

            //do 3 sim cycles

            for(int i = 0; i < 3; i++){

                  sim.startSim();

            }

            //original Data

            String[] oriData = Data.originalData;

            //got result

            Individual ind = (Individual) sim.getMyIndividuals().get(0);

            int[] simresult = ind.getGenom();

            // output result

            for(int i = 0; i < oriData.length; i++){

                  System.out.print(oriData[i].substring(0, simresult[i])

                                    + "|" +

                                    oriData[i].substring(simresult[i])+" ");

            }

      }

 

}

 

You can start this test. Below you see the output of the test.

Words in data set: 102

Processing config file (./config/genetoMorph/genetoMorph.config)...

Set prefixPenaltyFunc = 3

Set suffixPenaltyFunc = 3

Set k1 = 1.0

Set k2 = 1.0

Set longSuffixPenalty = 1.0

Set containsBase = false

Generate Individuals...

.................................................................................................... done.

Crossover and Mutation... done.

Calc Fitness... .......... done.

Select next Generation... done.

Crossover and Mutation... done.

Calc Fitness... .......... done.

Select next Generation... done.

Crossover and Mutation... done.

Calc Fitness... .......... done.

Select next Generation... done.

Aal| Aale| A|alen Abbild| Abbild|er Abbildu|ng Abbildunge|n A|bend Ab|ende A|benden Abhandlung| Abhandlungen| Abrechnung| Abrechnungen| Absch|ied Abschied|e Abschieds| Absch|nitt Abschnitt|e Abschni|tten Absc|hnitts Dokumentar|film Dokumentarfilm|e Dokumentarfilme|n Dokumentarfilme|r Dokumentar|films A|nteil An|teile Ante|ilen Ante|ils Ti|sch Ti|sche Tischen| Tisc|hes Tischche|n Fleisc|h Fleisch|e Fleisc|hes Weltkri|eg Weltkri|ege Weltkrieg|en Weltkrie|ges Weltkriegs| Afrika| Afrikane|r Afrikanern| Afrikani|sche Afrika|s Brie|f Br|iefe Br|iefen Bri|efes Dein| Dein|e Dein|en Dein|er Dein|es Ereigni|s Ereigni|sse Ereigni|ssen Ereigni|sses Bi|ld Bil|de Bi|ldchen Bild|er B|ildes Bilde|rn Bi|ldnis G|escheh Geschehe|n Geschehen|e Gescheh|enen Geschehe|ns Gesc|hehnis Wi|ld Wildnis| Wilde| Held| Held|en H|eldes Kolle|g Kolle|ge Ko|llegen Ko|llegin Semina|r Semina|re Seminare|n Sem|inars Europame|ister Europameister|in Europameist|ers Erwerb| Erwe|rber Erwerbs| Erwerbun|g Erwerbunge|n Streck|e Str|eckung Streck|en Rec|hner Rechne|rn Rech|ners

 

back to main page