diff options
author | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2010-09-10 13:34:17 +0400 |
---|---|---|
committer | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2010-09-10 13:34:17 +0400 |
commit | c73dddfb5bcc7730f9185eb926e23b988d858d60 (patch) | |
tree | 92856a970aeb27d585b3fd8ecdec8cb82c69716a /misc | |
parent | bdfa2beab8bcd0591eb91ed1c0de86b465d43a4a (diff) |
delete eclipse build
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3423 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'misc')
-rw-r--r-- | misc/java-utils/.classpath | 6 | ||||
-rw-r--r-- | misc/java-utils/.cvsignore | 1 | ||||
-rw-r--r-- | misc/java-utils/.project | 17 | ||||
-rw-r--r-- | misc/java-utils/CombineTags.java | 89 | ||||
-rw-r--r-- | misc/java-utils/ProcessShallowParse.java | 82 | ||||
-rw-r--r-- | misc/java-utils/ShrinkSentence.java | 48 | ||||
-rw-r--r-- | misc/java-utils/TagHierarchy.java | 135 |
7 files changed, 0 insertions, 378 deletions
diff --git a/misc/java-utils/.classpath b/misc/java-utils/.classpath deleted file mode 100644 index 233be1d2c..000000000 --- a/misc/java-utils/.classpath +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path=""/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="output" path=""/> -</classpath> diff --git a/misc/java-utils/.cvsignore b/misc/java-utils/.cvsignore deleted file mode 100644 index 6b468b62a..000000000 --- a/misc/java-utils/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*.class diff --git a/misc/java-utils/.project b/misc/java-utils/.project deleted file mode 100644 index 7f927621f..000000000 --- a/misc/java-utils/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>java-utils</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/misc/java-utils/CombineTags.java b/misc/java-utils/CombineTags.java deleted file mode 100644 index 207791682..000000000 --- a/misc/java-utils/CombineTags.java +++ /dev/null @@ -1,89 +0,0 @@ -// $Id$ - -import java.io.*; -import java.util.*; - -// create sentences with all features combined from files with individual tags -class CombineTags -{ - public static void main(String[] args) throws Exception - { - System.err.println("Starting..."); - - Vector vecInstream = new Vector(); - for (int i = 0 ; i < args.length ; i++) - { - InputStreamReader temp = new InputStreamReader(new FileInputStream(args[i]), "Latin1"); - BufferedReader inStream = new BufferedReader(temp); - vecInstream.add(inStream); - } - OutputStreamWriter outStream = new OutputStreamWriter((OutputStream)System.out, "Latin1"); - - new CombineTags(vecInstream, outStream); - - System.err.println("End..."); - } - - public CombineTags(Vector vecInstream , OutputStreamWriter outStream) throws Exception - { - BufferedReader inFile = (BufferedReader) vecInstream.get(0); - String inLine; - while ((inLine = inFile.readLine()) != null) - { - Vector phrases = new Vector(); - - // do 1st stream - Vector phrase = new Vector(); - StringTokenizer st = new StringTokenizer(inLine); - while (st.hasMoreTokens()) - { - String tag = st.nextToken(); - phrase.add(tag); - } - phrases.add(phrase); - - // read other stream - for (int i = 1 ; i < vecInstream.size() ; i++) - { - BufferedReader otherFile = (BufferedReader) vecInstream.get(i); - String otherLine = otherFile.readLine(); - StringTokenizer otherSt = new StringTokenizer(otherLine); - Vector otherPhrase = new Vector(); - - while (otherSt.hasMoreTokens()) - { - String tag = otherSt.nextToken(); - otherPhrase.add(tag); - } - phrases.add(otherPhrase); - } - - // combine - phrase = (Vector) phrases.get(0); - - for (int pos = 0 ; pos < phrase.size() ; pos++) - { - String outLine = (String) phrase.get(pos) + "|"; - - for (int stream = 1 ; stream < phrases.size() ; stream++) - { - Vector otherPhrase = (Vector) phrases.get(stream); - String otherTag; - if (otherPhrase.size() <= pos) - otherTag = (String) otherPhrase.get(0); - else - otherTag = (String) otherPhrase.get(pos); - outLine += otherTag + "|"; - } - outLine = outLine.substring(0, outLine.length() - 1) + " "; - outStream.write(outLine); - } - outStream.write("\n"); - } - // close stream - outStream.flush(); - outStream.close(); - outStream = null; - } -} - diff --git a/misc/java-utils/ProcessShallowParse.java b/misc/java-utils/ProcessShallowParse.java deleted file mode 100644 index 77b789b20..000000000 --- a/misc/java-utils/ProcessShallowParse.java +++ /dev/null @@ -1,82 +0,0 @@ -// $Id$ - - -import java.io.*; -import java.util.*; - -//input is the sentences with all features combined -//output sentences combination of morphology, lopar tags and parsed tags -// used to create generation table -public class ProcessShallowParse -{ - public static void main(String[] args) throws Exception - { - System.err.println("Starting..."); - - InputStreamReader inStream = new InputStreamReader(args.length > 0 ? new FileInputStream(args[0]) : System.in - , "Latin1"); - OutputStreamWriter outStream = new OutputStreamWriter(args.length > 1 ? new FileOutputStream(args[1]) : (OutputStream) System.out - , "Latin1"); - - new ProcessShallowParse2(inStream, outStream); - - System.err.println("End..."); - } -} - -class ProcessShallowParse2 -{ // factored sentence - - public ProcessShallowParse2(Reader inStream, Writer outStream) throws Exception - { - BufferedReader inFile = new BufferedReader(inStream); - BufferedWriter outFile = new BufferedWriter(outStream); - - // tokenise - String inLine; - int i = 1; - while ((inLine = inFile.readLine()) != null) - { - StringTokenizer st = new StringTokenizer(inLine); - String ret = ""; - while (st.hasMoreTokens()) - { - String factoredWord = st.nextToken(); - ret += Output(factoredWord); - } - outFile.write(ret + "\n"); - i++; - } - outFile.flush(); - outFile.close(); - outFile = null; - System.err.print("no of lines = " + i); - } - - protected String Output(String factoredWord) throws Exception - { - StringTokenizer st = new StringTokenizer(factoredWord, "|"); - - String surface = st.nextToken(); - String posNormal = st.nextToken(); - String morph = st.nextToken(); - String posImproved = st.nextToken(); - String ret = ""; - - if (posImproved.equals("ART-SB") - || posImproved.equals("NN-NK_NP-SB")) - { - ret = posImproved + "_" + morph + " "; - } - else if (posImproved.equals("???")) - { - ret = "??? "; - } - else - { - ret = surface + " "; - } - - return ret; - } -} diff --git a/misc/java-utils/ShrinkSentence.java b/misc/java-utils/ShrinkSentence.java deleted file mode 100644 index e69fc6b1c..000000000 --- a/misc/java-utils/ShrinkSentence.java +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ - -import java.io.*; -import java.util.*; - -//used to create language model -public class ShrinkSentence -{ - public static void main(String[] args) throws Exception - { - System.err.println("Starting..."); - - InputStreamReader inStream = new InputStreamReader(args.length > 0 ? new FileInputStream(args[0]) : System.in - , "Latin1"); - OutputStreamWriter outStream = new OutputStreamWriter(args.length > 1 ? new FileOutputStream(args[1]) : (OutputStream) System.out - , "Latin1"); - - new ShrinkSentence(inStream, outStream); - - System.err.println("End..."); - } - - public ShrinkSentence(Reader inStream, Writer outStream) throws Exception - { - BufferedReader inFile = new BufferedReader(inStream); - BufferedWriter outFile = new BufferedWriter(outStream); - - // tokenise - String inLine; - int i = 1; - while ((inLine = inFile.readLine()) != null) - { - StringTokenizer st = new StringTokenizer(inLine); - while (st.hasMoreTokens()) - { - String word = st.nextToken(); - if (!word.equals("???")) - outFile.write(word + " "); - } - outFile.write("\n"); - i++; - } - outFile.flush(); - outFile.close(); - outFile = null; - System.err.print("no of lines = " + i); - } -}
\ No newline at end of file diff --git a/misc/java-utils/TagHierarchy.java b/misc/java-utils/TagHierarchy.java deleted file mode 100644 index cdec14948..000000000 --- a/misc/java-utils/TagHierarchy.java +++ /dev/null @@ -1,135 +0,0 @@ -// $Id$ - -import java.io.*; -import java.util.*; - -// create pos-tag sentences from LISP-like input tree. -// NN-NK tag augmented with NP-SP if parent is NP-SB -class TagHierarchy -{ - public static void main(String[] args) throws Exception - { - System.err.println("Starting..."); - - InputStreamReader inStream = new InputStreamReader(args.length > 0 ? new FileInputStream(args[0]) : System.in - , "Latin1"); - OutputStreamWriter outStream = new OutputStreamWriter(args.length > 1 ? new FileOutputStream(args[1]) : (OutputStream) System.out - , "Latin1"); - - new TagHierarchy(inStream, outStream); - - System.err.println("End..."); - } - - public TagHierarchy(Reader inStream, OutputStreamWriter outStream) throws Exception - { - BufferedReader inFile = new BufferedReader(inStream); - BufferedWriter outFile = new BufferedWriter(outStream); - - // tokenise - String inLine; - int nullLines = 0; - while ((inLine = inFile.readLine()) != null) - { - if (inLine.equals("null")) - { - nullLines++; - outFile.write("null\n"); - } - else - { - OutputHierarchy2(inLine, outFile); - } - } - outFile.flush(); - outFile.close(); - outFile = null; - System.err.println(nullLines + " null lines\n"); - } - - // indent parsed tree to make it easier to look at - public void OutputHierarchy(String inLine, BufferedWriter outFile) throws Exception - { - int level = 0; - StringTokenizer st = new StringTokenizer(inLine); - while (st.hasMoreTokens()) - { - String parsed = st.nextToken(); - if (parsed.substring(0, 1).compareTo("(") == 0) - { // start of new node - outFile.write('\n'); - for (int currLevel = 0 ; currLevel < level ; currLevel++) - { - outFile.write(' '); - } - String tag = parsed.substring(1, parsed.length()); - outFile.write(tag); - level++; - } - else - { // closing nodes - int firstBracket = parsed.indexOf(')'); - int noBracket = parsed.length() - firstBracket; - String tag = parsed.substring(0, firstBracket); - outFile.write(" == " + tag); - level -= noBracket; - } - } - outFile.write('\n'); - } - - public void OutputHierarchy2(String inLine, BufferedWriter outFile) throws Exception - { - int level = 0; - Stack prevTags = new Stack(); - - StringTokenizer st = new StringTokenizer(inLine); - - while (st.hasMoreTokens()) - { - String parsed = st.nextToken(); - if (parsed.substring(0, 1).compareTo("(") == 0) - { // start of new node - String tag = parsed.substring(1, parsed.length()); - prevTags.push(tag); - level++; - } - else - { // closing nodes - - String parentTag = (String) prevTags.get(prevTags.size() - 2) - , currTag = (String) prevTags.get(prevTags.size() - 1); - if (currTag.equals("NN-NK") && parentTag.equals("NP-SB")) - currTag += "_" + parentTag; - - int firstBracket = parsed.indexOf(')'); - int noBracket = parsed.length() - firstBracket; - String word = parsed.substring(0, firstBracket); - - if (currTag.equals("ART-SB") - || currTag.equals("NN-NK_NP-SB") - || currTag.equals("VAFIN-HD") - || currTag.equals("VVFIN-HD") - || currTag.equals("VMFIN-HD") - || currTag.equals("PPER-SB") - || currTag.equals("PRELS-SB") - || currTag.equals("PDS-SB") - || currTag.equals("PPER-PH") - || currTag.equals("PPER-EP") - ) - outFile.write(currTag + " "); - else - outFile.write("??? "); - - level -= noBracket; - - // pop the rest - for (int i = 0 ; i < noBracket ; ++i) - { - prevTags.pop(); - } - } - } - outFile.write('\n'); - } -} |