Package net.openai.util.fsm

Examples of net.openai.util.fsm.State


      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


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

        fsm.input(token);
        State currentState = fsm.getCurrentState();
        if (currentState.getStartStateFlag()) {
          tokenStartMap.put(fsm, new Integer(i));
          tokenOffset1 = 0;
          tokenOffset2 = 0;
        }
        if (currentState.getEndStateFlag()) {
          Object o = tokenStartMap.get(fsm);
          int tokenStartIndex;
          int globalOffset = 0;
          if (o == null) {
            // By default, all machines start with
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

      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

    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);
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);
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

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

        fsm.input(token);

        State currentState = fsm.getCurrentState();
        if (currentState.getStartStateFlag()) {
          tokenStartMap.put(fsm, new Integer(i));
          tokenOffset1 = 0;
          tokenOffset2 = 0;
        }
        if (currentState.getEndStateFlag()) {
          Object o = tokenStartMap.get(fsm);
          int tokenStartIndex;
          int globalOffset = 0;
          if (o == null) {
            // By default, all machines start with
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));
          tokenOffset = 0;
        }
        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.