Package synalp.commons.semantics

Examples of synalp.commons.semantics.DefaultLiteral


  @Test
  @SuppressWarnings("javadoc")
  public void testUnification()
  {
    DefaultLiteral lit1 = DefaultLiteral.readLiteral("F0_1:qeq(?G0_1 ?A0_1)");
    DefaultLiteral lit2 = DefaultLiteral.readLiteral("qeq(BR L3)");

    InstantiationContext context = new InstantiationContext();
    assertTrue(lit1.unifies(lit2, context));
    assertTrue(context.containsKey(new FeatureVariable("?G0_1")));
    assertEquals(new FeatureConstant("BR"), context.get(new FeatureVariable("?G0_1")));
View Full Code Here


  @Test
  @SuppressWarnings("javadoc")
  public void testUnificationIgnoreLabels()
  {
    DefaultLiteral lit1 = DefaultLiteral.readLiteral("F0_1:qeq(?G0_1 ?A0_1)");
    DefaultLiteral lit2 = DefaultLiteral.readLiteral("L1:qeq(BR L3)");

    DefaultLiteral.IGNORE_LABELS = false;
    assertFalse(lit1.unifies(lit2));

    DefaultLiteral.IGNORE_LABELS = true;
View Full Code Here

  public Set<Integer> createExtraLiterals(int literalIndex, GrammarEntry entry)
  {
    Set<Integer> ret = new HashSet<Integer>();
    for(int i = literalIndex + 1; i < literals.size(); i++)
    {
      DefaultLiteral candidate = literals.get(i);
      if (entry.getSemantics().contains(candidate, entry.getContext()))
        ret.add(i);
    }
    return ret;
  }
View Full Code Here

   * @return entries
   */
  public Set<GrammarEntry> getEntriesByLiteral(int index)
  {
    Set<GrammarEntry> ret = new HashSet<GrammarEntry>();
    DefaultLiteral literal = getLiteral(index);
    for(GrammarEntry entry : entries.values())
      if (entry.getSemantics().contains(literal, entry.getContext()))
        ret.add(entry);
    return ret;
  }
View Full Code Here

{
  @Test
  @SuppressWarnings("javadoc")
  public void testLiteralRead1()
  {
    DefaultLiteral literal = DefaultLiteral.readLiteral("A:proper_q(?C CR CS)");
    assertNotNull(literal);
    assertEquals(literal.getLabel(), new FeatureConstant("A"));
    assertEquals(literal.getPredicate(), new FeatureConstant("proper_q"));
    assertEquals(literal.getArguments().size(), 3);
    assertEquals(literal.getArgument(0), new FeatureVariable("?C"));
    assertEquals(literal.getArgument(1), new FeatureConstant("CR"));
  }
View Full Code Here

  @Test
  @SuppressWarnings("javadoc")
  public void testLiteralRead2()
  {
    DefaultLiteral literal = DefaultLiteral.readLiteral("qeq(BR L3)");
    assertNotNull(literal);
    assertNull(literal.getLabel());
    assertEquals(literal.getPredicate(), new FeatureConstant("qeq"));
    assertEquals(literal.getArguments().size(), 2);
  }
View Full Code Here

TOP

Related Classes of synalp.commons.semantics.DefaultLiteral

Copyright © 2018 www.massapicom. 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.