public class NLGUtils extends Object
| Constructor and Description |
|---|
NLGUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsProcess(Collection<String> vals,
KB kb)
Return true if the given list includes "Process", or if one of its elements is a subclass of Process.
|
static String |
formatList(String strseq,
String language)
Format a list of variables which are not enclosed by parens.
|
static String |
getArticle(String s,
int count,
int occurrence,
String language)
Generate a linguistic article appropriate to how many times in a
paraphrase a particular type has already occurred.
|
static HashMap<String,HashMap<String,String>> |
getKeywordMap()
Return a defensive copy of the keyword map.
|
static String |
htmlParaphrase(String href,
String stmt,
Map<String,String> phraseMap,
Map<String,String> termMap,
KB kb,
String language)
Hyperlink terms in a natural language format string.
|
static HashMap<String,HashMap<String,String>> |
readKeywordMap(String dir)
Read a set of standard words and phrases in several languages.
|
static String |
resolveFormatSpecifiers(String template,
String href)
Resolve the "format specifiers" in the given printf type of statement.
|
static String |
upcaseFirstVisibleChar(String htmlParaphrase,
boolean addFullStop,
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 String resolveFormatSpecifiers(String template, String href)
template - href - public static String formatList(String strseq, String language)
strseq - the list of variableslanguage - the target language (used for the conjunction "and")public static HashMap<String,HashMap<String,String>> readKeywordMap(String dir)
public static String getArticle(String s, int count, int occurrence, 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 HashMap<String,HashMap<String,String>> getKeywordMap()
public static String htmlParaphrase(String href, String stmt, Map<String,String> phraseMap, Map<String,String> termMap, KB kb, 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 String upcaseFirstVisibleChar(String htmlParaphrase, boolean addFullStop, 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(Collection<String> vals, KB kb)
vals - kb - Copyright © 2015. All rights reserved.