public class Utils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Utils.Callback
Read event duration distributions from file.
|
Modifier and Type | Field and Description |
---|---|
static String[] |
bins |
static String |
durationDistributionPath |
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static Map<String,Float> |
convertToDistribution(String timeUnit)
Take a time unit and return a probability distribution
in which p(this time unit) = 1 and all others are zero.
|
static float |
expectedDuration(Map<String,Float> distribution)
Compute expected duration in seconds.
|
static String |
formatDistribution(String mentionText,
com.google.common.collect.Multiset<String> durationDistribution,
String separator,
boolean normalize)
Convert duration distribution multiset to a format that's easy to parse automatically.
|
static org.apache.uima.collection.CollectionReader |
getCollectionReader(List<File> inputFiles)
Instantiate an XMI collection reader.
|
static List<File> |
getFilesFor(List<Integer> patientSets,
File inputDirectory)
Get files for specific sets of patients.
|
static String |
getPosTag(org.apache.uima.jcas.JCas systemView,
org.apache.uima.jcas.tcas.Annotation annotation)
Return system generated POS tag or null if none available.
|
static String |
getTextBetweenAnnotations(org.apache.uima.jcas.JCas jCas,
org.apache.uima.jcas.tcas.Annotation arg1,
org.apache.uima.jcas.tcas.Annotation arg2)
Get relation context.
|
static HashSet<String> |
getTimeUnits(String timex)
Extract time unit(s) from a temporal expression
and put in one of the eight bins above.
|
static String |
getTimexMLValue(String timex)
Use Bethard normalizer to get TimeML value.
|
static String |
getTimexMLValue(String timex,
String anchorStr)
Use Bethard normalizer to get TimeML value.
|
static String |
lemmatize(String word,
String pos)
Lemmatize word using ClearNLP lemmatizer.
|
static void |
main(String[] args) |
static String |
normalizeEventText(org.apache.uima.jcas.JCas jCas,
org.apache.uima.jcas.tcas.Annotation annotation)
Keep UMLS concepts and non-verbs intact.
|
static String |
putInBin(String timeUnit)
Take the time unit from Bethard noramlizer
and return a coarser time unit, i.e.
|
static scala.collection.immutable.Set<java.time.temporal.TemporalUnit> |
runTimexParser(String timex)
Use Bethard normalizer to map a temporal expression to a time unit.
|
static void |
writeInstance(String label,
List<org.cleartk.ml.Feature> features,
String fileName)
Output label and list of cleartk features to a file for debugging.
|
public static final String durationDistributionPath
public static final String[] bins
public static HashSet<String> getTimeUnits(String timex)
public static scala.collection.immutable.Set<java.time.temporal.TemporalUnit> runTimexParser(String timex)
public static String getTimexMLValue(String timex)
public static String getTimexMLValue(String timex, String anchorStr)
public static String putInBin(String timeUnit)
public static float expectedDuration(Map<String,Float> distribution)
public static Map<String,Float> convertToDistribution(String timeUnit)
public static String formatDistribution(String mentionText, com.google.common.collect.Multiset<String> durationDistribution, String separator, boolean normalize)
public static String getTextBetweenAnnotations(org.apache.uima.jcas.JCas jCas, org.apache.uima.jcas.tcas.Annotation arg1, org.apache.uima.jcas.tcas.Annotation arg2)
public static String lemmatize(String word, String pos) throws IOException
IOException
public static String getPosTag(org.apache.uima.jcas.JCas systemView, org.apache.uima.jcas.tcas.Annotation annotation)
public static String normalizeEventText(org.apache.uima.jcas.JCas jCas, org.apache.uima.jcas.tcas.Annotation annotation) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
org.apache.uima.analysis_engine.AnalysisEngineProcessException
public static org.apache.uima.collection.CollectionReader getCollectionReader(List<File> inputFiles) throws Exception
Exception
public static List<File> getFilesFor(List<Integer> patientSets, File inputDirectory)
public static void writeInstance(String label, List<org.cleartk.ml.Feature> features, String fileName)
public static void main(String[] args)
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.