Package net.openai.util.fsm

Examples of net.openai.util.fsm.State


      while (machineItr.hasNext()) {
        Machine fsm = 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
     */
    private Machine getBreastDxMachine()
    {
        State startState = new NamedState("START");
        State endState = new NamedState("END");

        endState.setEndStateFlag(true);

        Machine m = new Machine(startState);

        Condition breastDxC = new TextSetCondition(iv_breastDxSet, false);

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

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

        return m;
    }
View Full Code Here

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


  
        endState.setEndStateFlag(true);

        Machine m = new Machine(startState);

        Condition brainDxC = new TextSetCondition(iv_brainDxSet, false);

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

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

        return m;
    }
View Full Code Here

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

        endState.setEndStateFlag(true);

        Machine m = new Machine(startState);

        Condition colonDxC = new TextSetCondition(
                iv_colonDxSet,
                false);

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


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

        return m;
    }
View Full Code Here

     *
     * @return
     */
    private Machine getPADDxMachine()
    {
        State startState = new NamedState("START");
        State endState = new NamedState("END");
        State padHyphenBeginState = new NamedState("HYPHENB");
        State padHyphenEndState = new NamedState("HYPHENE");
        State pad2of2NegConfirmState = new NamedState("TWOOFTWONEG");
        State pad2of2State = new NamedState("TWOOFTWO");
        State pad2of3State = new NamedState("TWOOFTHREE");
        State pad3of3State = new NamedState("THREEOFTHREE");
       
        endState.setEndStateFlag(true);

        Machine m = new Machine(startState);

        Condition padDxC = new TextSetCondition(iv_padDxSet, false);
        Condition padDxHyphenBeginC = new TextSetCondition(iv_padDxHyphenBeginSet, false);
        Condition padDxHyphenEndC = new TextSetCondition(iv_padDxHyphenEndSet, false);
        Condition pad1of2DxC = new TextSetCondition(iv_padOneOfTwoDxSet, false);
        Condition pad2of2DxC = new TextSetCondition(iv_padTwoOfTwoDxSet, false);
        Condition pad1of3DxC = new TextSetCondition(iv_padOneOfThreeDxSet, false);
        Condition pad2of3DxC = new TextSetCondition(iv_padTwoOfThreeDxSet, false);
        Condition pad3of3DxC = new TextSetCondition(iv_padThreeOfThreeDxSet, false);

        Condition padNegConfirm1Of2DxC = new TextSetCondition(iv_padOneOfTwoNegConfirmDxSet, false);
        Condition padNegConfirm2Of2DxC = new TextSetCondition(iv_padTwoOfTwoNegConfirmDxSet, false);
       
        startState.addTransition(padDxC, endState);
        startState.addTransition(padNegConfirm1Of2DxC, pad2of2NegConfirmState);
        startState.addTransition(pad1of2DxC, pad2of2State);
        startState.addTransition(pad1of3DxC, pad2of3State);
        startState.addTransition(padDxHyphenBeginC, padHyphenBeginState);
        startState.addTransition(new AnyCondition(), startState);

        pad2of2NegConfirmState.addTransition(padNegConfirm2Of2DxC, endState);
        pad2of2NegConfirmState.addTransition(new AnyCondition(), startState);
       
        pad2of2State.addTransition(pad2of2DxC, endState);
        pad2of2State.addTransition(new AnyCondition(), startState);
       
        pad2of3State.addTransition(pad2of3DxC, pad3of3State);
        pad2of3State.addTransition(new AnyCondition(), startState);
       
        pad3of3State.addTransition(pad3of3DxC, endState);
        pad3of3State.addTransition(new AnyCondition(), startState);
       
        padHyphenBeginState.addTransition(new PunctuationValueCondition('-'), padHyphenEndState);
        padHyphenBeginState.addTransition(new AnyCondition(), startState);
       
        padHyphenEndState.addTransition(padDxHyphenEndC, endState);
View Full Code Here

            {
                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

    }

    private Machine getInitialNegIndicatorMachine()
    {
        State startState = new NamedState("START");
        State endState = new NamedState("END");
        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

            {
                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

     * </ol>
     * @return
     */
    private Machine getDecimalStrengthMachine()
    {
        State startState = new NamedState("START");
        State endState = new NamedState("END");
        endState.setEndStateFlag(true);

        Machine m = new Machine(startState);
        State zeroNumState = new NamedState("ZERO_NUM");
        State fractionTextState = new NamedState("NUMERATOR_TEXT");
        State dashState = new NamedState("DASH");
        startState.addTransition(new IntegerValueCondition(0), zeroNumState);
        startState.addTransition(new AnyCondition(), startState);

        zeroNumState.addTransition(new PunctuationValueCondition('.'), fractionTextState);
    zeroNumState.addTransition(new AnyCondition(), startState);

    fractionTextState.addTransition(new NumberCondition(), dashState);
    fractionTextState.addTransition(new AnyCondition(), startState);
   
    dashState.addTransition(new PunctuationValueCondition('-'), endState);
    dashState.addTransition(new AnyCondition(), startState);
   
        endState.addTransition(new AnyCondition(), startState);

        return m;
    }
View Full Code Here

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

                fsm.input(token);

                State currentState = fsm.getCurrentState();
                if (currentState.getStartStateFlag())
                {
                    tokenStartMap.put(fsm, Integer.valueOf(i));
                }
                if (currentState.getEndStateFlag())
                {
                    Object o = tokenStartMap.get(fsm);
          int tokenStartIndex;
          if (o == null)
          {
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.