Package synalp.commons.semantics

Examples of synalp.commons.semantics.Semantics


      if (!found)
        kept.add(famSem1);
    }

    // now gathers all kept trace sem in the semantics
    Semantics semantics = new Semantics();
    for(FamilySemantics famSem : kept)
      semantics.addAll(famSem.getSemantics());

    entry.setSemantics(semantics);
  }
View Full Code Here


   * "idx".
   * @param entry
   */
  public static void clearSemantics(GrammarEntry entry)
  {
    entry.setSemantics(new Semantics());
    for(Node node : entry.getTree().getNodes())
    {
      node.getFsTop().removeFeature("idx");
      node.getFsBot().removeFeature("idx");
    }
View Full Code Here

        String errorMsg = "Error: unable to parse rewriting rule, check the existence of feature 'sem'";
        logger.error(errorMsg);
        throw new Exception(errorMsg);
      }
       
      Semantics sem = InputReader.readSemantics(semStr);
      RuleOperator operator = null;
      if (name.equals("add"))
        operator = new AddOperator(sem);
      else if (name.equals("del"))
        operator = new DelOperator(sem);
      else if (name.equals("replace-by"))
        operator = new ReplaceOperator(sem, matchRule.getMatch());
      else if (name.equals("replace"))
      {
        Semantics by = InputReader.readSemantics(attributes.getValue("by"));
        operator = new ReplaceOperator(by, sem);
      }
      operator.addConstants(newConstValues);
      matchRule.addOperator(operator);
    }
View Full Code Here

    {
      logger.error("Error: unable to parse matching rule, check the existence of feature 'match'");
      return null;
    }
   
    return new MatchingRule(InputReader.readSemantics(match), without==null ? new Semantics() : InputReader.readSemantics(without));
  }
View Full Code Here

   * @param context
   */
  public void apply(Semantics semantics, InstantiationContext context)
  {
    createConstants(semantics, context);
    Semantics newSem = new Semantics(add);
    newSem.instantiate(context);
    semantics.addAll(newSem);
  }
View Full Code Here

   * @param semantics
   * @param context
   */
  public void apply(Semantics semantics, InstantiationContext context)
  {
    Semantics sem = new Semantics(toDelete);
    sem.instantiate(context);
    semantics.removeAll(sem);
  }
View Full Code Here

  public static Map<String, EntryPack> createPacksSemOnly(PolarityContext context)
  {
    Map<Semantics, GrammarEntries> table = new HashMap<Semantics, GrammarEntries>();
    for(GrammarEntry entry : context.getEntries())
    {
      Semantics sem = entry.getSemantics();
      if (!table.containsKey(sem))
        table.put(sem, new GrammarEntries());
      table.get(sem).add(entry);
    }
View Full Code Here

  public static Map<String, EntryPack> createPacksSemKey(PolarityContext context)
  {
    Table<Semantics, PolarityKeys, GrammarEntries> table = HashBasedTable.create();
    for(GrammarEntry entry : context.getEntries())
    {
      Semantics sem = entry.getSemantics();
      PolarityKeys keys = context.getPolarity(entry);
      if (!table.contains(sem, keys))
        table.put(sem, keys, new GrammarEntries());
      table.get(sem, keys).add(entry);
    }
View Full Code Here

  private String processGenerateForInput(JsonObject object, String input)
  {
    if (!object.has("sem"))
      return errorMessage("input has no \"sem\" key", input);

    Semantics semantics = null;
    try
    {
      semantics = InputReader.readSemantics(object.get("sem").getAsString());
    }
    catch (Exception e)
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.