Package org.ar.domainspecific.tools.csv

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


    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

    }
  }
 
  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

    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

Related Classes of org.ar.domainspecific.tools.csv.CSVFileReader

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.