Examples of Derivation


Examples of OntoUML.Derivation

        if (result == null) result = caseNamedElement(dependencyRelationship);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case OntoUMLPackage.DERIVATION: {
        Derivation derivation = (Derivation)theEObject;
        T result = caseDerivation(derivation);
        if (result == null) result = caseDependencyRelationship(derivation);
        if (result == null) result = caseDirectedBinaryRelationship(derivation);
        if (result == null) result = caseDirectedRelationship(derivation);
        if (result == null) result = caseRelationalClassifier(derivation);
View Full Code Here

Examples of OntoUML.Derivation

      fFigureDerivationNameLabelFigure = new WrappingLabel();
      fFigureDerivationNameLabelFigure.setText("Name");

      this.add(fFigureDerivationNameLabelFigure);

      Derivation d = (Derivation) ((View) derivationeditpart.getModel())
          .getElement();

      for (int i = 0; i < d.getSource().size(); ++i) {
        ((Property) d.getSource().get(i)).setLower(((Property) d
            .getSource().get(i)).derivarLowerDerivation());
        ((Property) d.getSource().get(i)).setUpper(((Property) d
            .getSource().get(i)).derivarUpperDerivation());
      }

      //      fFigureDerivationSourceCardinalitiesLabelFigure = new WrappingLabel();
      //      String text = new String("");
      //      if ((((Property) d.getSource().get(0)).getLower() == 0)
      //          && (((Property) d.getSource().get(0)).getUpper() == -1))
      //        text = "*";
      //      else {
      //        text = text
      //            .concat(((Integer) (((Property) d.getSource().get(0))
      //                .getLower())).toString());
      //        if (((Property) d.getSource().get(0)).getUpper() != ((Property) d
      //            .getSource().get(0)).getLower()) {
      //          text = text.concat("..");
      //          if (((Property) d.getSource().get(0)).getUpper() == -1)
      //            text = text.concat("*");
      //          else
      //            text = text.concat(((Integer) (((Property) d
      //                .getSource().get(0)).getUpper())).toString());
      //        }
      //      }
      //
      //      fFigureDerivationSourceCardinalitiesLabelFigure.setText(text);
      //
      //      this.add(fFigureDerivationSourceCardinalitiesLabelFigure);
      //
      //      fFigureDerivationTargetCardinalitiesLabelFigure = new WrappingLabel();
      //      text = "";
      //      if ((((Property) d.getTarget().get(0)).getLower() == 0)
      //          && (((Property) d.getTarget().get(0)).getUpper() == -1))
      //        text = "*";
      //      else {
      //        text = text
      //            .concat(((Integer) (((Property) d.getTarget().get(0))
      //                .getLower())).toString());
      //        if (((Property) d.getTarget().get(0)).getUpper() != ((Property) d
      //            .getTarget().get(0)).getLower()) {
      //          text = text.concat("..");
      //          if (((Property) d.getTarget().get(0)).getUpper() == -1)
      //            text = text.concat("*");
      //          else
      //            text = text.concat(((Integer) (((Property) d
      //                .getTarget().get(0)).getUpper())).toString());
      //        }
      //      }
      //
      //      fFigureDerivationTargetCardinalitiesLabelFigure.setText(text);
      //
      //      this.add(fFigureDerivationTargetCardinalitiesLabelFigure);

      if (!d.getSource().isEmpty())
        ((Property) d.getSource().get(0))
            .setContainer(d.getContainer());
      if (!d.getTarget().isEmpty())
        ((Property) d.getTarget().get(0))
            .setContainer(d.getContainer());

    }
View Full Code Here

Examples of OntoUML.Derivation

     * <!-- end-user-doc -->
     * @generated NOT
     */
    private void updateContents(DerivationEditPart derivationeditpart) {

      Derivation d = (Derivation) ((View) derivationeditpart.getModel())
          .getElement();

      for (int i = 0; i < d.getSource().size(); ++i) {
        ((Property) d.getSource().get(i)).setLower(((Property) d
            .getSource().get(i)).derivarLowerDerivation());
        ((Property) d.getSource().get(i)).setUpper(((Property) d
            .getSource().get(i)).derivarUpperDerivation());
      }

      //      String text = new String("");
      //      if ((((Property) d.getSource().get(0)).getLower() == 0)
View Full Code Here

Examples of OntoUML.Derivation

      fFigureDerivationNameLabelFigure = new WrappingLabel();
      fFigureDerivationNameLabelFigure.setText("Name");

      this.add(fFigureDerivationNameLabelFigure);

      Derivation d = (Derivation) ((View) derivationeditpart.getModel())
          .getElement();

      for (int i = 0; i < d.getSource().size(); ++i) {
        ((Property) d.getSource().get(i)).setLower(((Property) d
            .getSource().get(i)).derivarLowerDerivation());
        ((Property) d.getSource().get(i)).setUpper(((Property) d
            .getSource().get(i)).derivarUpperDerivation());
      }

      //      fFigureDerivationSourceCardinalitiesLabelFigure = new WrappingLabel();
      //      String text = new String("");
      //      if ((((Property) d.getSource().get(0)).getLower() == 0)
      //          && (((Property) d.getSource().get(0)).getUpper() == -1))
      //        text = "*";
      //      else {
      //        text = text
      //            .concat(((Integer) (((Property) d.getSource().get(0))
      //                .getLower())).toString());
      //        if (((Property) d.getSource().get(0)).getUpper() != ((Property) d
      //            .getSource().get(0)).getLower()) {
      //          text = text.concat("..");
      //          if (((Property) d.getSource().get(0)).getUpper() == -1)
      //            text = text.concat("*");
      //          else
      //            text = text.concat(((Integer) (((Property) d
      //                .getSource().get(0)).getUpper())).toString());
      //        }
      //      }
      //
      //      fFigureDerivationSourceCardinalitiesLabelFigure.setText(text);
      //
      //      this.add(fFigureDerivationSourceCardinalitiesLabelFigure);
      //
      //      fFigureDerivationTargetCardinalitiesLabelFigure = new WrappingLabel();
      //      text = "";
      //      if ((((Property) d.getTarget().get(0)).getLower() == 0)
      //          && (((Property) d.getTarget().get(0)).getUpper() == -1))
      //        text = "*";
      //      else {
      //        text = text
      //            .concat(((Integer) (((Property) d.getTarget().get(0))
      //                .getLower())).toString());
      //        if (((Property) d.getTarget().get(0)).getUpper() != ((Property) d
      //            .getTarget().get(0)).getLower()) {
      //          text = text.concat("..");
      //          if (((Property) d.getTarget().get(0)).getUpper() == -1)
      //            text = text.concat("*");
      //          else
      //            text = text.concat(((Integer) (((Property) d
      //                .getTarget().get(0)).getUpper())).toString());
      //        }
      //      }
      //
      //      fFigureDerivationTargetCardinalitiesLabelFigure.setText(text);
      //
      //      this.add(fFigureDerivationTargetCardinalitiesLabelFigure);

      if (!d.getSource().isEmpty())
        ((Property) d.getSource().get(0))
            .setContainer(d.getContainer());
      if (!d.getTarget().isEmpty())
        ((Property) d.getTarget().get(0))
            .setContainer(d.getContainer());

    }
View Full Code Here

Examples of OntoUML.Derivation

     * <!-- end-user-doc -->
     * @generated NOT
     */
    private void updateContents(DerivationEditPart derivationeditpart) {

      Derivation d = (Derivation) ((View) derivationeditpart.getModel())
          .getElement();

      for (int i = 0; i < d.getSource().size(); ++i) {
        ((Property) d.getSource().get(i)).setLower(((Property) d
            .getSource().get(i)).derivarLowerDerivation());
        ((Property) d.getSource().get(i)).setUpper(((Property) d
            .getSource().get(i)).derivarUpperDerivation());
      }

      //      String text = new String("");
      //      if ((((Property) d.getSource().get(0)).getLower() == 0)
View Full Code Here

Examples of OntoUML.Derivation

     * <!-- end-user-doc -->
     * @generated NOT
     */
    private void updateContents(DerivationEditPart derivationeditpart) {

      Derivation d = (Derivation) ((View) derivationeditpart.getModel())
          .getElement();

      /*      for (int i = 0; i < d.getSource().size(); ++i) {
       ((Property) d.getSource().get(i)).setLower(((Property) d
       .getSource().get(i)).derivarLowerDerivation());
       ((Property) d.getSource().get(i)).setUpper(((Property) d
       .getSource().get(i)).derivarUpperDerivation());
       }*/
      for (int i = 0; i < d.getSource().size(); ++i) {
        ((Property) d.getSource().get(i)).setLower(d
            .deriveLowerDerivation());
        ((Property) d.getSource().get(i)).setUpper(d
            .deriveUpperDerivation());
      }
    }
View Full Code Here

Examples of edu.stanford.nlp.sempre.Derivation

                                     double compatDecisionThreshold,
                                     double probDecisionThreshold) {
    List<Derivation> derivations = ex.getPredDerivations();
    double[] probs = Derivation.getProbs(derivations, 1.0d);
    for (int i = 0; i < derivations.size(); i++) {
      Derivation deriv = derivations.get(i);
      double gold, pred;
      if (compatDecisionThreshold == -1.0d)
        gold = deriv.getCompatibility();
      else
        gold = (deriv.getCompatibility() > compatDecisionThreshold) ? 1.0d : 0.0d;
      if (probDecisionThreshold == -1.0d)
        pred = probs[i];
      else
        pred = (probs[i] > probDecisionThreshold) ? 1.0d : 0.0d;
      m.tp += gold * pred;
 
View Full Code Here

Examples of edu.stanford.nlp.sempre.Derivation

      List<Derivation> firstDerivs = first.getPredDerivations();

      LogInfo.logs("STAT %s", first.getEvaluation().summary());

      for (int j = 0; j < firstDerivs.size(); j++) {
        Derivation firstDeriv = firstDerivs.get(j);
        LogInfo.begin_track("Ex %d, derivation %d", i, j);
        if (firstDeriv.getCompatibility() == 1.0d)
          LogInfo.log("DERIV CORRECT");
        else
          LogInfo.log("DERIV WRONG");
        LogInfo.logs("DERIV %s", firstDeriv);

        // TODO no executor stats being written/loaded at present.
        //firstDeriv.getExecutorStats().logStats(""+j);

        List<Pair<String, Double>> topFeatures;
        List<Pair<String, Double>> botFeatures;
        if (row.size() >= 2) {
          Integer derivIndex = rowDerivIndices.get(1).get(firstDeriv);
          Derivation secondDeriv = (derivIndex == null)
                                   ? null
                                   : row.get(1).getPredDerivations().get(derivIndex);
          topFeatures = getTopFeatures(
              topN,
              params.get(0),
              params.get(1),
              firstDeriv,
              secondDeriv,
              false);
          botFeatures = getTopFeatures(
              topN,
              params.get(0),
              params.get(1),
              firstDeriv,
              secondDeriv,
              true);
        } else {
          topFeatures = getTopFeatures(
              topN,
              params.get(0),
              null,
              firstDeriv,
              null,
              false);
          botFeatures = getTopFeatures(
              topN,
              params.get(0),
              null,
              firstDeriv,
              null,
              true);
        }

        String[] positions = new String[row.size()];
        String[][] chart = new String[topFeatures.size() + botFeatures.size()][row.size()];
        String[][] totals = new String[4][row.size()];

        for (int k = 0; k < row.size(); k++) {
          Integer derivIndex = rowDerivIndices.get(k).get(firstDeriv);

          // Positions
          positions[k] = String.format("%12s", (derivIndex == null) ? "~" : ("" + derivIndex));

          // Features
          // Walk down topFeatures and up botFeatures at the same time.
          int n = Math.max(topFeatures.size(), botFeatures.size());
          for (int f = 0; f < n; f++) {
            if (f < topFeatures.size()) {
              String featureName = topFeatures.get(f).getFirst();
              double val = params.get(k).getWeight(featureName);
              chart[f][k] = String.format("%12.4f", val);
            }
            if (f < botFeatures.size()) {
              String featureName = botFeatures.get(f).getFirst();
              double val = params.get(k).getWeight(featureName);
              chart[chart.length - 1 - f][k] = String.format("%12.4f", val);
            }
          }

          // Totals
          if (derivIndex == null) {
            totals[0][k] = totals[1][k] = totals[2][k] = totals[3][k] = String.format("%12s", "~");
          } else {
            Derivation deriv = row.get(k).getPredDerivations().get(derivIndex);
            totals[0][k] = String.format("%12.4f", deriv.getScore());
            totals[1][k] = String.format("%12.4f", deriv.getProb());
            totals[2][k] = String.format("%12.4f", deriv.getCompatibility());
            totals[3][k] = String.format("%12d", deriv.getMaxBeamPosition());
          }
        }
        LogInfo.log("");

        LogInfo.logs("%-40s\t%12s%s", "POS", "", Joiner.on(' ').join(positions));
View Full Code Here

Examples of edu.stanford.nlp.sempre.Derivation

    if(ex.getPredDerivations().size()==0)
      return new TDoubleMap<EntityInstance>();

    LogInfo.begin_track("Generating entity distribtuion");
    Pair<Context,Interval> bestPair = null;
    Derivation bestDeriv = null;

    for(Derivation currDeriv: ex.getPredDerivations()) {
      Pair<Context,Interval> currPair = ParaphraseUtils.extractContextIntervalPair(currDeriv, ex);
      if(bestPair==null || firstBetter(currPair,currDeriv,bestPair,bestDeriv,ex)) {
        if(opts.verbose>=3 && bestDeriv != null)
          LogInfo.logs("ParaphraseLearner: replacing context %s with formula %s for context %s with formula %s",bestPair,bestDeriv.formula,currPair,currDeriv.formula);
        bestPair = currPair;
        bestDeriv = currDeriv;
      }
    }

    TDoubleMap<EntityInstance> res = new TDoubleMap<EntityInstance>();
    Context bestContext = bestPair.getFirst();
    Interval bestInterval = bestPair.getSecond();
    EntityInstance entityInstance = new EntityInstance(bestContext,
        ex.languageInfo.lemmaPhrase(bestInterval.start, bestInterval.end),
        bestInterval, bestDeriv.formula, bestDeriv.getAllFeatureVector(),bestDeriv.type);

    if(opts.verbose>=3)
      LogInfo.logs("ParaphraseLearner: generated entity instance=%s",entityInstance);
    res.put(entityInstance, 1.0);
    LogInfo.end_track();
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.