use of annis.model.AnnisNode in project ANNIS by korpling.
the class ProielDependecyTree method writeEdge.
private void writeEdge(Edge e) {
AnnisNode srcNode = e.getSource();
AnnisNode destNode = e.getDestination();
if (e.getName() == null || srcNode == null || destNode == null) {
return;
}
String srcId = "" + srcNode.getId();
String destId = "" + destNode.getId();
// get the edge annotation
StringBuilder sbAnno = new StringBuilder();
for (Annotation anno : e.getAnnotations()) {
if ("func".equals(anno.getName())) {
if ("--".equals(anno.getValue())) {
return;
}
sbAnno.append(anno.getValue());
}
break;
}
String style = null;
if ("secedge".equals(e.getName())) {
style = "color=blue, fontcolor=black, style=dashed";
} else {
style = "color=orange, fontcolor=black";
}
String edgeString = srcId + " -> " + destId + "[" + style + " label=\"" + sbAnno.toString() + "\"]";
if (!alreadyWrittenEdge.contains(edgeString)) {
w(" " + edgeString);
alreadyWrittenEdge.add(edgeString);
}
}
use of annis.model.AnnisNode in project ANNIS by korpling.
the class ProielRegularDependencyTree method writeAllPseudoToken.
private void writeAllPseudoToken() {
// write out pseudo token nodes
for (AnnisNode n : input.getResult().getGraph().getNodes()) {
if (!n.isToken()) {
boolean isDepNode = false;
for (Annotation anno : n.getNodeAnnotations()) {
if ("tiger".equals(anno.getNamespace()) && "word".equals(anno.getName())) {
isDepNode = true;
break;
}
}
if (isDepNode) {
writeNode(n);
pseudoToken.add(n);
}
}
}
}
use of annis.model.AnnisNode in project ANNIS by korpling.
the class ProielRegularDependencyTree method writeInvisibleTokenEdges.
private void writeInvisibleTokenEdges(List<AnnisNode> token) {
Collections.sort(token, new Comparator<AnnisNode>() {
@Override
public int compare(AnnisNode o1, AnnisNode o2) {
return o1.getTokenIndex().compareTo(o2.getTokenIndex());
}
});
AnnisNode lastTok = null;
for (AnnisNode tok : token) {
if (lastTok != null) {
w("\t\t");
w(lastTok.getId());
w(" -> ");
w(tok.getId());
w(" [style=invis];\n");
}
lastTok = tok;
}
}
use of annis.model.AnnisNode in project ANNIS by korpling.
the class DotGraphVisualizer method writeInvisibleTokenEdges.
private void writeInvisibleTokenEdges(List<AnnisNode> token) {
Collections.sort(token, new Comparator<AnnisNode>() {
@Override
public int compare(AnnisNode o1, AnnisNode o2) {
return o1.getTokenIndex().compareTo(o2.getTokenIndex());
}
});
AnnisNode lastTok = null;
for (AnnisNode tok : token) {
if (lastTok != null) {
w("\t\t");
w(lastTok.getId());
w(" -> ");
w(tok.getId());
w(" [style=invis];\n");
}
lastTok = tok;
}
}
use of annis.model.AnnisNode in project ANNIS by korpling.
the class AnnisGraphTools method extractGraph.
private DirectedGraph<AnnisNode, Edge> extractGraph(AnnotationGraph ag, AnnisNode n, String terminalNamespace, String terminalName) {
DirectedGraph<AnnisNode, Edge> graph = new DirectedSparseGraph<AnnisNode, Edge>();
copyNode(graph, n, terminalNamespace, terminalName);
for (Edge e : ag.getEdges()) {
if (hasEdgeSubtype(e, getSecEdgeSubType()) && graph.containsVertex(e.getDestination()) && graph.containsVertex(e.getSource())) {
graph.addEdge(e, e.getSource(), e.getDestination());
}
}
return graph;
}
Aggregations