Package org.apache.ctakes.core.fsm.state

Examples of org.apache.ctakes.core.fsm.state.NonTerminalEndState


   * @return
   */
  private Machine getNumericDateMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    endState.setEndStateFlag(true);
    ntEndState.setEndStateFlag(true);

    Machine machine = new Machine(startState);
    State monthNumState = new NamedState("MONTH_NUM");
    State monthDaySeparatorState = new NamedState("MONTH_DAY_SEP");
    State dayNumState = new NamedState("DAY_NUM");
    State dayYearSeparatorState = new NamedState("DAY_YEAR_SEP");

    Condition monthNumCondition = new IntegerRangeCondition(MIN_MONTH,
        MAX_MONTH);
    Condition mdFslashCondition = new PunctuationValueCondition('/');
    Condition mdDashCondition = new PunctuationValueCondition('-');
    Condition dyFslashCondition = new PunctuationValueCondition('/');
    Condition dyDashCondition = new PunctuationValueCondition('-');
    Condition dayNumCondition = new IntegerRangeCondition(MIN_DAY, MAX_DAY);
    Condition yearNumCondition = new IntegerRangeCondition(MIN_YEAR,
        MAX_YEAR);

    // condition that is not a fslash or dash
    Condition notFslashNotDashCondition = new CombineCondition(
        new NegateCondition(mdFslashCondition), new NegateCondition(
            mdDashCondition));

    startState.addTransition(monthNumCondition, monthNumState);
    startState.addTransition(new AnyCondition(), startState);

    monthNumState.addTransition(mdFslashCondition, monthDaySeparatorState);
    monthNumState.addTransition(mdDashCondition, monthDaySeparatorState);
    monthNumState.addTransition(new AnyCondition(), startState);

    monthDaySeparatorState.addTransition(dayNumCondition, dayNumState);
    monthDaySeparatorState.addTransition(new AnyCondition(), startState);

    dayNumState.addTransition(dyFslashCondition, dayYearSeparatorState);
    dayNumState.addTransition(dyDashCondition, dayYearSeparatorState);
    dayNumState.addTransition(notFslashNotDashCondition, ntEndState);
    dayNumState.addTransition(new AnyCondition(), startState);

    dayYearSeparatorState.addTransition(yearNumCondition, endState);
    dayYearSeparatorState.addTransition(new AnyCondition(), startState);

    endState.addTransition(new AnyCondition(), startState);
    ntEndState.addTransition(new AnyCondition(), startState);

    return machine;
  }
View Full Code Here


   * @return
   */
  private Machine getTextualDateMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    endState.setEndStateFlag(true);
    ntEndState.setEndStateFlag(true);

    Machine m = new Machine(startState);

    State monthFullTextState = new NamedState("MONTH_FULL_TEXT");
    State monthShortTextState = new NamedState("MONTH_SHORT_TEXT");
    State dayNumState = new NamedState("DAY_NUM");
    State commaState = new NamedState("COMMA");
    State periodState = new NamedState("PERIOD");

    Condition monthFullTextCondition = new WordSetCondition(
        iv_monthFullNameSet, false);
    Condition monthShortTextCondition = new WordSetCondition(
        iv_monthShortNameSet, false);
    Condition dayNumCondition = new IntegerRangeCondition(MIN_DAY, MAX_DAY);
    Condition periodCondition = new PunctuationValueCondition('.');
    Condition yearNumCondition = new IntegerRangeCondition(MIN_YEAR,
        MAX_YEAR);
    Condition commaCondition = new PunctuationValueCondition(',');

    // condition for not being a comma or year number
    Condition notCommaNotYearNumCondition = new CombineCondition(
        new NegateCondition(commaCondition), new NegateCondition(
            yearNumCondition));

    // condition for being a year num and not a day num
    Condition yearNotDayNumCondition = new CombineCondition(
        yearNumCondition, new NegateCondition(dayNumCondition));

    startState.addTransition(monthFullTextCondition, monthFullTextState);
    startState.addTransition(monthShortTextCondition, monthShortTextState);
    startState.addTransition(new AnyCondition(), startState);

    monthFullTextState.addTransition(dayNumCondition, dayNumState);
    monthFullTextState.addTransition(yearNotDayNumCondition, endState);
    monthFullTextState.addTransition(new AnyCondition(), startState);

    monthShortTextState.addTransition(dayNumCondition, dayNumState);
    monthShortTextState.addTransition(periodCondition, periodState);
    monthShortTextState.addTransition(yearNotDayNumCondition, endState);
    monthShortTextState.addTransition(new AnyCondition(), startState);

    periodState.addTransition(dayNumCondition, dayNumState);
    periodState.addTransition(yearNotDayNumCondition, endState);
    periodState.addTransition(new AnyCondition(), startState);

    dayNumState.addTransition(yearNumCondition, endState);
    dayNumState.addTransition(commaCondition, commaState);
    dayNumState.addTransition(notCommaNotYearNumCondition, ntEndState);
    dayNumState.addTransition(new AnyCondition(), startState);

    commaState.addTransition(yearNumCondition, endState);
    commaState.addTransition(new AnyCondition(), startState);

    endState.addTransition(new AnyCondition(), startState);
    ntEndState.addTransition(new AnyCondition(), startState);

    return m;
  }
View Full Code Here

    State fslashState = new NamedState("FSLASH");
    State orState = new NamedState("OR");
    State altTailState = new NamedState("ALTTAIL");
    State finishAltState = new NamedState("EXTREMITY");
   
    State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    endState.setEndStateFlag(true);
    ntEndState.setEndStateFlag(true);
 
    Machine m = new Machine(startState);
 
    Condition subFirstBegin = new TextSetCondition(iv_confirmedSubBeginSet,
        false);
View Full Code Here

    State startState = new NamedState("START");
    State endState = new NamedState("END");
      State nonCaseState = new NamedState("NOCOLON");
    State casenState = new NamedState("COLON");
   
    State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    endState.setEndStateFlag(true);
    ntEndState.setEndStateFlag(true);
 
    Machine m = new Machine(startState);
 
    Condition subFirstSolo = new TextSetCondition(iv_probableSubSet,
        false);
View Full Code Here

    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State caseState = new NamedState("COLON");
    State nonCaseState = new NamedState("NOCOLON");
   
    State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    endState.setEndStateFlag(true);
    ntEndState.setEndStateFlag(true);
 
    Machine m = new Machine(startState);
 
    Condition subFirstBegin = new TextSetCondition(iv_negateSubSet,
        false);
View Full Code Here

  private Machine getAspectualNegIndicatorMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State anyState = new NamedState("ANY");

    State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    endState.setEndStateFlag(true);
    ntEndState.setEndStateFlag(true);

    Machine m = new Machine(startState);
    State regModalState = new NamedState("REG_MODAL");
    State negPartState = new NamedState("NEG_PART");
    State negVerbState = new NamedState("NEG_VERB");
    State negCollocState = new NamedState("NEG_COLLOC");
    State negColPartState = new NamedState("NEG_COLPART");

    Condition regModalC = new TextSetCondition(iv_modalVerbsSet, false);
    Condition negPartC = new TextSetCondition(iv_negParticlesSet, false);
    Condition regVerbC = new TextSetCondition(iv_regVerbsSet, false);
    Condition negVerbC = new TextSetCondition(iv_negVerbsSet, false);
    Condition negDetC = new TextSetCondition(iv_negDeterminersSet, false);
    Condition negCollocC = new TextSetCondition(iv_negCollocSet, false);
    Condition negColPartC = new TextSetCondition(iv_negColPartSet, false);

    Condition notCollocC = new NegateCondition(negCollocC);

    startState.addTransition(negVerbC, negVerbState);
    startState.addTransition(negCollocC, negCollocState); // rule

    startState.addTransition(new DisjoinCondition(regModalC, regVerbC),
        regModalState); // start with a modal
    startState.addTransition(new DisjoinCondition(negPartC, negDetC),
        negPartState);

    startState.addTransition(new AnyCondition(), startState);

    regModalState.addTransition(negCollocC, negCollocState);
    negCollocState.addTransition(negColPartC, negColPartState); // out
    negColPartState.addTransition(new AnyCondition(), ntEndState);
    negCollocState.addTransition(new AnyCondition(), startState);

    regModalState.addTransition(new DisjoinCondition(negPartC, negDetC),
        negPartState);
    regModalState.addTransition(new AnyCondition(), anyState);

    anyState.addTransition(new DisjoinCondition(negPartC, negDetC),
        negPartState);
    anyState.addTransition(new AnyCondition(), startState);

    negPartState.addTransition(notCollocC, ntEndState);
    negVerbState.addTransition(notCollocC, ntEndState);
    negPartState.addTransition(new AnyCondition(), startState);
    negVerbState.addTransition(new AnyCondition(), startState);

    negPartState.addTransition(new AnyCondition(), ntEndState);
    negVerbState.addTransition(new AnyCondition(), ntEndState);

    ntEndState.addTransition(new AnyCondition(), endState);

    return m;
  }
View Full Code Here

   */
  private Machine getNominalNegIndicatorMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State anyState = new NamedState("ANY");
    State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    endState.setEndStateFlag(true);
    ntEndState.setEndStateFlag(true);

    Machine m = new Machine(startState);
    State negPrepState = new NamedState("NEG_PREP");
    State negDetState = new NamedState("NEG_DET");
    State regNounState = new NamedState("REG_NOUN");

    Condition negPrepC = new TextSetCondition(iv_negPrepositionsSet, false);
    Condition negDetC = new TextSetCondition(iv_negDeterminersSet, false);
    Condition regNounC = new TextSetCondition(iv_regNounsSet, false);

    startState.addTransition(negDetC, negDetState); // start with a modal
    startState.addTransition(negPrepC, negPrepState);
    startState.addTransition(new AnyCondition(), startState);

    negPrepState.addTransition(new AnyCondition(), ntEndState);
    negDetState.addTransition(regNounC, regNounState);
    negDetState.addTransition(new AnyCondition(), ntEndState);
    negDetState.addTransition(new AnyCondition(), anyState);

    anyState.addTransition(regNounC, regNounState);
    anyState.addTransition(new AnyCondition(), anyState);

    regNounState.addTransition(new AnyCondition(), ntEndState);

    ntEndState.addTransition(new AnyCondition(), endState);

    return m;
  }
View Full Code Here

   */

  private Machine getAdjNegIndicatorMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    endState.setEndStateFlag(true);
    ntEndState.setEndStateFlag(true);

    Machine m = new Machine(startState);
    State regPrepState = new NamedState("REG_PREP");
    State negAdjState = new NamedState("NEG_ADJ");

    Condition regPrepC = new TextSetCondition(iv_regPrepositionsSet, false);
    Condition negAdjC = new TextSetCondition(iv_negAdjectivesSet, false);

    startState.addTransition(negAdjC, negAdjState); // start with a modal
    startState.addTransition(new AnyCondition(), startState);

    negAdjState.addTransition(regPrepC, regPrepState);
    regPrepState.addTransition(new AnyCondition(), ntEndState);
    negAdjState.addTransition(new AnyCondition(), startState);

    ntEndState.addTransition(new AnyCondition(), endState);

    return m;
  }
View Full Code Here

        State twoPartState = new NamedState("TWOSTATE");
        State twoOfThreePartState = new NamedState("TWOOFTHREESTATE");
        State threePartState = new NamedState("THREESTATE");
        State twoArterialPartState = new NamedState("TWOSTATEART");
        State threeArterialPartState = new NamedState("THREESTATEART");
        State ntEndState = new NonTerminalEndState("NON TERMINAL END");
        endState.setEndStateFlag(true);
        ntEndState.setEndStateFlag(true);

        Machine m = new Machine(startState);

        Condition negInitDetC = new TextSetCondition(iv_negInitialDeterminersSet, false);
        Condition negInit1of2DetC = new TextSetCondition(iv_negCol1of2PartSet, false);
        Condition negInit2of2DetC = new TextSetCondition(iv_negCol2of2PartSet, false);
        Condition negInit1of3DetC = new TextSetCondition(iv_negCol1Of3PartSet, false);
        Condition negInit2of3DetC = new TextSetCondition(iv_negCol2Of3PartSet, false);
        Condition negInit3of3DetC = new TextSetCondition(iv_negCol3Of3PartSet, false);
        Condition negInit1of3ArterialDetC = new TextSetCondition(iv_negCol1Of3ArterialPartSet, false);
        Condition negInit2of3ArterialDetC = new TextSetCondition(iv_negCol2Of3ArterialPartSet, false);
        Condition negInit3of3ArterialDetC = new TextSetCondition(iv_negCol3Of3ArterialPartSet, false);
        Condition negInitNtEndDetC = new TextSetCondition(iv_negColAnyOf3PartSet, false);
       
        startState.addTransition(negInitDetC, endState); // start with a modal
        startState.addTransition(negInit1of2DetC, twoPartState);
        startState.addTransition(negInit1of3DetC, twoOfThreePartState);
        startState.addTransition(negInit1of3ArterialDetC, twoArterialPartState);
        startState.addTransition(negInitNtEndDetC, ntEndState);
        startState.addTransition(new AnyCondition(), startState);

        twoPartState.addTransition(negInit2of2DetC, endState);
        twoPartState.addTransition(new AnyCondition(), startState);
       
        twoOfThreePartState.addTransition(negInit2of3DetC, threePartState);
        twoOfThreePartState.addTransition(new AnyCondition(), startState);
       
        twoArterialPartState.addTransition(negInit2of3ArterialDetC, threeArterialPartState);
        twoArterialPartState.addTransition(new AnyCondition(), startState);

        threePartState.addTransition(negInit3of3DetC, endState);
        threePartState.addTransition(new AnyCondition(), startState);
       
        threeArterialPartState.addTransition(negInit3of3ArterialDetC, endState);
        threeArterialPartState.addTransition(new AnyCondition(), startState);
       
        ntEndState.addTransition(negInitNtEndDetC, ntEndState);
        ntEndState.addTransition(new AnyCondition(), endState);
       
        endState.addTransition(new AnyCondition(), startState);
        return m;
    }
View Full Code Here

     * @return
     */
    private Machine getWeeklyMachine() {
      State startState = new NamedState("START");
      State endState = new NamedState("END");
      State ntEndState = new NonTerminalEndState("NON TERMINAL END");
      ntEndState.setEndStateFlag(true);
      endState.setEndStateFlag(true);
      State leftAbbreviateState = new NamedState("LEFT_FREQ");
     
      Machine m = new Machine(startState);
 
      State leftAbbreviateQState = new NamedState("LEFT_Q");

      State middleAbbreviateQtoWState = new NamedState("MID_Q2W");
 
 
      State rightAbbreviateQWKState = new NamedState("RIGHT_QWK");
 
   
      State firstDotQState = new NamedState("FIRSTDOTQ");

 
      State secondDotQtoWState = new NamedState("SECONDDOTQ2W");
 
 
      Condition firstDotConditionQ = new PunctuationValueCondition('.');
      Condition secondDotConditionQW = new PunctuationValueCondition('.');
      Condition thirdDotConditionQWK = new PunctuationValueCondition('.');

      Condition soloCondition = new TextSetCondition(iv_perWeekWordSet, false);
 
 
      startState.addTransition(new TextValueCondition("q", false),
          leftAbbreviateQState);
      startState.addTransition(new TextValueCondition("a", false),
          leftAbbreviateState);
      startState.addTransition(new TextValueCondition("at", false),
          leftAbbreviateState);
      startState.addTransition(new TextValueCondition("per", false),
          leftAbbreviateState);
 
      startState.addTransition(soloCondition, endState);
      startState.addTransition(new AnyCondition(), startState);
 
      leftAbbreviateQState.addTransition(firstDotConditionQ, firstDotQState);
      leftAbbreviateQState.addTransition(new AnyCondition(), startState);
 
     
      leftAbbreviateState.addTransition(new ContainsSetTextValueCondition(
          iv_perWeekWordSet, false), endState);
      leftAbbreviateState.addTransition(new AnyCondition(), startState);
 
      firstDotQState.addTransition(new TextValueCondition("w", false),
          middleAbbreviateQtoWState);

      firstDotQState.addTransition(new AnyCondition(), startState);
 
 
 
      middleAbbreviateQtoWState.addTransition(secondDotConditionQW,
          secondDotQtoWState);
      middleAbbreviateQtoWState.addTransition(new AnyCondition(), startState);
 
   
      secondDotQtoWState.addTransition(new TextValueCondition("k", false),
          rightAbbreviateQWKState);
      secondDotQtoWState.addTransition(new AnyCondition(), startState);
 
   
      rightAbbreviateQWKState.addTransition(thirdDotConditionQWK, endState);
        rightAbbreviateQWKState.addTransition(new AnyCondition(), startState);
    //  rightAbbreviateQWKState.addTransition(new AnyCondition(), startState);
 
      ntEndState.addTransition(new AnyCondition(),  startState);
      endState.addTransition(new AnyCondition(), startState);
      return m;
    }
View Full Code Here

TOP

Related Classes of org.apache.ctakes.core.fsm.state.NonTerminalEndState

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.