Java 类org.apache.lucene.util.automaton.State 实例源码

项目:NYBC    文件:TestDuelingAnalyzers.java   
@Override
public void setUp() throws Exception {
  super.setUp();
  // build an automaton matching this jvm's letter definition
  State initial = new State();
  State accept = new State();
  accept.setAccept(true);
  for (int i = 0; i <= 0x10FFFF; i++) {
    if (Character.isLetter(i)) {
      initial.addTransition(new Transition(i, i, accept));
    }
  }
  Automaton single = new Automaton(initial);
  single.reduce();
  Automaton repeat = BasicOperations.repeat(single);
  jvmLetter = new CharacterRunAutomaton(repeat);
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestDuelingAnalyzers.java   
@Override
public void setUp() throws Exception {
  super.setUp();
  // build an automaton matching this jvm's letter definition
  State initial = new State();
  State accept = new State();
  accept.setAccept(true);
  for (int i = 0; i <= 0x10FFFF; i++) {
    if (Character.isLetter(i)) {
      initial.addTransition(new Transition(i, i, accept));
    }
  }
  Automaton single = new Automaton(initial);
  single.reduce();
  Automaton repeat = BasicOperations.repeat(single);
  jvmLetter = new CharacterRunAutomaton(repeat);
}
项目:NYBC    文件:FSTUtil.java   
/** Sole constructor. */
public Path(State state, FST.Arc<T> fstNode, T output, IntsRef input) {
  this.state = state;
  this.fstNode = fstNode;
  this.output = output;
  this.input = input;
}
项目:NYBC    文件:AnalyzingSuggester.java   
private void copyDestTransitions(State from, State to, List<Transition> transitions) {
  if (to.isAccept()) {
    from.setAccept(true);
  }
  for(Transition t : to.getTransitions()) {
    transitions.add(t);
  }
}
项目:NYBC    文件:TokenStreamToAutomaton.java   
private static void addHoles(State startState, RollingBuffer<Position> positions, int pos) {
  Position posData = positions.get(pos);
  Position prevPosData = positions.get(pos-1);

  while(posData.arriving == null || prevPosData.leaving == null) {
    if (posData.arriving == null) {
      posData.arriving = new State();
      posData.arriving.addTransition(new Transition(POS_SEP, posData.leaving));
    }
    if (prevPosData.leaving == null) {
      if (pos == 1) {
        prevPosData.leaving = startState;
      } else {
        prevPosData.leaving = new State();
      }
      if (prevPosData.arriving != null) {
        prevPosData.arriving.addTransition(new Transition(POS_SEP, prevPosData.leaving));
      }
    }
    prevPosData.leaving.addTransition(new Transition(HOLE, posData.arriving));
    pos--;
    if (pos <= 0) {
      break;
    }
    posData = prevPosData;
    prevPosData = positions.get(pos-1);
  }
}
项目:read-open-source-code    文件:FSTUtil.java   
/** Sole constructor. */
public Path(State state, FST.Arc<T> fstNode, T output, IntsRef input) {
  this.state = state;
  this.fstNode = fstNode;
  this.output = output;
  this.input = input;
}
项目:read-open-source-code    文件:AnalyzingSuggester.java   
private void copyDestTransitions(State from, State to, List<Transition> transitions) {
  if (to.isAccept()) {
    from.setAccept(true);
  }
  for(Transition t : to.getTransitions()) {
    transitions.add(t);
  }
}
项目:read-open-source-code    文件:TokenStreamToAutomaton.java   
private static void addHoles(State startState, RollingBuffer<Position> positions, int pos) {
  Position posData = positions.get(pos);
  Position prevPosData = positions.get(pos-1);

  while(posData.arriving == null || prevPosData.leaving == null) {
    if (posData.arriving == null) {
      posData.arriving = new State();
      posData.arriving.addTransition(new Transition(POS_SEP, posData.leaving));
    }
    if (prevPosData.leaving == null) {
      if (pos == 1) {
        prevPosData.leaving = startState;
      } else {
        prevPosData.leaving = new State();
      }
      if (prevPosData.arriving != null) {
        prevPosData.arriving.addTransition(new Transition(POS_SEP, prevPosData.leaving));
      }
    }
    prevPosData.leaving.addTransition(new Transition(HOLE, posData.arriving));
    pos--;
    if (pos <= 0) {
      break;
    }
    posData = prevPosData;
    prevPosData = positions.get(pos-1);
  }
}
项目:read-open-source-code    文件:FSTUtil.java   
/** Sole constructor. */
public Path(State state, FST.Arc<T> fstNode, T output, IntsRef input) {
  this.state = state;
  this.fstNode = fstNode;
  this.output = output;
  this.input = input;
}
项目:read-open-source-code    文件:AnalyzingSuggester.java   
private void copyDestTransitions(State from, State to, List<Transition> transitions) {
  if (to.isAccept()) {
    from.setAccept(true);
  }
  for(Transition t : to.getTransitions()) {
    transitions.add(t);
  }
}
项目:read-open-source-code    文件:TokenStreamToAutomaton.java   
private static void addHoles(State startState, RollingBuffer<Position> positions, int pos) {
  Position posData = positions.get(pos);
  Position prevPosData = positions.get(pos-1);

  while(posData.arriving == null || prevPosData.leaving == null) {
    if (posData.arriving == null) {
      posData.arriving = new State();
      posData.arriving.addTransition(new Transition(POS_SEP, posData.leaving));
    }
    if (prevPosData.leaving == null) {
      if (pos == 1) {
        prevPosData.leaving = startState;
      } else {
        prevPosData.leaving = new State();
      }
      if (prevPosData.arriving != null) {
        prevPosData.arriving.addTransition(new Transition(POS_SEP, prevPosData.leaving));
      }
    }
    prevPosData.leaving.addTransition(new Transition(HOLE, posData.arriving));
    pos--;
    if (pos <= 0) {
      break;
    }
    posData = prevPosData;
    prevPosData = positions.get(pos-1);
  }
}
项目:Maskana-Gestor-de-Conocimiento    文件:FSTUtil.java   
/** Sole constructor. */
public Path(State state, FST.Arc<T> fstNode, T output, IntsRef input) {
  this.state = state;
  this.fstNode = fstNode;
  this.output = output;
  this.input = input;
}
项目:Maskana-Gestor-de-Conocimiento    文件:AnalyzingSuggester.java   
private void copyDestTransitions(State from, State to, List<Transition> transitions) {
  if (to.isAccept()) {
    from.setAccept(true);
  }
  for(Transition t : to.getTransitions()) {
    transitions.add(t);
  }
}
项目:Maskana-Gestor-de-Conocimiento    文件:TokenStreamToAutomaton.java   
private static void addHoles(State startState, RollingBuffer<Position> positions, int pos) {
  Position posData = positions.get(pos);
  Position prevPosData = positions.get(pos-1);

  while(posData.arriving == null || prevPosData.leaving == null) {
    if (posData.arriving == null) {
      posData.arriving = new State();
      posData.arriving.addTransition(new Transition(POS_SEP, posData.leaving));
    }
    if (prevPosData.leaving == null) {
      if (pos == 1) {
        prevPosData.leaving = startState;
      } else {
        prevPosData.leaving = new State();
      }
      if (prevPosData.arriving != null) {
        prevPosData.arriving.addTransition(new Transition(POS_SEP, prevPosData.leaving));
      }
    }
    prevPosData.leaving.addTransition(new Transition(HOLE, posData.arriving));
    pos--;
    if (pos <= 0) {
      break;
    }
    posData = prevPosData;
    prevPosData = positions.get(pos-1);
  }
}