1. Andy Luong
  2. textgrounder

Commits

dicta24  committed 06ad75a

Updated BigramWordDist for generics

  • Participants
  • Parent commits 7d571df
  • Branches textgrounder

Comments (0)

Files changed (1)

File src/main/scala/opennlp/textgrounder/geolocate/BigramWordDist.scala

View file
 import GeolocateDriver.Params
 import GeolocateDriver.Debug._
 import WordDist.memoizer._
+import GenericTypes._
 
 /**
  * Bigram word distribution with a table listing counts for each word,
      */
   def kl_divergence(xother: WordDist, partial: Boolean = false) = {
     // Weighting value for unigrams
-    val ALPHA = 0.5 
+    val ALPHA = 0.9 
 
     if(debug("kl_divergence_bigram"))
       errprint("Testing KL Divergence for bigram")
   var num_bigram_tokens = 0
   var title: String = _
 
-  def do_read_word_counts(table: DistDocumentTable,
+  def do_read_word_counts(table: GenericDistDocumentTable,
       filehand: FileHandler, filename: String, stopwords: Set[String]) {
     errprint("Reading word and bigram counts from %s...", filename)
     errprint("")
     }
   }
 
-  def set_word_dist(doc: DistDocument, is_training_set: Boolean,
+  def set_word_dist(doc: GenericDistDocument, is_training_set: Boolean,
       is_eval_set: Boolean) = {
-    if(debug("read_bigram")){
-      errprint("set_word_dist")
-    }
+if(debug("read_bigram")){
+  errprint("set_word_dist")
+}
     if (num_word_tokens == 0 && num_bigram_tokens == 0)
       false
     else {
     }
   }
 
-  def set_bigram_word_dist(doc: DistDocument, keys: Array[Word],
+  def set_bigram_word_dist(doc: GenericDistDocument, keys: Array[Word],
     values: Array[Int], num_words: Int, bigram_keys: Array[Word],
     bigram_values: Array[Int], num_bigrams: Int, note_globally: Boolean)
 }
 abstract class BigramWordDistFactory extends
     WordDistFactory with BigramWordDistReader {
 }
-
-