Examples of TextRulerTarget


Examples of org.apache.uima.ruta.textruler.core.TextRulerTarget

    return result;
  }

  protected LP2Rule createInitialRuleForPositiveExample(TextRulerExample example) {
    TextRulerTarget target = example.getTarget();
    LP2Rule rule = new LP2Rule(this, example.getTarget());
    CAS docCas = example.getDocumentCAS();
    TextRulerAnnotation exampleAnnotation = example.getAnnotation();
    TypeSystem ts = docCas.getTypeSystem();
    Type tokensRootType = ts.getType(TextRulerToolkit.RUTA_ANY_TYPE_NAME);
View Full Code Here

Examples of org.apache.uima.ruta.textruler.core.TextRulerTarget

   *          the name of a slot
   */
  private void runForSlot(String slotName) {

    sendStatusUpdateToDelegate("Working on " + slotName, TextRulerLearnerState.ML_RUNNING, true);
    TextRulerTarget target = new TextRulerTarget(slotName,
            TextRulerTarget.MLTargetType.SINGLE_WHOLE_SLOT, this);
    this.exampleDocuments.createExamplesForTarget(target);
    if (!shouldAbort())
      blocks.put(slotName, getBlocks());
    if (!shouldAbort())
View Full Code Here

Examples of org.apache.uima.ruta.textruler.core.TextRulerTarget

    ruleList = new TextRulerRuleList();
    coveredExamples = new HashSet<TextRulerExample>();

    sendStatusUpdateToDelegate("Creating examples...", TextRulerLearnerState.ML_RUNNING, false);
    for (int i = 0; i < slotNames.length; i++) {
      TextRulerTarget target = new TextRulerTarget(slotNames[i], this);
      exampleDocuments.createExamplesForTarget(target);

      TextRulerExampleDocument[] docs = exampleDocuments.getSortedDocumentsInCacheOptimizedOrder();

      allExamplesCount = exampleDocuments.getAllPositiveExamples().size();
View Full Code Here

Examples of org.apache.uima.ruta.textruler.core.TextRulerTarget

    result.add(ctxStartRule);
    return result;
  }

  protected List<LP2Rule> createStartRulesForExample(final TextRulerExample example) {
    TextRulerTarget target = example.getTarget();
    List<LP2Rule> result = new ArrayList<LP2Rule>();
    CAS docCas = example.getDocumentCAS();
    TextRulerAnnotation exampleAnnotation = example.getAnnotation();
    TypeSystem ts = docCas.getTypeSystem();
    Type tokensRootType = ts.getType(TextRulerToolkit.RUTA_ANY_TYPE_NAME);
View Full Code Here

Examples of org.apache.uima.ruta.textruler.core.TextRulerTarget

      int compressionFailCount = 0;

      // only working for one slot yet !
      currentSlotName = slotNames[i];
      cachedTestedRuleStatistics.clear();
      exampleDocuments.createExamplesForTarget(new TextRulerTarget(currentSlotName, this));
      examples = exampleDocuments.getAllPositiveExamples();

      if (shouldAbort())
        return;
View Full Code Here

Examples of org.apache.uima.ruta.textruler.core.TextRulerTarget

  }

  public Score scoreSlot(String slotName) {
    Score result = new Score();
    // TODO set a learner here... or something else...
    TextRulerTarget target = new TextRulerTarget(slotName, null);
    result.slotName = slotName;
    int index = 0;
    CAS testCAS = null;
    for (TextRulerExampleDocument doc : trainingDocuments) {
      CAS exampleCAS = doc.getCAS();
View Full Code Here

Examples of org.apache.uima.ruta.textruler.core.TextRulerTarget

    slotMaximumTokenCountMap.put(slotName, histogram.size() - 1); // -1 since the
    // zero-histogram point
    // also needs a place!

    TextRulerRuleList ctxRules = new TextRulerRuleList();
    TextRulerRuleList bestRules = learnTaggingRules(new TextRulerTarget(slotName,
            MLTargetType.SINGLE_LEFT_BOUNDARY, this), ctxRules); // learn
    // left
    // boundary
    // best
    // rules
    if (bestRules != null) {
      leftBoundaryBestRulesMap.put(slotName, bestRules.getRulesString(""));
      leftBoundaryContextualRulesMap.put(slotName, ctxRules.getRulesString("\t"));
      bestRules.clear(); // free som memory/references
    }
    if (shouldAbort())
      return;
    ctxRules.clear();
    bestRules = learnTaggingRules(new TextRulerTarget(slotName, MLTargetType.SINGLE_RIGHT_BOUNDARY,
            this), ctxRules); // learn
    // right
    // boundary best
    // rules
    if (bestRules != null) {
      rightBoundaryBestRulesMap.put(slotName, bestRules.getRulesString(""));
      rightBoundaryContextualRulesMap.put(slotName, ctxRules.getRulesString("\t"));
    }

    // TODO add correction rule learn stuff
    // testTaggingRulesAndCreateCorrectionRulesExamples(null, STANDARD_MAX_CONTEXTUAL_RULES_COUNT)

    // correct left start
    TextRulerTarget lsTarget = new TextRulerTarget(slotName, MLTargetType.SINGLE_LEFT_CORRECTION,
            this);
    lsTarget.setMaxShiftDistance(shiftSize);
    TextRulerRuleList correctLeftRules = learnTaggingRules(lsTarget, null);

    // resultString = "CAP{REGEXP(\"PM\")} ALL{->MARKONCE(stimeEND)};";
    // try {
    // FileUtils.saveString2File(resultString, file);
View Full Code Here

Examples of org.apache.uima.ruta.textruler.core.TextRulerTarget

          sb.append(contextRulesPool.getRulesString(""));
      }
    }

    for (String eachSlot : slotNames) {
      String leftBoundary = TextRulerToolkit.getTypeShortName((new TextRulerTarget(eachSlot,
              MLTargetType.SINGLE_LEFT_BOUNDARY, this)).getSingleSlotTypeName());
      String rightBoundary = TextRulerToolkit.getTypeShortName((new TextRulerTarget(eachSlot,
              MLTargetType.SINGLE_RIGHT_BOUNDARY, this)).getSingleSlotTypeName());
      String slotMarkName = TextRulerToolkit.getTypeShortName(eachSlot);
      int maxInnerLength = (getMaxTokens(eachSlot) * 3) - 2;
      sb.append("\n//slot-building rules:\n");
      sb.append(leftBoundary + "{IS(" + rightBoundary + ")->UNMARK(" + leftBoundary + "), UNMARK("
View Full Code Here

Examples of org.apache.uima.ruta.textruler.core.TextRulerTarget

    TypeSystem ts = someCas.getTypeSystem();
    // check if all helper types are present:
    List<String> list = new ArrayList<String>();

    for (String eachSlot : slotNames) {
      list.add(new TextRulerTarget(eachSlot, MLTargetType.SINGLE_LEFT_BOUNDARY, this)
              .getSingleSlotTypeName());
      list.add(new TextRulerTarget(eachSlot, MLTargetType.SINGLE_RIGHT_BOUNDARY, this)
              .getSingleSlotTypeName());
    }

    boolean result = true;
    List<String> missingTypes = new ArrayList<String>();
View Full Code Here

Examples of org.apache.uima.ruta.textruler.core.TextRulerTarget

    ruleList = new TextRulerRuleList();
    coveredExamples = new HashSet<TextRulerExample>();

    sendStatusUpdateToDelegate("Creating examples...", TextRulerLearnerState.ML_RUNNING, false);
    for (int i = 0; i < slotNames.length; i++) {
      TextRulerTarget target = new TextRulerTarget(slotNames[i], this);
      exampleDocuments.createExamplesForTarget(target);

      TextRulerExampleDocument[] docs = exampleDocuments.getSortedDocumentsInCacheOptimizedOrder();

      allExamplesCount = exampleDocuments.getAllPositiveExamples().size();
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.