Package dk.brics.automaton

Examples of dk.brics.automaton.RunAutomaton


    private RunAutomaton runauto = null;
   
    public CompiledAutomaton( String rhsPattern ) {
        RegExp regexpr = new dk.brics.automaton.RegExp(rhsPattern);
        Automaton auto = regexpr.toAutomaton();
        this.runauto = new RunAutomaton(auto, true);
    }
View Full Code Here


      mainAut.determinize();
      if(verbose) {
        System.out.println("DFA initialised");
        System.out.println("Memory: " + Runtime.getRuntime().freeMemory() + " " + Runtime.getRuntime().totalMemory() + " " + Runtime.getRuntime().maxMemory());
      }
      runAuts.put(type, new RunAutomaton(mainAut, false));
      autLists.remove(type);     
    }
    if(simpleAuts.containsKey(type)) {
      if(verbose) System.out.println("Building DFA for: " + type + "b at " + new GregorianCalendar().getTime() + "... ");
      Automaton mainAut = simpleAuts.get(type).toAutomaton();
      if(verbose) System.out.println("DFA initialised");
      runAuts.put(type + "b", new RunAutomaton(mainAut, false));     
      simpleAuts.remove(type);
    }
  }
View Full Code Here

      mainAut.determinize();
      if(verbose) System.out.println("DFA initialised");
      if(verbose) {
        System.out.println("Memory: " + Runtime.getRuntime().freeMemory() + " " + Runtime.getRuntime().totalMemory() + " " + Runtime.getRuntime().maxMemory());
      }
      runAuts.put(type, new RunAutomaton(mainAut, false));
      autLists.remove(type);
    }
    for(String type : new HashSet<String>(simpleAuts.keySet())) {
      if(verbose) System.out.println("Building DFA for: " + type + "b at " + new GregorianCalendar().getTime() + "... ");
      Automaton mainAut = simpleAuts.get(type).toAutomaton();
      if(verbose) System.out.println("DFA initialised");
      runAuts.put(type + "b", new RunAutomaton(mainAut, false));     
      simpleAuts.remove(type);
    }
    if(verbose) System.out.println("All DFAs built");
    if(verbose) System.out.println("Analysing DFAs...");
    runAutToStateToOntIds = new HashMap<String,Map<Integer,Set<String>>>();
View Full Code Here

   
    private RunAutomaton automaton;
   
    Rule(boolean sign, String regex) {
      super(sign, regex);
      automaton = new RunAutomaton(new RegExp(regex, RegExp.ALL).toAutomaton());
    }
View Full Code Here

    this.sentenceStr = sentenceStr;
    this.file = file;

    for(LatticeCell cell : lattice.getCellsForTokens(sentence)) {
      for(String type : runAuts.keySet()) {
        RunAutomaton runAut = runAuts.get(type);
        int start = runAut.getInitialState();
        List<LatticeCell> cellPath = new ArrayList<LatticeCell>();
        List<String> repPath = new ArrayList<String>();
        //System.out.println("Starting with: " + type + "\t" + cell.getValue());
        seekAlongPath(type, start, cell, cellPath, repPath);
      }
View Full Code Here

  }
   
  public void seekAlongPath(String type, int state, LatticeCell cell, List<LatticeCell> cellPath, List<String> repPath) {
    //System.out.println("At state " + state);
    Set<String> reps = cell.getReps(this);
    RunAutomaton runAut = runAuts.get(type);
    Set<String> newReps = new HashSet<String>();
    for(String rep : reps) {
      newReps.add(rep);
      if(termVariants.containsKey(rep)) {
        //System.out.println(rep + "\t" + termVariants.get(rep));
        newReps.addAll(termVariants.get(rep));
      }
    }
    reps = newReps;
    //System.out.println("At state " + state);
    //System.out.println(reps);
    for(String rep : reps) {
      //System.out.println("Now at state " + state);
      String repCode = getRepForTokenOrNull(rep);
      //System.out.println("NowNow at state " + state);
      if(repCode != null) {
        //System.out.println("Trying: " + type + "\t" + rep + "\t" + repCode + "\tat\t" + state);
        int newState = state;
        for(int i=0;i<repCode.length();i++) {
          char c = repCode.charAt(i);
          newState = runAut.step(newState, c);
          //System.out.println("\t" + newState);
          if(newState == -1) break;
        }
        if(newState == -1) continue;
        //System.out.println("Added: " + type + "\t" + cell.getValue());
        //System.out.println("Added: " + type + "\t" + repCode);
        List<LatticeCell> newCellPath = new ArrayList<LatticeCell>(cellPath);
        newCellPath.add(cell);
        List<String> newRepPath = new ArrayList<String>(repPath);
        newRepPath.add(rep);
        if(runAut.isAccept(newState)) {
          //System.out.println("Making new relation");
          handleNe(type, newCellPath, newRepPath);// Handle the relation
        }
        if(cell.hasNext()) {
          for(LatticeCell nextCell : cell.getNext()) {
View Full Code Here

    if (re.endsWith("$") && !re.endsWith("\\$")) {
      re = re.substring(0, re.length() - 1);
    }

    this.dbProvider = dbProvider;
    this.pattern = new RunAutomaton(new RegExp(re).toAutomaton());
  }
View Full Code Here

    if (re.endsWith("$") && !re.endsWith("\\$")) {
      re = re.substring(0, re.length() - 1);
    }

    this.dbProvider = dbProvider;
    this.pattern = new RunAutomaton(new RegExp(re).toAutomaton());
  }
View Full Code Here

    if (re.endsWith("$") && !re.endsWith("\\$")) {
      re = re.substring(0, re.length() - 1);
    }

    this.dbProvider = dbProvider;
    this.pattern = new RunAutomaton(new RegExp(re).toAutomaton());
  }
View Full Code Here

    } else {
      prefixEnd = "";
      prefixOnly = false;
    }

    pattern = prefixOnly ? null : new RunAutomaton(automaton);
  }
View Full Code Here

TOP

Related Classes of dk.brics.automaton.RunAutomaton

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.