gate.creole.annic.lucene
Class StatsCalculator

java.lang.Object
  extended by gate.creole.annic.lucene.StatsCalculator

public class StatsCalculator
extends Object


Constructor Summary
StatsCalculator()
           
 
Method Summary
static int freq(IndexSearcher searcher, String corpusToSearchIn, String annotationSetToSearchIn, String annotationType)
           
static int freq(IndexSearcher searcher, String corpusToSearchIn, String annotationSetToSearchIn, String annotationType, String featureName)
           
static int freq(IndexSearcher searcher, String corpusToSearchIn, String annotationSetToSearchIn, String annotationType, String featureName, String value)
          Allows retriving frequencies for the given parameters.
static int freq(List<Hit> patternsToSearchIn, String annotationType, boolean inMatchedSpan, boolean inContext)
           
static int freq(List<Hit> patternsToSearchIn, String annotationType, String feature, String value, boolean inMatchedSpan, boolean inContext)
          Allows retrieving frequencies for the given parameters.
static Map<String,Integer> freqForAllValues(List<Hit> patternsToSearchIn, String annotationType, String feature, boolean inMatchedSpan, boolean inContext)
          Calculates frequencies for all possible values of the provided AT.feature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatsCalculator

public StatsCalculator()
Method Detail

freq

public static int freq(IndexSearcher searcher,
                       String corpusToSearchIn,
                       String annotationSetToSearchIn,
                       String annotationType,
                       String featureName,
                       String value)
                throws SearchException
Allows retriving frequencies for the given parameters. Please make sure that you close the searcher on your own. Failing to do so may result into many files being opened at the same time and that can cause the problem with your OS.

Throws:
SearchException

freq

public static int freq(IndexSearcher searcher,
                       String corpusToSearchIn,
                       String annotationSetToSearchIn,
                       String annotationType)
                throws SearchException
Throws:
SearchException
See Also:
freq(IndexSearcher, String, String, String, String, String)

freq

public static int freq(IndexSearcher searcher,
                       String corpusToSearchIn,
                       String annotationSetToSearchIn,
                       String annotationType,
                       String featureName)
                throws SearchException
Throws:
SearchException
See Also:
freq(IndexSearcher, String, String, String, String, String)

freq

public static int freq(List<Hit> patternsToSearchIn,
                       String annotationType,
                       String feature,
                       String value,
                       boolean inMatchedSpan,
                       boolean inContext)
                throws SearchException
Allows retrieving frequencies for the given parameters.

Parameters:
value - - set to null if only wants to retrieve frequencies for AT.feature
inMatchedSpan - - true if only interested in frequencies from the matched spans.
inContext - - true if only interested in frequencies from the contexts. Please note that both isMatchedSpan and inContext can be set to true if interested in frequencies from the entire patterns, but cannot be set false at the same time.
Throws:
SearchException

freq

public static int freq(List<Hit> patternsToSearchIn,
                       String annotationType,
                       boolean inMatchedSpan,
                       boolean inContext)
                throws SearchException
Throws:
SearchException
See Also:
freq(List, String, String, String, boolean, boolean)

freqForAllValues

public static Map<String,Integer> freqForAllValues(List<Hit> patternsToSearchIn,
                                                   String annotationType,
                                                   String feature,
                                                   boolean inMatchedSpan,
                                                   boolean inContext)
                                            throws SearchException
Calculates frequencies for all possible values of the provided AT.feature

Parameters:
patternsToSearchIn -
annotationType -
feature -
inMatchedSpan -
inContext -
Returns:
returns a map where key is the unique value of AT.feature and value is the Integer object giving count for the value.
Throws:
SearchException