-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bd5c86a
Showing
28 changed files
with
18,913 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>de.tuebingen.sfs</groupId> | ||
<artifactId>morphgen</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.7.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.3.1</version> | ||
<executions> | ||
<execution> | ||
<id>default-jar</id> | ||
<phase>none</phase> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>2.4</version> | ||
<executions> | ||
<execution> | ||
<id>morphgen</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
<configuration> | ||
<descriptors> | ||
<descriptor>src/assembly/morphgen-assembly.xml</descriptor> | ||
</descriptors> | ||
<appendAssemblyId>false</appendAssemblyId> | ||
<archive> | ||
<manifest> | ||
<mainClass>de.tuebingen.sfs.morphgen.MorphGen</mainClass> | ||
</manifest> | ||
</archive> | ||
<finalName>morphgen</finalName> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
|
||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-library</artifactId> | ||
<version>1.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- https://mvnrepository.com/artifact/net.sf.trove4j/trove4j --> | ||
<dependency> | ||
<groupId>net.sf.trove4j</groupId> | ||
<artifactId>trove4j</artifactId> | ||
<version>3.0.3</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<assembly | ||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> | ||
<id>morphgen-assembly</id> | ||
<formats> | ||
<format>jar</format> | ||
</formats> | ||
<includeBaseDirectory>false</includeBaseDirectory> | ||
<dependencySets> | ||
<dependencySet> | ||
<outputDirectory>/</outputDirectory> | ||
<useProjectArtifact>false</useProjectArtifact> | ||
<unpack>true</unpack> | ||
<scope>runtime</scope> | ||
<includes> | ||
<include>net.sf.trove4j:trove4j</include> | ||
</includes> | ||
</dependencySet> | ||
</dependencySets> | ||
<fileSets> | ||
<fileSet> | ||
<outputDirectory>/</outputDirectory> | ||
<directory>${project.build.outputDirectory}</directory> | ||
<excludes> | ||
<exclude>de/tuebingen/sfs/xy.*</exclude> | ||
<exclude>de/tuebingen/sfs/morphgen/MorphAutomaton.*</exclude> | ||
<exclude>de/tuebingen/sfs/morphgen/ParadigmAutomaton.*</exclude> | ||
<exclude>de/tuebingen/sfs/morphgen/ReverseTrie.*</exclude> | ||
</excludes> | ||
</fileSet> | ||
<fileSet> | ||
<outputDirectory>/</outputDirectory> | ||
<directory>${project.build.sourceDirectory}</directory> | ||
<excludes> | ||
<exclude>de/tuebingen/sfs/xy.*</exclude> | ||
<exclude>de/tuebingen/sfs/morphgen/MorphAutomaton.*</exclude> | ||
<exclude>de/tuebingen/sfs/morphgen/ParadigmAutomaton.*</exclude> | ||
<exclude>de/tuebingen/sfs/morphgen/ReverseTrie.*</exclude> | ||
</excludes> | ||
</fileSet> | ||
</fileSets> | ||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package de.tuebingen.sfs.morphgen; | ||
|
||
/** | ||
* An inflected word with a gloss. | ||
*/ | ||
public class GlossedWord { | ||
|
||
private String gloss; | ||
private String form; | ||
|
||
public GlossedWord(String gloss, String form) { | ||
this.gloss = gloss; | ||
this.form = form; | ||
} | ||
|
||
/** | ||
* Get the gloss of the word. | ||
* (e.g. "word|PL") | ||
* @return The word's gloss | ||
*/ | ||
public String getGloss() { | ||
return gloss; | ||
} | ||
|
||
/** | ||
* Get the inflected form of the word. | ||
* (e.g. "words") | ||
* @return The word's form | ||
*/ | ||
public String getForm() { | ||
return form; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return gloss + "\t" + form; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (other instanceof GlossedWord) { | ||
GlossedWord otherGl = (GlossedWord) other; | ||
return this.form.equals(otherGl.form) && this.gloss.equals(otherGl.gloss); | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return 13 + 7 * form.hashCode() + 11 * gloss.hashCode(); | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
src/main/java/de/tuebingen/sfs/morphgen/MorphAutomaton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
//package morphgen; | ||
// | ||
//import java.util.List; | ||
// | ||
//public class MorphAutomaton { | ||
// | ||
// | ||
// private class MorphState { | ||
// | ||
// private List<MorphTransition> transitions; | ||
// | ||
// public Word get(String s, int i) { | ||
// if (!transitions.isEmpty()) { | ||
// for (MorphTransition transition : transitions) { | ||
// Word w = transition.get(s, i); | ||
// if (w != null) | ||
// return w; | ||
// } | ||
// } | ||
// return new Word("", ""); | ||
// } | ||
// | ||
// } | ||
// | ||
// private class Word { | ||
// private StringBuilder split; | ||
// private StringBuilder gloss; | ||
// | ||
// public Word(String split, String gloss) { | ||
// this.split = new StringBuilder(split); | ||
// this.gloss = new StringBuilder(gloss); | ||
// } | ||
// | ||
// public void prepend(String split, String gloss) { | ||
// this.split.insert(0, split); | ||
// this.gloss.insert(0, gloss); | ||
// } | ||
// } | ||
// | ||
// private interface MorphTransition { | ||
// | ||
// } | ||
// | ||
// private class RootPlaceholder implements MorphTransition { | ||
// | ||
// private String pos; | ||
// | ||
// public RootTransition fill(String word, String pos) { | ||
// return null; | ||
// } | ||
// | ||
// } | ||
// | ||
// private class UnfilledTransition implements MorphTransition { | ||
// | ||
// String feature; | ||
// | ||
// public FilledTransition fill(String rule, String out) { | ||
// return null; | ||
// } | ||
// | ||
// } | ||
// | ||
// private interface FilledTransition extends MorphTransition { | ||
// | ||
// Word get(String s, int i); | ||
// | ||
// } | ||
// | ||
// private class EpsilonTransition implements FilledTransition { | ||
// | ||
// private MorphState to; | ||
// } | ||
// | ||
// private class AffixTransition implements FilledTransition { | ||
// | ||
// private MorphState to; | ||
// private String form; | ||
// private String feature; | ||
// private boolean prefix; | ||
// | ||
// } | ||
// | ||
// private class RootTransition implements FilledTransition { | ||
// | ||
// private MorphState to; | ||
// private String root; | ||
// private String features; | ||
// private List<String> infixes; | ||
// private List<Range> infixRanges; | ||
// | ||
// | ||
// private class Range { | ||
// private int from; | ||
// private int to; | ||
// } | ||
// } | ||
// | ||
//} |
Oops, something went wrong.