Package uk.ac.cam.ha293.tweetlabel.util

Examples of uk.ac.cam.ha293.tweetlabel.util.Tools


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


   
    //Configure and run LDA
    Tools.configure(stem);

    //TODO: Flexibility in Corpus choice - make automatic?
    Corpus corpus = null;
    if(stem) corpus = Corpus.load("allprofiles-stemmed");
    else corpus = Corpus.load("allprofiles-unstemmed");
   
    //Check for model existence
    LDATopicModel lda = null;
View Full Code Here

   
    //Configure and run LDA
    Tools.configure(stem);

    //TODO: Flexibility in Corpus choice - make automatic?
    Corpus corpus = null;
    if(stem) corpus = Corpus.loadLabelled(topicType, "allprofiles-stemmed");
    else corpus = Corpus.loadLabelled(topicType, "allprofiles-unstemmed");
   
    //Check for model existence
    LLDATopicModel llda = null;
View Full Code Here

  }
 
  public static void lldaStuff() {
    //Corpus corpus = Corpus.loadLabelled("alchemy","allprofiles-unstemmed-alchemy-top3");
    //Corpus corpus = Corpus.loadLabelled("calais","allprofiles-unstemmed-calais-top3");
    Corpus corpus = Corpus.loadLabelled("textwise","allprofiles-unstemmed-textwise-top3");
    corpus.removeLeastCommonWords(10,1);
    Set<Double> alphaSet = new HashSet<Double>();
    alphaSet.add(0.25);
    alphaSet.add(0.5);
    alphaSet.add(0.75);
    alphaSet.add(1.00);
View Full Code Here

      threadNum++;
      final double alph=al;
      Thread thread = new Thread(){
        public void run() {
          System.out.println("THREAD: "+"Running for alpha="+alph);
          Corpus corpus = Corpus.loadLabelled("textwiseproper", "allprofiles-unstemmed-textwiseproper-top3");
          LLDATopicModel llda = new LLDATopicModel(corpus,1000,100,0,alph,0.01,fThread);
          llda.runQuickCVGibbsSampling(0);
        }
      };
      thread.start();
View Full Code Here

      System.out.println("THREAD "+threadNum+": Starting up");
      final int iReduction = reduction;
      final double fReduction = reduction/10.0;
      String[] topicTypes = {"alchemy","calais","textwiseproper"};
      for(String topicType : topicTypes) {
        Corpus corpus = Corpus.loadLabelled(topicType, "allprofiles-unstemmed-"+topicType+"-top3");
        final Corpus fCorpus = corpus.randomlyRemove(fReduction);
        System.out.println(fCorpus.size());
        final int fThread=threadNum;
        threadNum++;
        Thread thread = new Thread(){
          public void run() {
            double[] alphas = {0.25,0.5,0.75,1.0,1.25,1.5,1.75,2.0};
View Full Code Here

      System.out.println("THREAD "+threadNum+": Starting up");
      final int iReduction = reduction;
      final double fReduction = reductions[reduction-1];
      String[] topicTypes = {"textwiseproper"};
      for(String topicType : topicTypes) {
        final Corpus fCorpus = Corpus.loadLabelled(topicType, "allprofiles-unstemmed-"+fReduction+"-tweets-top3");
        final int fThread=threadNum;
        threadNum++;
        Thread thread = new Thread(){
          public void run() {
            double[] alphas = {0.25,0.5,0.75,1.0,1.25,1.5,1.75,2.0};
View Full Code Here

    for(int reduction=1; reduction <=9; reduction++) {
      System.out.println("THREAD "+threadNum+": Starting up");
      final int iReduction = reduction;
      final double fReduction = reductions[reduction-1];
      //final Corpus fCorpus = Corpus.loadLabelled(topicType, "allprofiles-unstemmed-"+fReduction+"-tweets-top3");
      final Corpus fCorpus = Corpus.load("allprofiles-unstemmed");
      fCorpus.randomlyRemove(fReduction);
      final int fThread=threadNum;
      threadNum++;
      Thread thread = new Thread(){
        public void run() {
          double[] alphas = {0.25,0.5,0.75,1.0,1.25,1.5,1.75,2.0};
View Full Code Here

    String concat = "";
    for(SimpleTweet tweet : tweets) {
      concat += tweet.getText()+" ";
    }
    String strippedText = Tools.stripTweet(concat);
    Document document = new Document(strippedText, userID);
    return document;
  }
View Full Code Here

    String concat = "";
    for(SimpleTweet tweet : tweets) {
      concat += tweet.getText()+" ";
    }
    String strippedText = Tools.stripTweet(concat);
    Document document = new Document(strippedText, userID, topics);
    return document;
  }
View Full Code Here

TOP

Related Classes of uk.ac.cam.ha293.tweetlabel.util.Tools

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.