Examples of LFVertex


Examples of opennlp.ccg.hylo.graph.LFVertex

 
  @Before
  public void setUp() throws Exception {
    super.setUp();
   
    edge = new LFEdge(new LFVertex(new NominalAtom("w0"), new Proposition("blah")),
        new LFVertex(new NominalAtom("w1"), new Proposition("blah blah")),
        new LFEdgeLabel(new ModeLabel("blase")));
   
    filter = new EdgeMatchFilter(edge, MatchType.LABEL_MISMATCH, MatchType.SOURCE_PREDICATE_MISMATCH,
        MatchType.TARGET_PREDICATE_MATCH);
  }
View Full Code Here

Examples of opennlp.ccg.hylo.graph.LFVertex

    }
  }
 
  @Test
  public void testAllows() {
    LFEdge test = new LFEdge(new LFVertex(new NominalAtom("w0"), new Proposition("blah blah")),
        new LFVertex(new NominalAtom("w1"), new Proposition("blah blah")),
        new LFEdgeLabel(new ModeLabel("boring")));
   
    assertTrue(filter.allows(test));
   
    test = new LFEdge(test.getSource(), test.getTarget(), edge.getLabel());
View Full Code Here

Examples of opennlp.ccg.hylo.graph.LFVertex

 
  @Before
  public void setUp() throws Exception {
    super.setUp();
   
    one = new LFEdge(new LFVertex(new NominalAtom("w0"), new Proposition("blah")),
        new LFVertex(new NominalAtom("w1"), new Proposition("blah blah")),
        new LFEdgeLabel(new ModeLabel("blase")));
    two = new LFEdge(new LFVertex(new NominalAtom("w2"), new Proposition("blah")),
        new LFVertex(new NominalAtom("w3"), new Proposition("blah blah")),
        new LFEdgeLabel(new ModeLabel("blurg")));
   
    label = new LFEdgeLabel(new ModeLabel("blase"));
   
    filter = new LabelMatchFilter(label);
View Full Code Here

Examples of opennlp.ccg.hylo.graph.LFVertex

  }

  @SuppressWarnings("unchecked")
  @Test
  public void testAllows() {
    LFEdge one = new LFEdge(new LFVertex(new NominalAtom("w0"), new Proposition("blah")),
        new LFVertex(new NominalAtom("w1"), new Proposition("blah blah")),
        new LFEdgeLabel(new ModeLabel("blase"))),
      two = new LFEdge(new LFVertex(new NominalAtom("w2"), new Proposition("blah")),
        new LFVertex(new NominalAtom("w3"), new Proposition("blah blah")),
        new LFEdgeLabel(new ModeLabel("blase")));
   
    assertTrue(filter.allows(one));
    assertFalse(filter.allows(two));
   
View Full Code Here

Examples of opennlp.ccg.hylo.graph.LFVertex

    alignment.add(new Mapping(1, 0));
    alignment.add(new Mapping(2, 1));
   
    aGraph = new LFGraph();
   
    LFVertex aw0 = new LFVertex(new NominalAtom("w0"), new Proposition("a")),
      aw1 = new LFVertex(new NominalAtom("w1"), new Proposition("boy")),
      aw2 = new LFVertex(new NominalAtom("w2"), new Proposition("walk")),
      aw3 = new LFVertex(new NominalAtom("w3"), new Proposition("quickly"));
   
    aGraph.addVertex(aw0);
    aGraph.addVertex(aw1);
    aGraph.addVertex(aw2);
    aGraph.addVertex(aw3);
       
    aDet = aGraph.addLabeledEdge(aw1, aw0, LFEdgeLabel.forMode(new ModeLabel("Det")));
    aArg0 = aGraph.addLabeledEdge(aw2, aw1, LFEdgeLabel.forMode(new ModeLabel("Arg0")));
    aMod = aGraph.addLabeledEdge(aw2, aw3, LFEdgeLabel.forMode(new ModeLabel("Mod")));
   
    bGraph = new LFGraph();
   
    LFVertex bw0 = new LFVertex(new NominalAtom("w0"), new Proposition("he")),
      bw1 = new LFVertex(new NominalAtom("w1"), new Proposition("move"));
   
    bGraph.addVertex(bw0);
    bGraph.addVertex(bw1);
       
    bArg0 = bGraph.addLabeledEdge(bw1, bw0, LFEdgeLabel.forMode(new ModeLabel("Arg0")));
View Full Code Here

Examples of opennlp.ccg.hylo.graph.LFVertex

  @Before
  public void setUp() throws Exception {
    super.setUp();
   
    one = new LFVertex(new NominalAtom("w0"), new Proposition("blah"));
    two = new LFVertex(new NominalAtom("w1"), new Proposition("blah"));
   
    edge = new LFEdge(two,
        new LFVertex(new NominalAtom("w2"), new Proposition("blah blah")),
        new LFEdgeLabel(new ModeLabel("blase")));
   
    filter = new VertexMatchFilter(two, MatchType.SOURCE_MATCH);
  }
View Full Code Here

Examples of opennlp.ccg.hylo.graph.LFVertex

  @SuppressWarnings("unchecked")
  @Before
  public void setUp() throws Exception {
    super.setUp();
   
    one = new LFEdge(new LFVertex(new NominalAtom("w0"), new Proposition("blah")),
        new LFVertex(new NominalAtom("w1"), new Proposition("blah blah")),
        new LFEdgeLabel(new ModeLabel("blase")));
    two = new LFEdge(new LFVertex(new NominalAtom("w2"), new Proposition("blah")),
        new LFVertex(new NominalAtom("w3"), new Proposition("blah blah")),
        new LFEdgeLabel(new ModeLabel("bored")));
    three = new LFEdge(new LFVertex(new NominalAtom("w0"), new Proposition("zzz")),
        new LFVertex(new NominalAtom("w2"), new Proposition("snooze")),
        new LFEdgeLabel(new ModeLabel("blase")));
   
    edges = new LinkedHashSet<LFEdge>();
    edges.add(one);
    edges.add(two);
View Full Code Here

Examples of opennlp.ccg.hylo.graph.LFVertex

      }
    }
  }
 
  private void processSubstitutedSimilarTarget(DLFContext context, LFEdge outgoing) {
    LFVertex target = outgoing.getTarget();
    Map<LFVertex, Set<LFEdge>> subsBySource = graphDifference.substitutionsBySourceFor(outgoing);
   
    DLFContext ctxt = context.copy();
   
    // for each substituted edge, look for similar target
    for(LFVertex subSource : subsBySource.keySet()) {
      Set<LFEdge> similarTargetEdges = new FilteredLFEdgeSet(subsBySource.get(subSource),
          new SimilarTargetEdgeFilter(ctxt.vertex, outgoing.getLabel()));
     
      if(!similarTargetEdges.isEmpty()) {
        if(similarTargetEdges.size() > 1) { // more than one similar target?
          System.err.println("more than one similar target edge for " + ctxt.vertex
              + ": " + similarTargetEdges); // TODO figure out what to do about this
        }
       
        assimilateAttributes(ctxt, target, similarTargetEdges.iterator().next().getTarget());
        LFVertex hp = ctxt.getGraph().highestLFAncestorOf(target);
       
        if(hp == null || hp.equals(outgoing.getSource())) {
          context.getVertices(SHARED).add(target);
         
          ctxt.vertex = target;
          ctxt.vertices = context.copyVertices(LOCAL_ANCESTOR, PREDICATES);
          ctxt.parent.appendChild(createDisjunctiveElement(ctxt));
View Full Code Here

Examples of opennlp.ccg.hylo.graph.LFVertex

            public Entry<LFVertex, FilteredLFEdgeSet> next() {
              if(edgeIterator == null) {
                edgeIterator = subs.iterator();
              }
             
              LFVertex src = edgeIterator.next().getSource();
             
              return new SimpleImmutableEntry<LFVertex, FilteredLFEdgeSet>(src,
                  new FilteredLFEdgeSet(subs, new VertexMatchFilter(src, SOURCE_MATCH)));
            }
           
View Full Code Here

Examples of opennlp.ccg.hylo.graph.LFVertex

   
    LFGraphIterator rootIterator = new LFGraphIterator(graphDifference.b);
    Map<Integer, Set<Integer>> mappings = graphDifference.alignment.asMap(B);
   
    while(rootIterator.hasNext()) {
      LFVertex vertex = rootIterator.next();
     
      if(!foreignAlignedSubgraphRoots.containsKey(vertex)) { // already encountered?
        if(mappings.containsKey(vertex.getIndex())) { // aligned?
          LFGraphIterator subgraphIterator = new LFGraphIterator(graphDifference.b, vertex);
         
          while(subgraphIterator.hasNext()) { // map whole subgraph to the aligned vertex
            foreignAlignedSubgraphRoots.put(subgraphIterator.next(), vertex);
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.