Package net.openai.util.fsm

Examples of net.openai.util.fsm.State


   * </ol>
   * @return
   */
  private Machine getDashMachine()
  {
      State startState = new NamedState("START");
      State endState = new NamedState("END");
      endState.setEndStateFlag(true);
 
      Machine m = new Machine(startState);
      State leftNumIntegerState = new NamedState("LEFT_NUM_INTEGER");
      State leftNumTextState = new NamedState("LEFT_NUM_TEXT");
      State dashState = new NamedState("DASH1");
      State dash1State = new NamedState("DASH_1");
   
      Condition leftIntCondition = new NumberCondition();
      Condition rightIntCondition = new NumberCondition();
 
      startState.addTransition(leftIntCondition, leftNumIntegerState);
      startState.addTransition(new WordSetCondition(iv_hyphenatedSet, false), endState);
      startState.addTransition(new WordSetCondition(iv_textNumberSet, false), leftNumTextState);
      startState.addTransition(new AnyCondition(), startState);
 
      leftNumIntegerState.addTransition(new PunctuationValueCondition('-'), dashState);
      leftNumIntegerState.addTransition(new AnyCondition(), startState);
 
      leftNumTextState.addTransition(new PunctuationValueCondition('-'), dash1State);
      leftNumTextState.addTransition(new AnyCondition(), startState);
 
      dashState.addTransition(rightIntCondition, endState);
      dashState.addTransition(new WordSetCondition(iv_textNumberSet, false), endState);
 
      dashState.addTransition(new AnyCondition(), startState);
   
      dash1State.addTransition(rightIntCondition, endState);
      dash1State.addTransition(new WordSetCondition(iv_textNumberSet, false), endState);
 
      dash1State.addTransition(new AnyCondition(), startState);
 
      endState.addTransition(new AnyCondition(), startState);
 
      return m;
  }
View Full Code Here


   * @return
   */
  private Machine getDotDashMachine()
 
  {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    endState.setEndStateFlag(true);
 
    Machine m = new Machine(startState);
    State leftNumIntegerState = new NamedState("LEFT_N2_INT");
    State decPartNumState = new NamedState("DECIMAL_NUM");

    State dashState = new NamedState("DASH");
    State dotState = new NamedState("DOT");

    Condition rangeCondition = new RangeCondition();
    Condition leftIntCondition = new NumberCondition();
    Condition decIntCondition = new NumberCondition();
    Condition rightIntCondition = new NumberCondition();

    Condition rightDecimalCondition = new DecimalCondition();
    Condition dashCondition = new PunctuationValueCondition('-');
   
    Condition dotCondition = new PunctuationValueCondition('.');

    Condition rightDoseagesCondition = new FractionStrengthCondition();
 
    startState.addTransition(leftIntCondition, leftNumIntegerState);
    startState.addTransition(rangeCondition, leftNumIntegerState);

 
    startState.addTransition(new AnyCondition(), startState);
   
     
    leftNumIntegerState.addTransition(dotCondition, dotState);
    leftNumIntegerState.addTransition(new AnyCondition(), startState);
 
    dotState.addTransition(decIntCondition, decPartNumState);
    dotState.addTransition(new AnyCondition(), startState);
   
    decPartNumState.addTransition(dashCondition, dashState);
    decPartNumState.addTransition(new AnyCondition(), startState);

 
View Full Code Here

      {
        Machine fsm = (Machine) machineItr.next();

        fsm.input(token);

        State currentState = fsm.getCurrentState();
        if (currentState.getStartStateFlag())
        {
          tokenStartMap.put(fsm, new Integer(i));
        }
        if (currentState.getEndStateFlag())
        {
          Object o = tokenStartMap.get(fsm);
          int tokenStartIndex;
          if (o == null)
          {
View Full Code Here

      while (machineItr.hasNext()) {
        Machine fsm = (Machine) machineItr.next();
 
        fsm.input(token);
 
        State currentState = fsm.getCurrentState();
        if (currentState.getStartStateFlag()) {
          tokenStartMap.put(fsm, new Integer(i));
        }
        if (currentState.getEndStateFlag()) {
          Object o = tokenStartMap.get(fsm);
          int tokenStartIndex;
          if (o == null) {
            // By default, all machines start with
            // token zero.
View Full Code Here

   *     <li>tabs</li>
   * </ol>
   * @return
   */
  private Machine getOralMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    endState.setEndStateFlag(true);
 
    Machine m = new Machine(startState);
 
    State leftAbbreviateState = new NamedState("LEFT_FREQ");
      State leftDosagesState = new NamedState("LEFT_DOSE");
    State lastTextState = new NamedState("RIGHT_FREQ");
    State middleATextState = new NamedState("MID_TEXT");
    State firstDashState = new NamedState("FIRSTDASH");
    State secondDashState = new NamedState("SECONDDASH");
    State leftAbbreviatePState = new NamedState("LEFT_P");
      State rightAbbreviatePOState = new NamedState("RIGHT_PO");
      State firstDotPState = new NamedState("FIRSTDOTP");


      Condition firstPODotCondition = new PunctuationValueCondition('.');
      Condition secondPODotCondition = new PunctuationValueCondition('.');
    Condition firstDashCondition = new PunctuationValueCondition('-');
    Condition secondDashCondition = new PunctuationValueCondition('-');
    Condition rangeCombineCondition = new DisjoinCondition(
    new RangeCondition(),
    new RangeStrengthCondition()
    );
 
 
    Condition initialMiddleTextCondition = new WordSetCondition(
        iv_middleTermSet, true);
    Condition firstMiddleTextCondition = new WordSetCondition(
        iv_middleTermSet, true);
    Condition secondMiddleTextCondition = new WordSetCondition(
        iv_middleTermSet, true);
    Condition thirdMiddleTextCondition = new WordSetCondition(
        iv_middleTermSet, true);
    Condition fourthMiddleTextCondition = new WordSetCondition(
        iv_middleTermSet, true);
   
    Condition soloCondition = new WordSetCondition(iv_singleOralWordSet, true);
    Condition specificWordCondition = new WordSetCondition(
        iv_specifiedOralWordSet, false);
   
 
    startState.addTransition(new TextValueCondition("a", true),
        leftAbbreviateState);
    startState.addTransition(new TextValueCondition("p", true),
        leftAbbreviatePState);
    startState.addTransition(initialMiddleTextCondition, leftAbbreviateState);
    startState.addTransition(rangeCombineCondition, leftDosagesState);
    startState.addTransition(soloCondition, endState);
    startState.addTransition(specificWordCondition, endState);
    startState.addTransition(new AnyCondition(), startState);
   
    leftAbbreviatePState.addTransition(firstPODotCondition, firstDotPState);
    leftAbbreviatePState.addTransition(new AnyCondition(), startState);

    firstDotPState.addTransition(soloCondition, endState);
       
    firstDotPState.addTransition(new TextValueCondition("o", true),
        rightAbbreviatePOState);
    firstDotPState.addTransition(new AnyCondition(), startState);
   
    leftAbbreviateState.addTransition(firstMiddleTextCondition,
        middleATextState);
    leftAbbreviateState.addTransition(firstDashCondition, firstDashState);
    leftAbbreviateState.addTransition(soloCondition, endState);
View Full Code Here

     *
     * @return
     */
    private Machine getFamilyHistoryMachine()
    {
        State startState = new NamedState("START");
        State endState = new NamedState("END");

        // for case h/o
        State familyState = new NamedState("FAMILY");

        endState.setEndStateFlag(true);

        Machine m = new Machine(startState);

        Condition familyHistoryC = new TextSetCondition(
                iv_familyHistorySet,
                false);

        startState.addTransition(familyHistoryC, endState);
        startState.addTransition(
                new TextValueCondition("family", false),
                familyState);
        startState.addTransition(new AnyCondition(), startState);

        familyState.addTransition(
                new TextValueCondition("history", false),
                endState);
        familyState.addTransition(new AnyCondition(), startState);

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

        return m;
    }
View Full Code Here

   *     <li>enema</li>
   * </ol>
   * @return
   */
  private Machine getRectalMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    endState.setEndStateFlag(true);
 
    Machine m = new Machine(startState);
   
    Condition soloCondition = new WordSetCondition(iv_singleRectalWordSet, true);
 
    startState.addTransition(soloCondition, endState);
    startState.addTransition(new AnyCondition(), startState);
 
    endState.addTransition(new AnyCondition(), startState);
 
    return m;
  }
View Full Code Here

            while (machineItr.hasNext())
            {
                Machine m = (Machine) machineItr.next();
                m.input(token);

                State currentState = m.getCurrentState();
                if (currentState.getStartStateFlag())
                {
                    tokenStartMap.put(m, new Integer(i));
                }
                if (currentState.getEndStateFlag())
                {
                    Object o = tokenStartMap.get(m);
                    int tokenStartIndex;
                    if (o == null)
                    {
View Full Code Here

   *     <li>intervenously</li>
   * </ol>
   * @return
   */
  private Machine getInjectionMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    endState.setEndStateFlag(true);
 
    Machine m = new Machine(startState);
   
    Condition soloCondition = new WordSetCondition(iv_singleInjectWordSet, true);
 
    startState.addTransition(soloCondition, endState);
    startState.addTransition(new AnyCondition(), startState);
 
    endState.addTransition(new AnyCondition(), startState);
 
    return m;
  }
View Full Code Here

      while (machineItr.hasNext()) {
        Machine fsm = (Machine) machineItr.next();

        fsm.input(token);

        State currentState = fsm.getCurrentState();
        if (currentState.getStartStateFlag()) {
          tokenStartMap.put(fsm, new Integer(i));
        }
        if (currentState.getEndStateFlag()) {
          Object o = tokenStartMap.get(fsm);
          int tokenStartIndex;
          if (o == null) {
            // By default, all machines start with
            // token zero.
View Full Code Here

TOP

Related Classes of net.openai.util.fsm.State

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.