Package basic

Examples of basic.Corpus


  public static void main(String[] args) {
    String folder = "/home/wesley/var/pln/textcat/";

    System.out.println("Lendo arquivos...");
    Corpus corpus = new Corpus();
//    corpus.addFileToTest (new File(folder + "Bosque_CF_8.0.ad-categorias-teste.csv"));
//    corpus.addFileToTrain(new File(folder + "Bosque_CF_8.0.ad-categorias-treino.csv"));
//    corpus.addFileToTest (new File(folder + "transform1-teste-menor.tsv"));
//    corpus.addFileToTrain(new File(folder + "transform1-treino-menor.tsv"));
//    corpus.addFileToTest (new File(folder + "transform1-teste.tsv"));
//    corpus.addFileToTrain(new File(folder + "transform1-treino.tsv"));
//    corpus.readFile(new File(folder + "transform1-treino.tsv"));
//    corpus.readFile(new File(folder + "transform1-teste.tsv"));
//    corpus.readFile(new File(folder + "Bosque_CF_8.0.ad-categorias-teste.csv"));
//    corpus.readFile(new File(folder + "Bosque_CF_8.0.ad-categorias-treino.csv"));
//    corpus.readFile(new File(folder + "projetos9horas.csv"));
    corpus.readFile(new File(folder + "fazido9horas_ava.csv"));
//    corpus.readFile(new File(folder + "fazido9horas_ava-menor.csv"));

    ClassifierNB engine = new ClassifierNB();

    System.out.println("Treinando...");
    engine.train(corpus.getTrain());

    System.out.println("Avaliando...");
    engine.eval(corpus.getTest());

  }
View Full Code Here


  public static void main(String[] args) {
    String folder = "/home/wesley/var/pln/textcat/";

    System.out.println("Lendo arquivos...");
    Corpus corpus = new Corpus();
//    corpus.readFile(new File(folder + "fazido9horas.csv"));
    corpus.readFile(new File(folder + "base-10-07-12.csv"));
   
    // corpus.readFile(new File(folder + "projetos9horas.csv"));

    ClassifierNBToFile engine = new ClassifierNBToFile();

    System.out.println("Treinando...");
    List<Document> docsToTrain = corpus.getCategories("ambiente",
        "aumento", "cultura", "data", "dev", "direito", "edu",
        "espaco_pub", "habita", "lixo", "muda_nome", "outros",
        "regulamentacao", "saude", "seguranca", "transito");
    engine.train(docsToTrain);

    System.out.println("Etiquetando...");
    List<Document> docsToTagger = corpus.getCategories("TBD");
    engine.tagger(docsToTagger);

    for (Document d : docsToTrain) {
      System.out.print(d.getCategory() + " \t");
      System.out.println(d);
View Full Code Here

TOP

Related Classes of basic.Corpus

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.