public class NLGUtils
extends java.lang.Object
| Constructor and Description |
|---|
NLGUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsProcess(java.util.Collection<java.lang.String> vals,
KB kb)
Return true if the given list includes "Process", or if one of its elements is a subclass of Process.
|
static java.lang.String |
formatList(java.lang.String strseq,
java.lang.String language)
Format a list of variables which are not enclosed by parens.
|
static java.lang.String |
getArticle(java.lang.String s,
int count,
int occurrence,
java.lang.String language)
Generate a linguistic article appropriate to how many times in a
paraphrase a particular type has already occurred.
|
static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> |
getKeywordMap()
Return a defensive copy of the keyword map.
|
static java.lang.String |
htmlParaphrase(java.lang.String href,
java.lang.String stmt,
java.util.Map<java.lang.String,java.lang.String> phraseMap,
java.util.Map<java.lang.String,java.lang.String> termMap,
KB kb,
java.lang.String language)
Hyperlink terms in a natural language format string.
|
static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> |
readKeywordMap(java.lang.String dir)
Read a set of standard words and phrases in several languages.
|
static java.lang.String |
resolveFormatSpecifiers(java.lang.String template,
java.lang.String href)
Resolve the "format specifiers" in the given printf type of statement.
|
static java.lang.String |
upcaseFirstVisibleChar(java.lang.String htmlParaphrase,
boolean addFullStop,
java.lang.String language)
Capitalizes the first visible char of htmlParaphrase, if
possible, and adds the full stop symbol for language at a
workable place near the end of htmlParaphrase if addFullStop is
true.
|
public static java.lang.String resolveFormatSpecifiers(java.lang.String template,
java.lang.String href)
template - href - public static java.lang.String formatList(java.lang.String strseq,
java.lang.String language)
strseq - the list of variableslanguage - the target language (used for the conjunction "and")public static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> readKeywordMap(java.lang.String dir)
public static java.lang.String getArticle(java.lang.String s,
int count,
int occurrence,
java.lang.String language)
occurrence - is the number of times a variables of a
given type have appearedcount - is the number of times a given variable has
appearedpublic static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> getKeywordMap()
public static java.lang.String htmlParaphrase(java.lang.String href,
java.lang.String stmt,
java.util.Map<java.lang.String,java.lang.String> phraseMap,
java.util.Map<java.lang.String,java.lang.String> termMap,
KB kb,
java.lang.String language)
href - the anchor string up to the term= parameter, which this method
will fill in.stmt - the KIF statement that will be passed to paraphraseStatement for formatting.phraseMap - the set of NL formatting statements that will be passed to paraphraseStatement.termMap - the set of NL statements for terms that will be passed to paraphraseStatement.language - the natural language in which the paraphrase should be generated.public static java.lang.String upcaseFirstVisibleChar(java.lang.String htmlParaphrase,
boolean addFullStop,
java.lang.String language)
htmlParaphrase - Any String, but assumed to be a Formula
paraphrase with HTML markupaddFullStop - If true, this method will try to add a full
stop symbol to the result String.language - The language of the paraphrase String.public static boolean containsProcess(java.util.Collection<java.lang.String> vals,
KB kb)
vals - kb -