Package net.openai.util.fsm

Examples of net.openai.util.fsm.State


     *
     * @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


        return m;
    }

    private Machine getNominalNegIndicatorMachine()
  {
      State startState = new NamedState("START");
      State endState = new NamedState("END");
      State anyState = new NamedState("ANY");
      State ntEndState = new NonTerminalEndState("NON TERMINAL END");
      endState.setEndStateFlag(true);
      ntEndState.setEndStateFlag(true);
 
      Machine m = new Machine(startState);
      State negPrepState = new NamedState("NEG_PREP");
      State negDetState = new NamedState("NEG_DET");
      State regNounState = new NamedState("REG_NOUN");
      Condition negPrepC = new TextSetCondition(iv_negPrepositionsSet, false);
      Condition negDetC = new TextSetCondition(iv_negDeterminersSet, false);
      Condition regNounC = new TextSetCondition(iv_regNounsSet, false);
 
      startState.addTransition(negDetC, negDetState); // start with a modal
   
      startState.addTransition(negPrepC, negPrepState);
      startState.addTransition(new AnyCondition(), startState);
 
      negPrepState.addTransition(new AnyCondition(), ntEndState);
      negDetState.addTransition(regNounC, regNounState);
      negDetState.addTransition(new AnyCondition(), ntEndState);
      negDetState.addTransition(new AnyCondition(), anyState);
 
      anyState.addTransition(regNounC, regNounState);
      anyState.addTransition(new AnyCondition(), anyState);
 
      regNounState.addTransition(new AnyCondition(), ntEndState);
 
      ntEndState.addTransition(new AnyCondition(), startState);
 
      return m;
  }
View Full Code Here

      return m;
  }

  private Machine getInitialNegIndicatorMachine()
    {
        State startState = new NamedState("START");
        State endState = new NamedState("END");

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

        Machine m = new Machine(startState);
      
        State negDetState = new NamedState("NEG_DET");

        Condition negInitDetC = new TextSetCondition(iv_negInitialDeterminersSet, true);

        startState.addTransition(negInitDetC, negDetState); // start with a modal
        startState.addTransition(new AnyCondition(), startState);

        negDetState.addTransition(new AnyCondition(), endState);
        endState.addTransition(new AnyCondition(), startState);
        return m;
    }
View Full Code Here

        return m;
    }

    private Machine getAdjNegIndicatorMachine()
    {
        State startState = new NamedState("START");
        State endState = new NamedState("END");
        State ntEndState = new NonTerminalEndState("NON TERMINAL END");
        endState.setEndStateFlag(true);
        ntEndState.setEndStateFlag(true);

        Machine m = new Machine(startState);
        State regPrepState = new NamedState("REG_PREP");
        State negAdjState = new NamedState("NEG_ADJ");

        Condition regPrepC = new TextSetCondition(iv_regPrepositionsSet, false);
        Condition negAdjC = new TextSetCondition(iv_negAdjectivesSet, false);

        startState.addTransition(negAdjC, negAdjState); // start with a modal
        startState.addTransition(new AnyCondition(), startState);

        negAdjState.addTransition(regPrepC, regPrepState);
        regPrepState.addTransition(new AnyCondition(), ntEndState);
        negAdjState.addTransition(new AnyCondition(), startState);

        ntEndState.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 getDashMachine() {
    State startState = new NamedState("START");
    State endState = new NamedState("END");
    endState.setEndStateFlag(true);

    Machine m = new Machine(startState);

    State hyphenatedDrugState = new NamedState("HYPH_DRUG");
    Condition hyphenatedDrugCondition = new WordSetCondition(
        iv_hyphenDrugSet, false);

    startState.addTransition(hyphenatedDrugCondition, endState);//hyphenatedDrugState);
    startState.addTransition(new AnyCondition(), startState);

    hyphenatedDrugState.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

    }

    private Machine getInitialNegIndicatorMachine()
    {
        State startState = new NamedState("START");
        State endState = new NamedState("END");

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

        Machine m = new Machine(startState);
      
        State negDetState = new NamedState("NEG_DET");
        Condition negInitDetC = new TextSetCondition(iv_negInitialDeterminersSet, true);
        startState.addTransition(negInitDetC, negDetState); // start with a modal
       
        startState.addTransition(new AnyCondition(), startState);

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

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

        return m;
    }

    private Machine getAdjNegIndicatorMachine()
    {
        State startState = new NamedState("START");
        State endState = new NamedState("END");
           endState.setEndStateFlag(true);
       

        Machine m = new Machine(startState);

     
        State negAdjState = new NamedState("NEG_ADJ");


        Condition negDetC = new TextSetCondition(iv_negDeterminersSet, false);

        startState.addTransition(negDetC, negAdjState);
        startState.addTransition(new AnyCondition(), startState);
       
        negAdjState.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

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.