Search in sources :

Example 6 with AnnisNode

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);
    }
}
Also used : AnnisNode(annis.model.AnnisNode) Annotation(annis.model.Annotation)

Example 7 with AnnisNode

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);
            }
        }
    }
}
Also used : AnnisNode(annis.model.AnnisNode) Annotation(annis.model.Annotation)

Example 8 with AnnisNode

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;
    }
}
Also used : AnnisNode(annis.model.AnnisNode)

Example 9 with AnnisNode

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;
    }
}
Also used : AnnisNode(annis.model.AnnisNode)

Example 10 with AnnisNode

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;
}
Also used : AnnisNode(annis.model.AnnisNode) Edge(annis.model.Edge) DirectedSparseGraph(edu.uci.ics.jung.graph.DirectedSparseGraph)

Aggregations

AnnisNode (annis.model.AnnisNode)38 Annotation (annis.model.Annotation)10 Edge (annis.model.Edge)9 LinkedList (java.util.LinkedList)8 HashMap (java.util.HashMap)7 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6 Map (java.util.Map)5 AnnotationGraph (annis.model.AnnotationGraph)4 AnnisResult (annis.service.ifaces.AnnisResult)4 DetectHoles (annis.visualizers.iframe.partitur.DetectHoles)2 DocumentNameMapRow (annis.dao.DocumentNameMapRow)1 MatchedNodeColors (annis.libgui.MatchedNodeColors)1 RelannisEdgeFeature (annis.model.RelannisEdgeFeature)1 RelannisNodeFeature (annis.model.RelannisNodeFeature)1 AnnisToken (annis.service.ifaces.AnnisToken)1 Match (annis.service.objects.Match)1 MatchGroup (annis.service.objects.MatchGroup)1 ArrayCorpusPathExtractor (annis.sqlgen.ArrayCorpusPathExtractor)1 CorpusPathExtractor (annis.sqlgen.CorpusPathExtractor)1