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

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


   * </ol>
   *
   * @return
   */
  private Machine getEveryOtherHourMachine() {
    State startState = new NamedState("START_EOHM");
    State endState = new NamedState("END_EOHM");
    State leftAbbreviateQState = new NamedState("LEFT_Q_EOHM");
    State middleAbbreviateQtoOState = new NamedState("MID_Q2O");
    State rightAbbreviateQODState = new NamedState("RIGHT_QOD");
    State firstDotQState = new NamedState("FIRSTDOTQ_EOHM");
    State secondDotQtoOState = new NamedState("SECONDDOTQ2O");

    endState.setEndStateFlag(true);
 
    Machine m = new Machine(startState);
   
    startState.addTransition(new TextValueCondition("q", false),
        leftAbbreviateQState);
      startState.addTransition(new TextSetCondition(iv_everyOtherHourWordSet, false), endState);
    startState.addTransition(new AnyCondition(), startState);
   
    leftAbbreviateQState.addTransition(new PunctuationValueCondition('.'), firstDotQState);
    leftAbbreviateQState.addTransition(new AnyCondition(), startState);
   
    firstDotQState.addTransition(new TextValueCondition("o", false),
        middleAbbreviateQtoOState);
      firstDotQState.addTransition(new AnyCondition(),  startState);
     
    middleAbbreviateQtoOState.addTransition(new PunctuationValueCondition('.'),
        secondDotQtoOState);
    middleAbbreviateQtoOState.addTransition(new AnyCondition(), startState);
   
    secondDotQtoOState.addTransition(new TextValueCondition("d", false),
        rightAbbreviateQODState);
    secondDotQtoOState.addTransition(new AnyCondition(), startState);
   
    rightAbbreviateQODState.addTransition(new PunctuationValueCondition('.'), endState);
    rightAbbreviateQODState.addTransition(new AnyCondition(), startState);
   
  //  ntEndState.addTransition(new AnyCondition(), startState);
View Full Code Here


   * </ol>
   *
   * @return
   */
  private Machine getAsNeededMachine() {
    State startState = new NamedState("START_PRN");
    State endState = new NamedState("END_PRN");
    State asNeededState = new NamedState("PRN");
    State asNeededHyphState = new NamedState("HYPHPRN");
        State startPState = new NamedState("PSTATE");
        State startPDOTState = new NamedState("PDOTSTATE");
        State startRState = new NamedState("RSTATE");
        State startRDOTState = new NamedState("RDOTSTATE");
        State startNState = new NamedState("NSTATE");

        State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    ntEndState.setEndStateFlag(true);
    endState.setEndStateFlag(true);
 
    Machine m = new Machine(startState);
   
    startState.addTransition(new TextValueCondition("as", false),
        asNeededState);
      startState.addTransition(new TextSetCondition(iv_prnWordSet, false), endState);
      startState.addTransition(new TextValueCondition("p", false), startPState);
    startState.addTransition(new AnyCondition(), startState);
   
    startPState.addTransition(new PunctuationValueCondition('.'), startPDOTState);
    startPState.addTransition(new AnyCondition(), startState);
   
    startPDOTState.addTransition(new TextValueCondition("r", false), startRState);
    startPDOTState.addTransition(new AnyCondition(), startState);
     
    startRState.addTransition(new PunctuationValueCondition('.'), startRDOTState);
    startRState.addTransition(new AnyCondition(), startState);
 
    startRDOTState.addTransition(new TextValueCondition("n", false), startNState);
    startRDOTState.addTransition(new AnyCondition(), startState);
   
    startNState.addTransition(new PunctuationValueCondition('.'), endState);
    startNState.addTransition(new AnyCondition(), startState);
   
   
    asNeededState.addTransition(new TextValueCondition("needed", false), endState);
    asNeededState.addTransition(new PunctuationValueCondition('-'), asNeededHyphState);
    asNeededState.addTransition(new AnyCondition(), startState);
View Full Code Here

   * </ol>
   *
   * @return
   */
  private Machine getFourTimesADayMachine() {
    State startState = new NamedState("START_4TDM");
    State endState = new NamedState("END_4TDM");
    State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    ntEndState.setEndStateFlag(true);
    endState.setEndStateFlag(true);
    State leftAbbreviateQState = new NamedState("LEFT_Q_FTD");
    State middleAbbreviateQtoIState = new NamedState("MID_Q2I");
    State middleAbbreviateQtoDState = new NamedState("MID_Q2D");
    State rightAbbreviateQDSState = new NamedState("RIGHT_QDS");
    State rightAbbreviateQIDState = new NamedState("RIGHT_QID");
    State handleRangeState = new NamedState("HANDLERANGE");
    State sixHourState = new NamedState("SIXHOUR");
    State rangeHourState = new NamedState("RANGEHOUR");
    State eightSuffixState = new NamedState("EIGHTSUFFIX");
    State firstDotQState = new NamedState("FIRSTDOTQ");
    State secondDotQtoDState = new NamedState("SECONDDOTQ2D");
    State secondDotQtoIState = new NamedState("SECONDDOTQ2I");
    Machine m = new Machine(startState);
   
    startState.addTransition(new TextValueCondition("q", false),
        leftAbbreviateQState);
    startState.addTransition(new TextSetCondition(
        iv_fourTimesPerDayWordSet, false) , endState);
    startState.addTransition(new IntegerValueCondition(6), sixHourState);
    startState.addTransition(new DisjoinCondition(new CombineCondition(new NegateCondition(new IntegerRangeCondition(1,5)), new IntegerCondition()), new IntegerValueCondition(6)), handleRangeState);
    startState.addTransition(new DisjoinCondition(new TextSetCondition(iv_postSixWordSet, false), new TextValueCondition("six", false)), sixHourState);

    startState.addTransition(new AnyCondition(), startState);
   
    handleRangeState.addTransition(new PunctuationValueCondition('-'), rangeHourState);
    handleRangeState.addTransition(new AnyCondition(), startState);
   
      leftAbbreviateQState.addTransition(new PunctuationValueCondition('.'), firstDotQState);
      leftAbbreviateQState.addTransition(new TextValueCondition("six", false), sixHourState);
      leftAbbreviateQState.addTransition(new IntegerValueCondition(6), sixHourState);

      leftAbbreviateQState.addTransition(new TextSetCondition(
        iv_fourTimesPerDayWordSet, false) , sixHourState);
      leftAbbreviateQState.addTransition(new AnyCondition(), startState);
     
     
      rangeHourState.addTransition(new IntegerRangeCondition(7,10), eightSuffixState);
      rangeHourState.addTransition(new TextValueCondition("seven", false), eightSuffixState);
      rangeHourState.addTransition(new TextValueCondition("eight", false), eightSuffixState);
      rangeHourState.addTransition(new TextValueCondition("nine", false), eightSuffixState);
      rangeHourState.addTransition(new TextValueCondition("ten", false), eightSuffixState);
      rangeHourState.addTransition(new AnyCondition(), startState);
     
      eightSuffixState.addTransition(new TextSetCondition(iv_hourlySuffixSet, false), endState);
      eightSuffixState.addTransition(new AnyCondition(), startState);
   
   
    sixHourState.addTransition(new PunctuationValueCondition('-'), rangeHourState);
    sixHourState.addTransition(new TextValueCondition("to", false), rangeHourState);
    sixHourState.addTransition(new TextSetCondition(iv_hourlySuffixSet, false), endState);
    sixHourState.addTransition(new TextSetCondition(iv_fourTimesPerDayWordSet, false), endState);
    sixHourState.addTransition(new AnyCondition(), startState);
     
    firstDotQState.addTransition(new TextValueCondition("d", false),
        middleAbbreviateQtoDState);
    firstDotQState.addTransition(new TextValueCondition("i", false),
        middleAbbreviateQtoIState);
      firstDotQState.addTransition(new AnyCondition(), startState);
     
    middleAbbreviateQtoDState.addTransition(new PunctuationValueCondition('.'),
        secondDotQtoDState);
    middleAbbreviateQtoDState.addTransition(new AnyCondition(), startState);
   
           
    secondDotQtoDState.addTransition(new TextValueCondition("s", false),
        rightAbbreviateQDSState);
    secondDotQtoDState.addTransition(new AnyCondition(), startState);
 
    secondDotQtoIState.addTransition(new TextValueCondition("d", false),
        rightAbbreviateQIDState);
    secondDotQtoIState.addTransition(new AnyCondition(), startState);
   
    middleAbbreviateQtoIState.addTransition(new PunctuationValueCondition('.'),
        secondDotQtoIState);
    middleAbbreviateQtoIState.addTransition(new AnyCondition(), startState);
 
View Full Code Here

   * </ol>
   *
   * @return
   */
  private Machine getFrequencyMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State ntFalseTermState = new IndentStartState("NON TERMINAL START");
    State ntEndState = new NonTerminalEndState("NON TERMINAL END");
    ntFalseTermState.setEndStateFlag(true);
    ntEndState.setEndStateFlag(true);
    endState.setEndStateFlag(true);

    Machine m = new Machine(startState);

    State leftAbbreviateState = new NamedState("LEFT_FREQ");

    State lastTextState = new NamedState("RIGHT_FREQ");
    State middleATextState = new NamedState("MID_TEXT");
    State midTermState = new NamedState("MID_TERM");
    State termState = new NamedState("SKIP_TERM");

    Condition integerCondition = new IntegerRangeCondition(0,5);
   
    Condition rangeCombineCondition = new DisjoinCondition(
        new RangeCondition(), new RangeStrengthCondition());

//    Condition hyphenatedCondition = new WordSetCondition(iv_hyphenatedSet,
//        false);

    Condition secondMiddleTextCondition = new WordSetCondition(
        iv_middleTermSet, false);

    startState.addTransition(rangeCombineCondition, leftAbbreviateState);
    startState.addTransition(new WordSetCondition(iv_frequencySet,
        false), leftAbbreviateState);
    startState.addTransition(integerCondition, leftAbbreviateState);
    startState.addTransition(new WordSetCondition(iv_hyphenatedSet,
        false), endState);
    startState.addTransition(new AnyCondition(), startState);

    leftAbbreviateState.addTransition(new WordSetCondition(
        iv_middleTermSet, false), middleATextState);
    leftAbbreviateState.addTransition(new NumberCondition(),
        middleATextState);
    leftAbbreviateState.addTransition(new WordSetCondition(iv_frequencySet,
        false), midTermState);
    leftAbbreviateState.addTransition(new WordSetCondition(iv_hyphenatedSet,
        false), endState);
    leftAbbreviateState.addTransition(new FrequencyUnitCondition(),
        ntEndState);
    leftAbbreviateState.addTransition(new AnyCondition(), startState);


    midTermState.addTransition(new WordSetCondition(iv_middleTermSet, false), termState);
    midTermState.addTransition(new AnyCondition(),  startState);
   
    middleATextState
        .addTransition(secondMiddleTextCondition, lastTextState);

    middleATextState
        .addTransition(new FrequencyUnitCondition(), ntEndState);
    middleATextState.addTransition(new RouteCondition(), endState);
    middleATextState.addTransition(new AnyCondition(), startState);
   

    termState
        .addTransition(new FrequencyUnitCondition(), ntFalseTermState);
    termState.addTransition(new RouteCondition(), ntFalseTermState);
    termState.addTransition(new AnyCondition(), startState);


    lastTextState.addTransition(new FrequencyUnitCondition(), ntEndState);
    lastTextState.addTransition(new RouteCondition(), ntEndState);
    lastTextState.addTransition(new AnyCondition(), startState);
View Full Code Here

    iv_machineSet.add(iv_subSectionIDConfirmMachine);

  }

  private Machine getHistorySubSectionMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State medState = new NamedState("MEDHIST");
    State midWordState = new NamedState("MIDDLE");

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

    Machine m = new Machine(startState);

    Condition subFirstBegin = new TextSetCondition(iv_historySubBeginSet,
        false);
    Condition subFirstMid = new TextSetCondition(iv_historySubMidSet,
        false);
    Condition subFirstNext = new TextSetCondition(iv_historySubNextSet,
        false);

    startState.addTransition(subFirstBegin, medState);
      startState.addTransition(new AnyCondition(), startState);
     
    medState.addTransition(subFirstNext, endState);
    medState.addTransition(subFirstMid, midWordState);
    medState.addTransition(new PunctuationValueCondition(':'), endState);
    //medState.addTransition(new PunctuationValueCondition('/'), ntEndState);
    medState.addTransition(new AnyCondition(), startState);
   
    midWordState.addTransition(subFirstNext, endState);
    midWordState.addTransition(new PunctuationValueCondition(':'), endState);
    midWordState.addTransition(new AnyCondition(), startState);
   
    ntEndState.addTransition(new AnyCondition(),  startState);
    endState.addTransition(new AnyCondition(), startState);
    return m;
  }
View Full Code Here

    return outSet;
  }


  private Machine getProbableSubSectionMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State medState = new NamedState("PROBHIST");
 
    State endWordState = new NamedState("ENDWORD");

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

    Machine m = new Machine(startState);

    Condition subFirstBegin = new TextSetCondition(iv_probableSubBeginSet,
        false);
    Condition subFirstNext = new TextSetCondition(iv_probableSubNextSet,
        false);

    startState.addTransition(subFirstBegin, medState);
 
    startState.addTransition(new AnyCondition(), startState);
   
     
    medState.addTransition(subFirstNext, endState);
    medState.addTransition(new TextSetCondition(iv_middleWordSet, false), endWordState);
    medState.addTransition(new AnyCondition(), startState);
   
    endWordState.addTransition(new TextSetCondition(iv_probableSubEndSet, false), endState);
    endWordState.addTransition(new AnyCondition(), startState);
   
    endState.addTransition(new AnyCondition(), startState);
    return m;
  }
View Full Code Here

    endState.addTransition(new AnyCondition(), startState);
    return m;
  }

  private Machine getConfirmSubSectionMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State medState = new NamedState("MEDHIST");
    State firstDotState = new NamedState("FIRSTDOT");
    State rState = new NamedState("RSTATE");
    State secondDotState = new NamedState("SECONDDOT");
    State nState = new NamedState("NSTATE");
    State thirdDotState = new NamedState("THIRDDOT");
 
 
    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);
    Condition subFirstNext = new TextSetCondition(iv_confirmedSubNextSet,
        false);
 
    startState.addTransition(subFirstBegin, medState);
      startState.addTransition(new TextValueCondition("p", false), firstDotState);
      startState.addTransition(new AnyCondition(), startState);
     
      firstDotState.addTransition(new PunctuationValueCondition('.'), rState);
      firstDotState.addTransition(new AnyCondition(), startState);
     
      rState.addTransition(new TextValueCondition("r", false), secondDotState);
      rState.addTransition(new AnyCondition(), startState);
     
      secondDotState.addTransition(new PunctuationValueCondition('.'), nState);
      secondDotState.addTransition(new AnyCondition(), startState);
     
      nState.addTransition(new TextValueCondition("n", false), thirdDotState);
      nState.addTransition(new AnyCondition(), startState);
     
      thirdDotState.addTransition(new PunctuationValueCondition('.'), medState);
      thirdDotState.addTransition(new AnyCondition(), startState);
     
    medState.addTransition(subFirstNext, endState);
    medState.addTransition(new AnyCondition(), startState);
 
    endState.addTransition(new AnyCondition(), startState);
View Full Code Here

   *     <li>15.5 mg</li>
   *     <li>25.7-30.2 mg</li>
   *  </ol>
   */
  private Machine getStrengthMachine(){
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State unitState = new NamedState("UNIT");
    State ntFalseTermState = new IndentStartState("NON TERMINAL START");
    endState.setEndStateFlag(true);
    ntFalseTermState.setEndStateFlag(true);

//    startState.addTransition(new ContainsSetTextValueCondition(
//        iv_fullTextSet, false), endState);
//    startState.addTransition(new WordSetCondition(
//        iv_fullTextSet, false), endState);
   
    startState.addTransition(new WordSetCondition(iv_fullTextSet, false), endState);
    startState.addTransition(new PunctuationValueCondition('-'), unitState);
    startState.addTransition(new SymbolValueCondition('%'), endState);
    startState.addTransition(new AnyCondition(), startState);
   
    unitState.addTransition(new WordSetCondition(iv_fullTextSet, false), ntFalseTermState);
    unitState.addTransition(new SymbolValueCondition('%'), endState);
    unitState.addTransition(new AnyCondition(), startState);

    ntFalseTermState.addTransition(new AnyCondition(), startState);
    endState.addTransition(new AnyCondition(), startState);
    Machine m = new Machine(startState);
    return m;
View Full Code Here

   *      <li>0.4mg</li>
   *     <li>two-3.5mg</li>
   *  </ol>
   */
  private Machine getStrengthCombinedMachine(){
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    State unitState = new NamedState("UNIT");
    State ntFalseTermState = new IndentStartState("NON TERMINAL START");
    endState.setEndStateFlag(true);
    ntFalseTermState.setEndStateFlag(true);

    startState.addTransition(new ContainsSetTextValueCondition(
        iv_fullTextSet, false), endState);
//    startState.addTransition(new WordSetCondition(
//        iv_fullTextSet, false), endState);
//   
//    startState.addTransition(new WordSetCondition(iv_fullTextSet, false), endState);
    startState.addTransition(new PunctuationValueCondition('-'), unitState);
    startState.addTransition(new SymbolValueCondition('%'), endState);
    startState.addTransition(new AnyCondition(), startState);
   
    unitState.addTransition(new ContainsSetTextValueCondition(iv_fullTextSet, false), ntFalseTermState);
    unitState.addTransition(new SymbolValueCondition('%'), endState);
    unitState.addTransition(new AnyCondition(), startState);

    ntFalseTermState.addTransition(new AnyCondition(), startState);
    endState.addTransition(new AnyCondition(), startState);
    Machine m = new Machine(startState);
    return m;
View Full Code Here

     *
     * @return
     */
    private Machine getAspectualNegIndicatorMachine()
    {
        State startState = new NamedState("START");
        State endState = new NamedState("END");
        State anyState = new NamedState("ANY");
        // for case h/o
        State rAbbrState = new NamedState("RULEOUT_ABBR");
        State wAbbrState = new NamedState("WITHOUT_ABBR");
        State fslashState = new NamedState("FORWARD_SLASH");
       
        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");
        State negColMultiPartState = new NamedState("NEG_COLMULTIPART");
        State negColSecondPartState = new NamedState("NEG_COL2NDPART");

        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 neg1of3PartC = new TextSetCondition(iv_negCol1of3PartSet, false);
        Condition neg2of3PartC = new TextSetCondition(iv_negCol2of3PartSet, false);
        Condition notCollocC = new NegateCondition(negCollocC);

        startState.addTransition(negVerbC, negVerbState);
        startState.addTransition(neg1of3PartC, negColMultiPartState);
        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 TextValueCondition("r", false), rAbbrState);
        startState
        .addTransition(new TextValueCondition("w", false), wAbbrState);
        startState.addTransition(new AnyCondition(), startState);
       

        negColMultiPartState.addTransition(neg2of3PartC, negColSecondPartState);
        negColMultiPartState.addTransition(negColPartC, negCollocState);
        negColMultiPartState.addTransition(new AnyCondition(), startState);
       
        negColSecondPartState.addTransition(new TextSetCondition(iv_negColAnyOf3PartSet, false), negCollocState);
        negColSecondPartState.addTransition(negColPartC, negCollocState);
        negColSecondPartState.addTransition(new AnyCondition(), startState);
       
        regModalState.addTransition(negCollocC, negCollocState);
        negCollocState.addTransition(negColPartC, negColPartState); //out
       
        negColPartState.addTransition(new AnyCondition(), ntEndState);
View Full Code Here

TOP

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

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.