Examples of FileIterator


Examples of cc.mallet.pipe.iterator.FileIterator

          new TokenSequenceRemoveStopwords(),
          new TokenSequence2FeatureSequence(),
          new FeatureSequence2FeatureVector() });

    InstanceList instList = new InstanceList(instPipe);
    instList.addThruPipe(new
        FileIterator(directories, FileIterator.STARTING_DIRECTORIES));

    System.out.println("Training 1");
    NaiveBayesTrainer trainer = new NaiveBayesTrainer();
    NaiveBayes classifier = trainer.trainIncremental(instList);

    //instList.getDataAlphabet().stopGrowth();

    // incrementally train...
    String[] t2directories = {
        "src/cc/mallet/classify/tests/NaiveBayesData/learn/b"
    };

    System.out.println("data alphabet size " + instList.getDataAlphabet().size());
    System.out.println("target alphabet size " + instList.getTargetAlphabet().size());
    InstanceList instList2 = new InstanceList(instPipe);
    instList2.addThruPipe(new
        FileIterator(t2directories, FileIterator.STARTING_DIRECTORIES));

    System.out.println("Training 2");

    System.out.println("data alphabet size " + instList2.getDataAlphabet().size());
View Full Code Here

Examples of cc.mallet.pipe.iterator.FileIterator

          new TokenSequenceRemoveStopwords(),
          new TokenSequence2FeatureSequence(),
          new FeatureSequence2FeatureVector() });

    InstanceList instList = new InstanceList(instPipe);
    instList.addThruPipe(new
        FileIterator(directories, FileIterator.STARTING_DIRECTORIES));

    System.out.println("Training 1");
    NaiveBayesTrainer trainer = new NaiveBayesTrainer();
    NaiveBayes classifier = (NaiveBayes) trainer.trainIncremental(instList);

    Classification initialClassification = classifier.classify("Hello Everybody");
    Classification initial2Classification = classifier.classify("Goodbye now");
    System.out.println("Initial Classification = ");
    initialClassification.print();
    initial2Classification.print();
    System.out.println("data alphabet " + classifier.getAlphabet());
    System.out.println("label alphabet " + classifier.getLabelAlphabet());


    // incrementally train...
    String[] t2directories = {
        "src/cc/mallet/classify/tests/NaiveBayesData/learn/b"
    };

    System.out.println("data alphabet size " + instList.getDataAlphabet().size());
    System.out.println("target alphabet size " + instList.getTargetAlphabet().size());
    InstanceList instList2 = new InstanceList(instPipe);
    instList2.addThruPipe(new
        FileIterator(t2directories, FileIterator.STARTING_DIRECTORIES));

    System.out.println("Training 2");

    System.out.println("data alphabet size " + instList2.getDataAlphabet().size());
View Full Code Here

Examples of cc.mallet.pipe.iterator.FileIterator

          new TokenSequenceRemoveStopwords(),
          new TokenSequence2FeatureSequence(),
          new FeatureSequence2FeatureVector() });

    InstanceList instList = new InstanceList(instPipe);
    instList.addThruPipe(new
        FileIterator(directories, FileIterator.STARTING_DIRECTORIES));

    System.out.println("Training 1");
    NaiveBayesTrainer trainer = new NaiveBayesTrainer();
    NaiveBayes classifier = (NaiveBayes) trainer.trainIncremental(instList);

    Classification initialClassification = classifier.classify("Hello Everybody");
    Classification initial2Classification = classifier.classify("Goodbye now");
    System.out.println("Initial Classification = ");
    initialClassification.print();
    initial2Classification.print();
    System.out.println("data alphabet " + classifier.getAlphabet());
    System.out.println("label alphabet " + classifier.getLabelAlphabet());


    // test
    String[] t2directories = {
        "src/cc/mallet/classify/tests/NaiveBayesData/learn/b"
    };

    System.out.println("data alphabet size " + instList.getDataAlphabet().size());
    System.out.println("target alphabet size " + instList.getTargetAlphabet().size());
    InstanceList instList2 = new InstanceList(instPipe);
    instList2.addThruPipe(new
        FileIterator(t2directories, FileIterator.STARTING_DIRECTORIES, true));

    System.out.println("Training 2");

    System.out.println("data alphabet size " + instList2.getDataAlphabet().size());
View Full Code Here

Examples of cc.mallet.pipe.iterator.FileIterator

      File[] subdirs = getSubDirs(directory);
      Alphabet clusterAlph = new Alphabet();
      InstanceList instances = new InstanceList(new Noop());
      TIntArrayList labels = new TIntArrayList();
      for (int j = 0; j < subdirs.length; j++) {
        ArrayList<File> records = new FileIterator(subdirs[j]).getFileArray();
        int label = clusterAlph.lookupIndex(subdirs[j].toString());
        for (int k = 0; k < records.size(); k++) {
          if (fi % 100 == 0) System.out.print(fi);
          else if (fi % 10 == 0) System.out.print(".");
          if (fi % 1000 == 0 && fi > 0) System.out.println();
View Full Code Here

Examples of cc.mallet.pipe.iterator.FileIterator

  public static void main(String[] args) {
    String htmldir = args[0];
    Pipe pipe = new SerialPipes(new Pipe[] { new Input2CharSequence(),
        new CharSequenceRemoveHTML() });
    InstanceList list = new InstanceList(pipe);
    list.addThruPipe(new FileIterator(htmldir, FileIterator.STARTING_DIRECTORIES));

    for (int index = 0; index < list.size(); index++) {
      Instance inst = list.get(index);
      System.err.println(inst.getData());
    }
View Full Code Here

Examples of com.google.appengine.tools.util.FileIterator

    app.statusUpdate("Scanning files on local disk.", 20);
    int numFiles = 0;
    long resourceTotal = 0;
    List<Pattern> skipFiles = loadSkipFiles(app.getAppYaml());
    for (File f : new FileIterator(basepath)) {
      if (shouldSkip(f.getName(), skipFiles)) {
        continue;
      }
      FileInfo fileInfo = new FileInfo(f, basepath);
      fileInfo.setMimeType(app);
View Full Code Here

Examples of com.google.appengine.tools.util.FileIterator

    ApiVersionFinder finder = new ApiVersionFinder();

    String foundApiVersion = null;
    File webInf = new File(baseDir, "WEB-INF");
    File libDir = new File(webInf, "lib");
    for (File file : new FileIterator(libDir)) {
      if (file.getPath().endsWith(".jar")) {
        try {
          String apiVersion = finder.findApiVersion(file);
          if (apiVersion != null) {
            if (foundApiVersion == null) {
View Full Code Here

Examples of com.google.appengine.tools.util.FileIterator

          "Cannot get the System Java Compiler. Please use a JDK, not a JRE.");
    }
    StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);

    ArrayList<File> files = new ArrayList<File>();
    for (File f : new FileIterator(jspClassDir)) {
      if (f.getPath().toLowerCase().endsWith(".java")) {
        files.add(f);
      }
    }
    if (files.isEmpty()) {
      return;
    }
    List<String> optionList = new ArrayList<String>();
    optionList.addAll(Arrays.asList("-classpath", classpath.toString()));
    optionList.addAll(Arrays.asList("-d", jspClassDir.getPath()));
    optionList.addAll(Arrays.asList("-encoding", opts.getCompileEncoding()));

    Iterable<? extends JavaFileObject> compilationUnits =
        fileManager.getJavaFileObjectsFromFiles(files);
    boolean success = compiler.getTask(
        null, fileManager, null, optionList, null, compilationUnits).call();
    fileManager.close();

    if (!success) {
      throw new JspCompilationException("Failed to compile the generated JSP java files.",
          JspCompilationException.Source.JSPC);
    }
    if (opts.isJarJSPsSet()) {
      zipJasperGeneratedFiles(webInf, jspClassDir);
    } else {
      copyOrLinkDirectories(jspClassDir, new File(webInf, "classes"));
    }
    if (opts.isDeleteJSPs()) {
      for (File f : new FileIterator(webInf.getParentFile())) {
        if (f.getPath().toLowerCase().endsWith(".jsp")) {
          f.delete();
        }
      }
    }
View Full Code Here

Examples of com.google.appengine.tools.util.FileIterator

    classpath.append(classDir.getPath());
    classpath.append(File.pathSeparatorChar);
    classpath.append(genDir.getPath());
    classpath.append(File.pathSeparatorChar);

    for (File f : new FileIterator(new File(classDir.getParentFile(), "lib"))) {
      String filename = f.getPath().toLowerCase();
      if (filename.endsWith(".jar") || filename.endsWith(".zip")) {
        classpath.append(f.getPath());
        classpath.append(File.pathSeparatorChar);
      }
View Full Code Here

Examples of com.google.appengine.tools.util.FileIterator

    }
  }

  private String generateAppYaml(File stageDir, String runtime) {
    Set<String> staticFiles = new HashSet<String>();
    for (File f : new FileIterator(new File(stageDir, "__static__"))) {
      staticFiles.add(Utility.calculatePath(f, stageDir));
    }

    AppYamlTranslator translator =
        new AppYamlTranslator(getAppEngineWebXml(), getWebXml(), getBackendsXml(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.