Examples of CSVFileReader


Examples of dmt.tools.CSVFileReader

  {
    if(loadedWords != null)
      return;
    loadedWords = new Vector<String>();
    instances = new Vector<Integer>();
    CSVFileReader in;
    try {
      in = new CSVFileReader(Configuration.BAG_OF_WORDS_FINAL, ',');
   

      Vector<String> fields = in.readFields();
     
      while(fields!=null)
      {
        loadedWords.add(fields.get(0));
        instances.add(Integer.parseInt(fields.get(1)));
        fields = in.readFields();
      }
      in.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of dmt.tools.CSVFileReader

    if(stopWords != null)
    {
      return;
    }
   
    CSVFileReader in;
    try
    {
      in = new CSVFileReader(Configuration.STOP_WORDS_LIST_WITH_CONTRACTIONS, ',');
      stopWords = in.readFields();
      in.close();
    } catch (IOException e)
    {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of dmt.tools.CSVFileReader

    if(stopWords != null)
    {
      return;
    }
   
    CSVFileReader in;
    try
    {
      in = new CSVFileReader(Configuration.STOP_WORDS_LIST_WITH_CONTRACTIONS, ',');
      stopWords = in.readFields();
      in.close();
    } catch (IOException e)
    {
      e.printStackTrace();
    }
   
View Full Code Here

Examples of dmt.tools.CSVFileReader

    if(stopWords != null)
    {
      return;
    }
   
    CSVFileReader in;
    try
    {
      in = new CSVFileReader(Configuration.STOP_WORDS_LIST_WITH_CONTRACTIONS, ',');
      stopWords = in.readFields();
      in.close();
    } catch (IOException e)
    {
      e.printStackTrace();
    }
   
View Full Code Here

Examples of dmt.tools.CSVFileReader

  private void loadRelevantElements()
  {
    if(relevantElements != null)
      return;
    relevantElements = new Vector<String>();
    CSVFileReader in;
    try {
      in = new CSVFileReader(Configuration.RELEVANT_ELEMENTS, ',');
   

      Vector<String> fields = in.readFields();
     
      while(fields!=null)
      {
        relevantElements.add(fields.get(0));
        fields = in.readFields();
      }
      in.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of dmt.tools.CSVFileReader

    if(stopWords != null)
    {
      return;
    }
   
    CSVFileReader in;
    try
    {
      in = new CSVFileReader(Configuration.STOP_WORDS_LIST_WITH_CONTRACTIONS, ',');
      stopWords = in.readFields();
      in.close();
    } catch (IOException e)
    {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of org.ar.domainspecific.tools.csv.CSVFileReader

  private ArrayList<ClassTop> loadGoogleTop(String ontologyName)
      throws IOException
  {
    ArrayList<ClassTop> map = new ArrayList<ClassTop>();
    String inputDirectory = "../org.ar.domainspecific/output-rank-csv/";
    CSVFileReader in = new CSVFileReader(inputDirectory + ontologyName
        + ".csv", ',');
    // read the first row
    Vector<String> fields = in.readFields();
    // skip the first row and read the second because the first one is the
    // header
    fields = in.readFields();

    String className;
    Integer googleTop;

    int noFields = 0;

    while (fields != null)
    {
      noFields++;
      // get the class name from the first column (0)
      className = fields.get(0);

      // get the top from the second column (1)
      try
      {
        googleTop = Integer.parseInt(fields.get(1));
      } catch (NumberFormatException e)
      {
        googleTop = 0;
      }

      // add the top into map
      map.add(new ClassTop(className, googleTop));
      // read the next row
      fields = in.readFields();
    }
    return map;
  }
View Full Code Here

Examples of org.ar.domainspecific.tools.csv.CSVFileReader

    this.currentSelection = new HashSet<OWLEntity>();
  }
 
  private void loadGoogleTop(String ontologyName) throws IOException
  {
    CSVFileReader in = new CSVFileReader(inputDirectory+ontologyName+".csv", ',');
    //read the first row
    Vector<String> fields = in.readFields();
    //skip the first row and read the second because the first one is the header
    fields = in.readFields();
   
    String className;
    Integer googleTop;
   
    int noFields = 0;
   
    while(fields != null)
    {
      noFields++;
      //get the class name from the first column (0)
      className = fields.get(0);
     
      //get the top from the second column (1)
      try
      {
        googleTop = Integer.parseInt(fields.get(1));
      }
      catch(NumberFormatException e)
      {
        googleTop = 0;
      }
     
      //add the top into map
      map.add(new ClassTop(className, googleTop));
      //read the next row
      fields = in.readFields();
    }
   
   
   
    System.out.println("No fields: " + noFields);
View Full Code Here

Examples of org.ar.domainspecific.tools.csv.CSVFileReader

    }
  }
 
  private void loadGoogleTop(String ontologyName) throws IOException
  {
    CSVFileReader in = new CSVFileReader(inputDirectory+ontologyName+".csv", ',');
    //read the first row
    Vector<String> fields = in.readFields();
    //skip the first row and read the second because the first one is the header
    fields = in.readFields();
   
    String className;
    Integer googleTop;
   
    int noFields = 0;
   
    while(fields != null)
    {
      noFields++;
      //get the class name from the first column (0)
      className = fields.get(0);
     
      //get the top from the second column (1)
      try
      {
        googleTop = Integer.parseInt(fields.get(1));
      }
      catch(NumberFormatException e)
      {
        googleTop = 0;
      }
     
      //add the top into map
      if(hashNames.containsKey(className))
      {
        hashClasses.put(hashNames.get(className), hashClasses.get(hashNames.get(className)) * googleTop);
      }
      //map.add(new ClassTop(className, googleTop));
      //read the next row
      fields = in.readFields();
    }
  }
View Full Code Here

Examples of org.ar.domainspecific.tools.csv.CSVFileReader

    this.currentSelection = new HashSet<OWLEntity>();
  }
 
  private void loadWikiTop(String ontologyName) throws IOException
  {
    CSVFileReader in = new CSVFileReader(inputDirectory+ontologyName+".csv", ',');
    //read the first row
    Vector<String> fields = in.readFields();
    //skip the first row and read the second because the first one is the header
    fields = in.readFields();
   
    String className;
    Double wikiTop;
   
    while(fields != null)
    {
      //get the class name from the first column (0)
      className = fields.get(0);
      //get the top from the second column (1)
      try
      {
        Boolean hasArticle = Boolean.parseBoolean(fields.get(2));
        wikiTop = computeScore(hasArticle,
            Integer.parseInt(fields.get(3)),
            Integer.parseInt(fields.get(4)),
            Integer.parseInt(fields.get(5)),
            Integer.parseInt(fields.get(6)),
            Integer.parseInt(fields.get(7)));
       
      }
      catch(Exception e)
      {
        wikiTop = 0.0;
      }
      //add the top into map
      map.add(new ClassTopWiki(className, wikiTop));
      //read the next row
      fields = in.readFields();
    }
  }
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.