Package net.openai.util.fsm

Examples of net.openai.util.fsm.Machine


  private Machine getPatchesMachine() {
    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");
View Full Code Here


  private Machine getGastricMachine() {
    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");
View Full Code Here

  private Machine getTopicalMachine() {
    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");
View Full Code Here

  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");
View Full Code Here

  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);
View Full Code Here

  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);
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));
        }
        if (currentState.getEndStateFlag()) {
          Object o = tokenStartMap.get(fsm);
          int tokenStartIndex;
          if (o == null) {
            // By default, all machines start with
            // token zero.
            tokenStartIndex = 0;
          } else {
            tokenStartIndex = ((Integer) o).intValue();
            // skip ahead over single token we don't want
            tokenStartIndex++;
          }
          BaseToken startToken = (BaseToken) tokens
              .get(tokenStartIndex);
          BaseToken endToken = token;
          RouteToken segmentToken = null;
         
          if (fsm.equals(iv_PatchesMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.TRANSDERMAL);
          }
          else if (fsm.equals(iv_GastricMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.GASTRIC);
          }
          else if (fsm.equals(iv_TopicalMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.TOPICAL);
          }
          else if (fsm.equals(iv_OralMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.ORAL);
          }
          else if (fsm.equals(iv_RectalMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.RECTAL);
          }
          else if (fsm.equals(iv_InjectMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.INTRAVENOUS);
          }
          rangeSet.add(segmentToken);
          fsm.reset();
        }
      }
    }

    // cleanup
    tokenStartMap.clear();

    // reset machines
    Iterator itr = iv_machineSet.iterator();
    while (itr.hasNext()) {
      Machine fsm = (Machine) itr.next();
      fsm.reset();
    }

    return rangeSet;
  }
View Full Code Here

    for (int i = 0; i < tokens.size(); i++) {
      BaseToken token = (BaseToken) tokens.get(i);

      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));
        }
        if (currentState.getEndStateFlag()) {
          Object o = tokenStartMap.get(fsm);
          int tokenStartIndex;
          if (o == null) {
            // By default, all machines start with
            // token zero.
            tokenStartIndex = 0;
          } else {
            tokenStartIndex = ((Integer) o).intValue();
            // skip ahead over single token we don't want
            tokenStartIndex++;
          }
          BaseToken startToken = (BaseToken) tokens
              .get(tokenStartIndex);
          BaseToken endToken = token;
          RouteToken segmentToken = null;
         
          if (fsm.equals(iv_PatchesMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.TRANSDERMAL);
          }
          else if (fsm.equals(iv_GastricMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.GASTRIC);
          }
          else if (fsm.equals(iv_TopicalMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.TOPICAL);
          }
          else if (fsm.equals(iv_OralMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.ORAL);
          }
          else if (fsm.equals(iv_RectalMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.RECTAL);
          }
          else if (fsm.equals(iv_InjectMachine)){
            segmentToken = new RouteToken(
                startToken.getStartOffset(), endToken
                    .getEndOffset());
            segmentToken.setFormMethod(RouteToken.INTRAVENOUS);
          }
         
          fractionSet.add(segmentToken);
          fsm.reset();
        }
      }
    }

    // cleanup
    tokenStartMap.clear();

    // reset machines
    Iterator itr = iv_machineSet.iterator();
    while (itr.hasNext()) {
      Machine fsm = (Machine) itr.next();
      fsm.reset();
    }

    return fractionSet;
  }
View Full Code Here

      State endState = new NamedState("END");
      State dualState = new NamedState("DUALSTATE");

      endState.setEndStateFlag(true);
 
      Machine m = new Machine(startState);
 
      Condition probableC = new TextSetCondition(iv_probableSet, false);
    
 
      startState.addTransition(probableC, endState);
View Full Code Here

        ntEndState.setEndStateFlag(true);
        // for case h/o
        State hAbbrState = new NamedState("HISTORY_ABBR");
        State oAbbrState = new NamedState("OF_ABBR");
       
        Machine m = new Machine(startState);
        State fslashState = new NamedState("FORWARD_SLASH");
        State probCollocState = new NamedState("PROB_COLLOC");
        State probFamilyPartState = new NamedState("PROB_FAMC");
        State probColPartState = new NamedState("PROB_COLPART");
       // Condition probableFHC = new TextValueCondition("family", false);
View Full Code Here

TOP

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

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.