org.apache.lucene.util.automaton.Operations.removeDeadStates()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.lucene.util.automaton.Operations.removeDeadStates()方法的一些代码示例,展示了Operations.removeDeadStates()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operations.removeDeadStates()方法的具体详情如下:
包路径:org.apache.lucene.util.automaton.Operations
类名称:Operations
方法名:removeDeadStates

Operations.removeDeadStates介绍

[英]Removes transitions to dead states (a state is "dead" if it is not reachable from the initial state or no accept state is reachable from it.)
[中]移除到死状态的转换(如果从初始状态无法访问某个状态,或者从该状态无法访问任何接受状态,则该状态为“死”)

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

  1. public GraphTokenStreamFiniteStrings(TokenStream in) throws IOException {
  2. Automaton aut = build(in);
  3. this.det = Operations.removeDeadStates(Operations.determinize(aut, DEFAULT_MAX_DETERMINIZED_STATES));
  4. }

代码示例来源:origin: org.apache.lucene/lucene-core

  1. /**
  2. * Returns a (deterministic) automaton that accepts the complement of the
  3. * language of the given automaton.
  4. * <p>
  5. * Complexity: linear in number of states if already deterministic and
  6. * exponential otherwise.
  7. * @param maxDeterminizedStates maximum number of states determinizing the
  8. * automaton can result in. Set higher to allow more complex queries and
  9. * lower to prevent memory exhaustion.
  10. */
  11. static public Automaton complement(Automaton a, int maxDeterminizedStates) {
  12. a = totalize(determinize(a, maxDeterminizedStates));
  13. int numStates = a.getNumStates();
  14. for (int p=0;p<numStates;p++) {
  15. a.setAccept(p, !a.isAccept(p));
  16. }
  17. return removeDeadStates(a);
  18. }

代码示例来源:origin: org.apache.lucene/lucene-core

  1. return Operations.removeDeadStates(result);

代码示例来源:origin: org.apache.lucene/lucene-core

  1. return removeDeadStates(c);

代码示例来源:origin: org.apache.lucene/lucene-core

  1. /**
  2. * Returns an automaton that accepts the union of the languages of the given
  3. * automata.
  4. * <p>
  5. * Complexity: linear in number of states.
  6. */
  7. public static Automaton union(Collection<Automaton> l) {
  8. Automaton result = new Automaton();
  9. // Create initial state:
  10. result.createState();
  11. // Copy over all automata
  12. for(Automaton a : l) {
  13. result.copy(a);
  14. }
  15. // Add epsilon transition from new initial state
  16. int stateOffset = 1;
  17. for(Automaton a : l) {
  18. if (a.getNumStates() == 0) {
  19. continue;
  20. }
  21. result.addEpsilon(0, stateOffset);
  22. stateOffset += a.getNumStates();
  23. }
  24. result.finishState();
  25. return removeDeadStates(result);
  26. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

  1. public GraphTokenStreamFiniteStrings(TokenStream in) throws IOException {
  2. Automaton aut = build(in);
  3. this.det = Operations.removeDeadStates(Operations.determinize(aut, DEFAULT_MAX_DETERMINIZED_STATES));
  4. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

  1. /**
  2. * Returns a (deterministic) automaton that accepts the complement of the
  3. * language of the given automaton.
  4. * <p>
  5. * Complexity: linear in number of states if already deterministic and
  6. * exponential otherwise.
  7. * @param maxDeterminizedStates maximum number of states determinizing the
  8. * automaton can result in. Set higher to allow more complex queries and
  9. * lower to prevent memory exhaustion.
  10. */
  11. static public Automaton complement(Automaton a, int maxDeterminizedStates) {
  12. a = totalize(determinize(a, maxDeterminizedStates));
  13. int numStates = a.getNumStates();
  14. for (int p=0;p<numStates;p++) {
  15. a.setAccept(p, !a.isAccept(p));
  16. }
  17. return removeDeadStates(a);
  18. }

代码示例来源:origin: org.infinispan/infinispan-embedded-query

  1. /**
  2. * Returns a (deterministic) automaton that accepts the complement of the
  3. * language of the given automaton.
  4. * <p>
  5. * Complexity: linear in number of states if already deterministic and
  6. * exponential otherwise.
  7. * @param maxDeterminizedStates maximum number of states determinizing the
  8. * automaton can result in. Set higher to allow more complex queries and
  9. * lower to prevent memory exhaustion.
  10. */
  11. static public Automaton complement(Automaton a, int maxDeterminizedStates) {
  12. a = totalize(determinize(a, maxDeterminizedStates));
  13. int numStates = a.getNumStates();
  14. for (int p=0;p<numStates;p++) {
  15. a.setAccept(p, !a.isAccept(p));
  16. }
  17. return removeDeadStates(a);
  18. }

代码示例来源:origin: harbby/presto-connectors

  1. return removeDeadStates(c);

代码示例来源:origin: org.infinispan/infinispan-embedded-query

  1. return removeDeadStates(c);

代码示例来源:origin: harbby/presto-connectors

  1. /**
  2. * Returns a (deterministic) automaton that accepts the complement of the
  3. * language of the given automaton.
  4. * <p>
  5. * Complexity: linear in number of states if already deterministic and
  6. * exponential otherwise.
  7. * @param maxDeterminizedStates maximum number of states determinizing the
  8. * automaton can result in. Set higher to allow more complex queries and
  9. * lower to prevent memory exhaustion.
  10. */
  11. static public Automaton complement(Automaton a, int maxDeterminizedStates) {
  12. a = totalize(determinize(a, maxDeterminizedStates));
  13. int numStates = a.getNumStates();
  14. for (int p=0;p<numStates;p++) {
  15. a.setAccept(p, !a.isAccept(p));
  16. }
  17. return removeDeadStates(a);
  18. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

  1. return Operations.removeDeadStates(result);

代码示例来源:origin: org.infinispan/infinispan-embedded-query

  1. return Operations.removeDeadStates(result);

代码示例来源:origin: harbby/presto-connectors

  1. return Operations.removeDeadStates(result);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

  1. return removeDeadStates(c);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

  1. /**
  2. * Returns an automaton that accepts the union of the languages of the given
  3. * automata.
  4. * <p>
  5. * Complexity: linear in number of states.
  6. */
  7. public static Automaton union(Collection<Automaton> l) {
  8. Automaton result = new Automaton();
  9. // Create initial state:
  10. result.createState();
  11. // Copy over all automata
  12. for(Automaton a : l) {
  13. result.copy(a);
  14. }
  15. // Add epsilon transition from new initial state
  16. int stateOffset = 1;
  17. for(Automaton a : l) {
  18. if (a.getNumStates() == 0) {
  19. continue;
  20. }
  21. result.addEpsilon(0, stateOffset);
  22. stateOffset += a.getNumStates();
  23. }
  24. result.finishState();
  25. return removeDeadStates(result);
  26. }

代码示例来源:origin: org.infinispan/infinispan-embedded-query

  1. /**
  2. * Returns an automaton that accepts the union of the languages of the given
  3. * automata.
  4. * <p>
  5. * Complexity: linear in number of states.
  6. */
  7. public static Automaton union(Collection<Automaton> l) {
  8. Automaton result = new Automaton();
  9. // Create initial state:
  10. result.createState();
  11. // Copy over all automata
  12. for(Automaton a : l) {
  13. result.copy(a);
  14. }
  15. // Add epsilon transition from new initial state
  16. int stateOffset = 1;
  17. for(Automaton a : l) {
  18. if (a.getNumStates() == 0) {
  19. continue;
  20. }
  21. result.addEpsilon(0, stateOffset);
  22. stateOffset += a.getNumStates();
  23. }
  24. result.finishState();
  25. return removeDeadStates(result);
  26. }

代码示例来源:origin: harbby/presto-connectors

  1. /**
  2. * Returns an automaton that accepts the union of the languages of the given
  3. * automata.
  4. * <p>
  5. * Complexity: linear in number of states.
  6. */
  7. public static Automaton union(Collection<Automaton> l) {
  8. Automaton result = new Automaton();
  9. // Create initial state:
  10. result.createState();
  11. // Copy over all automata
  12. for(Automaton a : l) {
  13. result.copy(a);
  14. }
  15. // Add epsilon transition from new initial state
  16. int stateOffset = 1;
  17. for(Automaton a : l) {
  18. if (a.getNumStates() == 0) {
  19. continue;
  20. }
  21. result.addEpsilon(0, stateOffset);
  22. stateOffset += a.getNumStates();
  23. }
  24. result.finishState();
  25. return removeDeadStates(result);
  26. }

代码示例来源:origin: org.apache.lucene/lucene-sandbox

  1. det = Operations.removeDeadStates(Operations.determinize(automaton,
  2. maxDeterminizedStates));

代码示例来源:origin: harbby/presto-connectors

  1. det = Operations.removeDeadStates(Operations.determinize(automaton,
  2. maxDeterminizedStates));

相关文章