/** * Constructs new <code>Automaton</code> from this <code>RegExp</code>. Same * as <code>toAutomaton(null)</code> (empty automaton map). */ public Automaton toAutomaton() { return toAutomaton(null, null, Operations.DEFAULT_MAX_DETERMINIZED_STATES); }
private Automaton toAutomaton(Map<String,Automaton> automata, AutomatonProvider automaton_provider, int maxDeterminizedStates) throws IllegalArgumentException, TooComplexToDeterminizeException { try { return toAutomatonInternal(automata, automaton_provider, maxDeterminizedStates); } catch (TooComplexToDeterminizeException e) { throw new TooComplexToDeterminizeException(this, e); } }
/** * Constructs new <code>Automaton</code> from this <code>RegExp</code>. The * constructed automaton is minimal and deterministic and has no transitions * to dead states. * * @param maxDeterminizedStates maximum number of states in the resulting * automata. If the automata would need more than this many states * TooComplextToDeterminizeException is thrown. Higher number require more * space but can process more complex regexes. * @exception IllegalArgumentException if this regular expression uses a named * identifier that is not available from the automaton provider * @exception TooComplexToDeterminizeException if determinizing this regexp * requires more than maxDeterminizedStates states */ public Automaton toAutomaton(int maxDeterminizedStates) throws IllegalArgumentException, TooComplexToDeterminizeException { return toAutomaton(null, null, maxDeterminizedStates); }
private Automaton toAutomaton(Map<String,Automaton> automata, AutomatonProvider automaton_provider, int maxDeterminizedStates) throws IllegalArgumentException, TooComplexToDeterminizeException { try { return toAutomatonInternal(automata, automaton_provider, maxDeterminizedStates); } catch (TooComplexToDeterminizeException e) { throw new TooComplexToDeterminizeException(this, e); } }
/** * Constructs new <code>Automaton</code> from this <code>RegExp</code>. The * constructed automaton is minimal and deterministic and has no transitions * to dead states. * * @param automaton_provider provider of automata for named identifiers * @param maxDeterminizedStates maximum number of states in the resulting * automata. If the automata would need more than this many states * TooComplextToDeterminizeException is thrown. Higher number require more * space but can process more complex regexes. * @exception IllegalArgumentException if this regular expression uses a named * identifier that is not available from the automaton provider * @exception TooComplexToDeterminizeException if determinizing this regexp * requires more than maxDeterminizedStates states */ public Automaton toAutomaton(AutomatonProvider automaton_provider, int maxDeterminizedStates) throws IllegalArgumentException, TooComplexToDeterminizeException { return toAutomaton(null, automaton_provider, maxDeterminizedStates); }
private Automaton toAutomaton(Map<String,Automaton> automata, AutomatonProvider automaton_provider, int maxDeterminizedStates) throws IllegalArgumentException, TooComplexToDeterminizeException { try { return toAutomatonInternal(automata, automaton_provider, maxDeterminizedStates); } catch (TooComplexToDeterminizeException e) { throw new TooComplexToDeterminizeException(this, e); } }
/** * Constructs a query for terms matching <code>term</code>. * * @param term regular expression. * @param flags optional RegExp features from {@link RegExp} * @param provider custom AutomatonProvider for named automata * @param maxDeterminizedStates maximum number of states that compiling the * automaton for the regexp can result in. Set higher to allow more complex * queries and lower to prevent memory exhaustion. */ public RegexpQuery(Term term, int flags, AutomatonProvider provider, int maxDeterminizedStates) { super(term, new RegExp(term.text(), flags).toAutomaton( provider, maxDeterminizedStates), maxDeterminizedStates); }
/** See {@link RegExp} for the accepted syntax. */ public SimplePatternSplitTokenizer(AttributeFactory factory, String regexp, int maxDeterminizedStates) { this(factory, new RegExp(regexp).toAutomaton()); }
/** See {@link RegExp} for the accepted syntax. */ public SimplePatternTokenizer(AttributeFactory factory, String regexp, int maxDeterminizedStates) { this(factory, new RegExp(regexp).toAutomaton()); }
/** Creates a new SimpleSplitPatternTokenizerFactory */ public SimplePatternSplitTokenizerFactory(Map<String,String> args) { super(args); maxDeterminizedStates = getInt(args, "maxDeterminizedStates", Operations.DEFAULT_MAX_DETERMINIZED_STATES); dfa = Operations.determinize(new RegExp(require(args, PATTERN)).toAutomaton(), maxDeterminizedStates); if (args.isEmpty() == false) { throw new IllegalArgumentException("Unknown parameters: " + args); } }
/** Creates a new SimplePatternTokenizerFactory */ public SimplePatternTokenizerFactory(Map<String,String> args) { super(args); maxDeterminizedStates = getInt(args, "maxDeterminizedStates", Operations.DEFAULT_MAX_DETERMINIZED_STATES); dfa = Operations.determinize(new RegExp(require(args, PATTERN)).toAutomaton(), maxDeterminizedStates); if (args.isEmpty() == false) { throw new IllegalArgumentException("Unknown parameters: " + args); } }
private Automaton toAutomaton() { Automaton a = null; if (include != null) { a = include.toAutomaton(); } else if (includeValues != null) { a = Automata.makeStringUnion(includeValues); } else { a = Automata.makeAnyString(); } if (exclude != null) { a = Operations.minus(a, exclude.toAutomaton(), Operations.DEFAULT_MAX_DETERMINIZED_STATES); } else if (excludeValues != null) { a = Operations.minus(a, Automata.makeStringUnion(excludeValues), Operations.DEFAULT_MAX_DETERMINIZED_STATES); } return a; }
CharacterRunAutomaton pattern = new CharacterRunAutomaton(new RegExp(regex, RegExp.NONE).toAutomaton()); patterns.add(pattern);
/** * Constructs new <code>Automaton</code> from this <code>RegExp</code>. Same * as <code>toAutomaton(null)</code> (empty automaton map). */ public Automaton toAutomaton() { return toAutomaton(null, null, Operations.DEFAULT_MAX_DETERMINIZED_STATES); }
/** * Constructs new <code>Automaton</code> from this <code>RegExp</code>. Same * as <code>toAutomaton(null)</code> (empty automaton map). */ public Automaton toAutomaton() { return toAutomaton(null, null, Operations.DEFAULT_MAX_DETERMINIZED_STATES); }
/** * Constructs new <code>Automaton</code> from this <code>RegExp</code>. Same * as <code>toAutomaton(null)</code> (empty automaton map). */ public Automaton toAutomaton() { return toAutomaton(null, null, Operations.DEFAULT_MAX_DETERMINIZED_STATES); }
/** * Constructs a query for terms matching <code>term</code>. * * @param term regular expression. * @param flags optional RegExp features from {@link RegExp} * @param provider custom AutomatonProvider for named automata */ public NodeRegexpQuery(final Term term, final int flags, final AutomatonProvider provider) { super(term, new RegExp(term.text(), flags).toAutomaton(provider)); }
/** * Constructs a query for terms matching <code>term</code>. * * @param term regular expression. * @param flags optional RegExp features from {@link RegExp} * @param provider custom AutomatonProvider for named automata */ public NodeRegexpQuery(final Term term, final int flags, final AutomatonProvider provider) { super(term, new RegExp(term.text(), flags).toAutomaton(provider)); }
private Factory(String regexString, int maxDeterminizedStates) { Automaton automaton = new RegExp(regexString).toAutomaton(maxDeterminizedStates); forward = new OffsetReturningRunAutomaton(automaton, false); if (hasLeadingWildcard(automaton)) { Automaton reversed = Operations.determinize(Operations.reverse( new RegExp("(" + regexString + ").*").toAutomaton(maxDeterminizedStates)), maxDeterminizedStates); reverse = new AcceptReturningReverseRunAutomaton(reversed); } else { reverse = null; } }
@Override public Weight createWeight(IndexSearcher searcher, boolean needsScores) throws IOException { return new CompletionWeight(this, new RegExp(getTerm().text(), flags).toAutomaton(maxDeterminizedStates)); } }