Package synalp.commons.semantics

Examples of synalp.commons.semantics.Semantics


   */
  public TestSuiteEntry(TestSuiteEntry entry)
  {
    this.id = entry.getId();
    this.strict = entry.isStrict();
    this.semantics = new Semantics(entry.getSemantics());
    this.sentences = new ArrayList<String>(entry.getSentences());
  }
View Full Code Here


    Macro macro = macros.get(macroName);
    if (macro == null)
    {
      logger.error("Warning: entry '" + name + "' has no related macro, hence an empty semantics");
      ret.setSemantics(new Semantics());
      ret.setInterface(new FeatureStructure());
    }
    else
    {
      InstantiationContext context = new InstantiationContext();
      FeatureStructure newHeader = Unifier.unify(macroHeader, macro.getHeader(), context);
      if (newHeader == null)
        logger.error("Warning: header of '" + name + "' does not unify with macro header '" + macro.getName() + "' : " + macro.getHeader());

      FeatureStructure entryInterface = new FeatureStructure(macro.getMacroInterface());
      entryInterface.instantiate(context);
      ret.setInterface(entryInterface);

      Semantics semantics = new Semantics(macro.getSemantics());
      semantics.instantiate(context);
      ret.setSemantics(semantics);
    }

    return ret;
  }
View Full Code Here

    generateButton.setToolTipText(GUIMessages.getString("GeneratorMainFrame.generateButton.toolTipText"));
    generateButton.setHorizontalAlignment(SwingConstants.RIGHT);
   
    generateButton.addActionListener(new ActionListener(){ 
          public void actionPerformed(ActionEvent ae){ 
            Semantics mrs = GeneratorGUI.getGeneratorGUI().getGeneratorRun().getSelectedSemantics();
            logger.info("Semantics = " + mrs.toString());
            logger.info("### GENERATION ####");
            List<? extends SyntacticRealization> reals = GeneratorGUI.getGeneratorGUI().getGeneratorRun().generate(mrs);
            for(SyntacticRealization real : reals){
              logger.info("DerivedTree = " + real.getDerivedTree().toString());
              logger.info("MorphoRealization = " + real.getMorphRealizations().toString());
View Full Code Here

  @Test
  public void testSubsumption1()
  {
    String str1 = "A0_1:indiv(?B0_1 ?C0_1 ?D0_1) F0_1:qeq(?G0_1 ?A0_1) A0_1:named(?B0_1 tammy_n) H0_1:proper_q(?B0_1 ?G0_1 ?I0_1)";
    String str2 = "L6:event(S pres indet ind) qeq(CR L5) L4:indiv(C f pl 3) L2:proper_q(B BR BS) L3:indiv(B f sg) L4:udef_q(C CR CS) L0:proper_q(A AR AS) L6:intelligent_adj(S C) L3:named(B fiona_n) qeq(BR L3) L5:and(C A B) L1:named(A tammy_n) L1:indiv(A f sg) qeq(AR L1)";
    Semantics sem1 = Semantics.readSemantics(str1);
    Semantics sem2 = Semantics.readSemantics(str2);
    assertTrue(sem1.subsumes(sem2).isEmpty());
  }
View Full Code Here

  @Test
  public void testSubsumption2()
  {
    String str1 = "?A0_1:indiv(?B0_1 ?C0_1 ?D0_1) ?F0_1:qeq(?G0_1 ?A0_1) ?A0_1:named(?B0_1 tammy_n) ?H0_1:proper_q(?B0_1 ?G0_1 ?I0_1)";
    String str2 = "L6:event(S pres indet ind) qeq(CR L5) L4:indiv(C f pl 3) L2:proper_q(B BR BS) L3:indiv(B f sg) L4:udef_q(C CR CS) L0:proper_q(A AR AS) L6:intelligent_adj(S C) L3:named(B fiona_n) qeq(BR L3) L5:and(C A B) L1:named(A tammy_n) L1:indiv(A f sg) qeq(AR L1)";
    Semantics sem1 = Semantics.readSemantics(str1);
    Semantics sem2 = Semantics.readSemantics(str2);
    assertFalse(sem1.subsumes(sem2).isEmpty());
  }
View Full Code Here

 
  @Test
  @SuppressWarnings("javadoc")
  public void testFlatten()
  {
    Semantics sem1 = Semantics.readSemantics("foo(a|b c|d)");
    Semantics sem2 = Semantics.readSemantics("foo(a c) foo(b c) foo(a d) foo(b d)");
    assertTrue(new Semantics().join(sem1.flattenDisjunctions()).equals(sem2, new InstantiationContext()));
   
    sem1 = Semantics.readSemantics("foo(a|b c|d) bar(e f|g)");
    assertTrue(sem1.flattenDisjunctions().size() == 8);
  }
View Full Code Here

      public void focusGained(FocusEvent e){}

      public void focusLost(FocusEvent e)
      {
        String text = semanticsTA.getText();
        Semantics newMRS = Semantics.readSemantics(text);
        //Update main application
        GeneratorGUI.getGeneratorGUI().getGeneratorRun().setSelectedSemantics(newMRS);
      }
    });
View Full Code Here

    this.name = entry.getName();
    this.originalName = entry.getOriginalName();
    this.family = entry.getFamily();
    this.tree = new Tree(entry.getTree());
    this.trace = new Trace(entry.getTrace());
    this.semantics = new Semantics(entry.getSemantics());
    this.context = new InstantiationContext(entry.getContext());
    this.entryInterface = new FeatureStructure(entry.getInterface());
  }
View Full Code Here

   * semantics and instantiates it (resolve variables) in the entry current context.
   * @return a new Semantics
   */
  public Semantics getInstantiatedSemantics()
  {
    Semantics ret = new Semantics(semantics);
    semantics.instantiate(context);
    return ret;
  }
View Full Code Here

          /*
           * set instantiated semantics, if the fam sem is a pattern use this semantics
           * else use normally the semantics of the entry
           */
          Semantics lexSemantics = new Semantics(famSem.isPattern() ? famSem.getSemantics() : entry.getSemantics());
          lexSemantics.instantiate(famSem.getLemmas().get(lemma));
          lexEntry.setSemantics(lexSemantics);

          /*
           * set all equations: the family-wide equations, the equations for the particular lemma and the co-anchor equations.
           * Note that the family equations are only set for famSem that have lemmas!
View Full Code Here

TOP

Related Classes of synalp.commons.semantics.Semantics

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.