git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1686 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
redpony 2008-05-14 22:10:56 +00:00
parent 11ca13f487
commit e5ecd8c9e9
3 changed files with 18 additions and 5 deletions

View File

@ -12,5 +12,9 @@ public class Hyperarc {
public Hyperarc(List<Vertex> tail) {
this.tail = tail;
}
public String toString() {
return super.toString() + " tail=" + tail;
}
}

View File

@ -1,11 +1,8 @@
package org.statmt.hg4;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Set;
public class Hypergraph {
@ -40,7 +37,15 @@ public class Hypergraph {
sinkVertices.remove(child);
}
sourceVertices.remove(vertex);
}
}
public String toString() {
String x = "HG\n SRC="+sourceVertices + "\n SINK="+sinkVertices +"\n";
for (Vertex v : sinkVertices) {
x += "\n V="+v;
}
return x;
}
static class Rule extends Phrase {
public Rule(Phrase p) { super(p.d); }
@ -87,12 +92,13 @@ public class Hypergraph {
targetS.add(new Vertex(new ArrayList<Hyperarc>()));
hg.addNode(targetS.get(0));
}
targetS.get(0).addArc(ext);
hg.addLink(targetS.get(0), ext);
System.out.println(ext + " r="+r + " dest=" + targetStack);
}
}
}
}
System.out.println(hg);
}
}

View File

@ -25,5 +25,8 @@ public class Vertex {
}
public String toString() {
return super.toString() + " inarcs=" + incomingArcs;
}
}