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

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

本文整理了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

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

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

/**
 * Returns a (deterministic) automaton that accepts the complement of the
 * language of the given automaton.
 * <p>
 * Complexity: linear in number of states if already deterministic and
 *  exponential otherwise.
 * @param maxDeterminizedStates maximum number of states determinizing the
 *  automaton can result in.  Set higher to allow more complex queries and
 *  lower to prevent memory exhaustion.
 */
static public Automaton complement(Automaton a, int maxDeterminizedStates) {
 a = totalize(determinize(a, maxDeterminizedStates));
 int numStates = a.getNumStates();
 for (int p=0;p<numStates;p++) {
  a.setAccept(p, !a.isAccept(p));
 }
 return removeDeadStates(a);
}

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

return Operations.removeDeadStates(result);

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

return removeDeadStates(c);

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

/**
 * Returns an automaton that accepts the union of the languages of the given
 * automata.
 * <p>
 * Complexity: linear in number of states.
 */
public static Automaton union(Collection<Automaton> l) {
 Automaton result = new Automaton();
 // Create initial state:
 result.createState();
 // Copy over all automata
 for(Automaton a : l) {
  result.copy(a);
 }
 
 // Add epsilon transition from new initial state
 int stateOffset = 1;
 for(Automaton a : l) {
  if (a.getNumStates() == 0) {
   continue;
  }
  result.addEpsilon(0, stateOffset);
  stateOffset += a.getNumStates();
 }
 result.finishState();
 return removeDeadStates(result);
}

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

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

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

/**
 * Returns a (deterministic) automaton that accepts the complement of the
 * language of the given automaton.
 * <p>
 * Complexity: linear in number of states if already deterministic and
 *  exponential otherwise.
 * @param maxDeterminizedStates maximum number of states determinizing the
 *  automaton can result in.  Set higher to allow more complex queries and
 *  lower to prevent memory exhaustion.
 */
static public Automaton complement(Automaton a, int maxDeterminizedStates) {
 a = totalize(determinize(a, maxDeterminizedStates));
 int numStates = a.getNumStates();
 for (int p=0;p<numStates;p++) {
  a.setAccept(p, !a.isAccept(p));
 }
 return removeDeadStates(a);
}

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

/**
 * Returns a (deterministic) automaton that accepts the complement of the
 * language of the given automaton.
 * <p>
 * Complexity: linear in number of states if already deterministic and
 *  exponential otherwise.
 * @param maxDeterminizedStates maximum number of states determinizing the
 *  automaton can result in.  Set higher to allow more complex queries and
 *  lower to prevent memory exhaustion.
 */
static public Automaton complement(Automaton a, int maxDeterminizedStates) {
 a = totalize(determinize(a, maxDeterminizedStates));
 int numStates = a.getNumStates();
 for (int p=0;p<numStates;p++) {
  a.setAccept(p, !a.isAccept(p));
 }
 return removeDeadStates(a);
}

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

return removeDeadStates(c);

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

return removeDeadStates(c);

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

/**
 * Returns a (deterministic) automaton that accepts the complement of the
 * language of the given automaton.
 * <p>
 * Complexity: linear in number of states if already deterministic and
 *  exponential otherwise.
 * @param maxDeterminizedStates maximum number of states determinizing the
 *  automaton can result in.  Set higher to allow more complex queries and
 *  lower to prevent memory exhaustion.
 */
static public Automaton complement(Automaton a, int maxDeterminizedStates) {
 a = totalize(determinize(a, maxDeterminizedStates));
 int numStates = a.getNumStates();
 for (int p=0;p<numStates;p++) {
  a.setAccept(p, !a.isAccept(p));
 }
 return removeDeadStates(a);
}

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

return Operations.removeDeadStates(result);

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

return Operations.removeDeadStates(result);

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

return Operations.removeDeadStates(result);

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

return removeDeadStates(c);

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

/**
 * Returns an automaton that accepts the union of the languages of the given
 * automata.
 * <p>
 * Complexity: linear in number of states.
 */
public static Automaton union(Collection<Automaton> l) {
 Automaton result = new Automaton();
 // Create initial state:
 result.createState();
 // Copy over all automata
 for(Automaton a : l) {
  result.copy(a);
 }
 
 // Add epsilon transition from new initial state
 int stateOffset = 1;
 for(Automaton a : l) {
  if (a.getNumStates() == 0) {
   continue;
  }
  result.addEpsilon(0, stateOffset);
  stateOffset += a.getNumStates();
 }
 result.finishState();
 return removeDeadStates(result);
}

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

/**
 * Returns an automaton that accepts the union of the languages of the given
 * automata.
 * <p>
 * Complexity: linear in number of states.
 */
public static Automaton union(Collection<Automaton> l) {
 Automaton result = new Automaton();
 // Create initial state:
 result.createState();
 // Copy over all automata
 for(Automaton a : l) {
  result.copy(a);
 }
 
 // Add epsilon transition from new initial state
 int stateOffset = 1;
 for(Automaton a : l) {
  if (a.getNumStates() == 0) {
   continue;
  }
  result.addEpsilon(0, stateOffset);
  stateOffset += a.getNumStates();
 }
 result.finishState();
 return removeDeadStates(result);
}

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

/**
 * Returns an automaton that accepts the union of the languages of the given
 * automata.
 * <p>
 * Complexity: linear in number of states.
 */
public static Automaton union(Collection<Automaton> l) {
 Automaton result = new Automaton();
 // Create initial state:
 result.createState();
 // Copy over all automata
 for(Automaton a : l) {
  result.copy(a);
 }
 
 // Add epsilon transition from new initial state
 int stateOffset = 1;
 for(Automaton a : l) {
  if (a.getNumStates() == 0) {
   continue;
  }
  result.addEpsilon(0, stateOffset);
  stateOffset += a.getNumStates();
 }
 result.finishState();
 return removeDeadStates(result);
}

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

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

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

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

相关文章