uk.ac.shef.dcs.oak.jate.util.counter
Class TermFreqCounter

java.lang.Object
  extended by uk.ac.shef.dcs.oak.jate.util.counter.TermFreqCounter

public class TermFreqCounter
extends java.lang.Object

Count frequencies of phrases or n-grams in corpus


Constructor Summary
TermFreqCounter()
           
 
Method Summary
 int count(java.lang.String context, java.util.Set<java.lang.String> terms)
          Count the total frequencies of a set of terms in certain context.
 int count(java.lang.String noun, java.lang.String context)
          Count number of occurrences of a string in a context.
 java.util.Set<java.lang.Integer> countOffsets(java.lang.String noun, java.lang.String context)
          Count number of occurrences of a string in a context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TermFreqCounter

public TermFreqCounter()
Method Detail

count

public int count(java.lang.String noun,
                 java.lang.String context)
Count number of occurrences of a string in a context.

Parameters:
noun - the string to be counted
context - the text in which the string can be found
Returns:
number of frequencies

countOffsets

public java.util.Set<java.lang.Integer> countOffsets(java.lang.String noun,
                                                     java.lang.String context)
Count number of occurrences of a string in a context.

Parameters:
noun - the string to be counted
context - the text in which the string can be found
Returns:
int array which contains offsets of occurrences in the text.

count

public int count(java.lang.String context,
                 java.util.Set<java.lang.String> terms)
Count the total frequencies of a set of terms in certain context. Counting is always case-sensitive. For case-insensitive counting, the input params should be pre-processed accordingly

Parameters:
terms - a set of terms
context - in which the terms are expected to be found
Returns:
total frequencies of the set of terms