Package uk.ac.cam.ha293.tweetlabel.types

Examples of uk.ac.cam.ha293.tweetlabel.types.Category


 
  public static void liwcClassificationRoutine() {
    System.out.println("Beginning complete LIWC classification...");
    while(!synchronisedUserIDList.isEmpty()) {
      long currentID = synchronisedUserIDList.remove(0);
      SimpleProfile profile = Profiler.loadCSVProfile(currentID);
      if(!profile.classifyLIWC()) {
        System.err.println("Failed to classify profile "+currentID+" properly using the LIWC");
        return;
      }
    }
  }
View Full Code Here


 
  public static void calaisClassificationRoutine() {
    System.out.println("Beginning complete Calais classification...");
    while(!synchronisedUserIDList.isEmpty()) {
      long currentID = synchronisedUserIDList.remove(0);
      SimpleProfile profile = Profiler.loadCSVProfile(currentID);
      if(!profile.classifyCalais()) {
        System.err.println("Failed to classify profile "+currentID+" properly using Calais");
        return;
      }
    }
  }
View Full Code Here

  public static void textwiseClassificationRoutine() {
    System.out.println("Beginning complete Textwise classification...");
    Profiler profiler = new Profiler();
    while(!synchronisedUserIDList.isEmpty()) {
      long currentID = synchronisedUserIDList.remove(0);
      SimpleProfile profile = profiler.loadCSVProfile(currentID);
      if(!profile.classifyTextwise()) {
        System.err.println("Failed to classify profile "+currentID+" properly using Textwise");
        return;
      }
    }
  }
View Full Code Here

  public static void properTextwiseClassificationRoutine() {
    System.out.println("Beginning complete Textwise classification...");
    Profiler profiler = new Profiler();
    while(!synchronisedUserIDList.isEmpty()) {
      long currentID = synchronisedUserIDList.remove(0);
      SimpleProfile profile = profiler.loadCSVProfile(currentID);
      if(!profile.classifyTextwiseProper()) {
        System.err.println("Failed to classify profile "+currentID+" properly using Textwise");
        return;
      }
    }
  }
View Full Code Here

      System.err.println("An error occured");
    }
  }
 
  public SimpleProfile asSimpleProfile() {
    SimpleProfile profile = new SimpleProfile(0);
    for(String document : documents) {
      profile.addTweet(new SimpleTweet(0,0,document));
    }
    return profile;
  }
View Full Code Here

  }
 
  public SimpleProfile asSimpleProfile() {
    SimpleProfile profile = new SimpleProfile(0);
    for(String document : documents) {
      profile.addTweet(new SimpleTweet(0,0,document));
    }
    return profile;
  }
View Full Code Here

        //iterate until we hit the end of the category list
        while(!rawLIWC.get(i).equals("%")) {
          String[] splitCategory = rawLIWC.get(i).split("\\s+"); //split on all whitespace
          int currentID = Integer.parseInt(splitCategory[0]);
          String currentTitle = splitCategory[1];
          Category currentCategory = new Category(currentTitle)
          currentCategory.setLIWCID(currentID);
         
          int j = 66; //Start of word list
          //iterate until we hit end of word list
          while(j < rawLIWC.size()) {
            String[] splitWord = rawLIWC.get(j).split("\\s+");
            for(int k=1; k<splitWord.length; k++) {
              if(Integer.parseInt(splitWord[k]) == currentID) {
                currentCategory.addWord(splitWord[0]);
               
                //NOTE: now, we've added the word to the category
                //but here we can also try to create a new word object
                //and add this category to the word to avoid having to
                //iterate over it all again
                if(words.containsKey(splitWord[0])) {
                  words.get(splitWord[0]).addCategory(currentCategory);
                } else {
                  LIWCWord newWord = new LIWCWord(splitWord[0]);
                  newWord.addCategory(currentCategory);
                  words.put(splitWord[0], newWord);
                }             
                break;
              }
            }
            j++;
          }
         
          categories.add(currentCategory);
          stringCategoryLookup.put(currentCategory.getTitle(), currentCategory);
          i++;
        }
           
      } catch (IOException e) {
        System.err.println("Couldn't read from LIWC Dictionary file at "+path);
View Full Code Here

    List<CategoryScore> results = new ArrayList<CategoryScore>();
       
    //print results
    while(it.hasNext()) {   
      Category cat = it.next();
      if(categoryBlacklistSet.contains(cat.getTitle())) continue; //Don't include blacklist categories
      if(categoryScores.get(cat) == 0) continue; //Remove zero scoring categories
      //System.out.println(cat.getTitle()+": "+categoryScores.get(cat));
      results.add(new CategoryScore(cat,categoryScores.get(cat)));
    }
   
View Full Code Here

    List<CategoryScore> results = new ArrayList<CategoryScore>();
       
    //print results
    while(it.hasNext()) {   
      Category cat = it.next();
      //System.out.println(cat.getTitle()+": "+categoryScores.get(cat));
      if(categoryBlacklistSet.contains(cat.getTitle())) continue; //Don't include blacklist categories
      results.add(new CategoryScore(cat,categoryScores.get(cat)));
    }
   
    return results;
  }
View Full Code Here

 
  public List<CategoryScore> logClassify(String document) {
    List<CategoryScore> categoryScores = new ArrayList<CategoryScore>();
    for(Category category : categories.keySet()) {
      double logP = logPOfCategoryGivenDocument(category, Tools.LIWCStripTweet(document));
      categoryScores.add(new CategoryScore(category,logP));     
    }
    return categoryScores;
  }
View Full Code Here

TOP

Related Classes of uk.ac.cam.ha293.tweetlabel.types.Category

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.