package werti.util.trans; /*import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.jgrapht.DirectedGraph; import org.jgrapht.graph.DefaultEdge; import org.jgrapht.graph.DirectedSubgraph; import org.jgrapht.traverse.DepthFirstIterator; import werti.uima.ae.PassiveSentenceConverter; import werti.uima.types.annot.Token; import werti.util.Transformation;*/ public class FindRootVerb { /*> implements Transformation { //public List> apply(A g) { public List apply(A g) { final Set ts = g.vertexSet(); final List> r = new ArrayList>(); for (final Token t:ts) { if (t.getTag().matches("^V.*") && g.incomingEdgesOf(t).size() == 0) { r.add(getSubgraph(g,t)); } } return (List)r; } private DirectedGraph getSubgraph(A g, Token root) { final DepthFirstIterator it = new DepthFirstIterator(g,root); final Set subgraphVertices = new HashSet(); final Set subgraphEdges = new HashSet(); while (it.hasNext()) { subgraphVertices.add(it.next()); } for (final Token t:subgraphVertices) { subgraphEdges.addAll(g.outgoingEdgesOf(t)); } return new DirectedSubgraph(g,subgraphVertices, subgraphEdges); } public boolean meetsPrecondition(A g) { return true; }*/ }