org.jscience.linguistics.kif
Class NLformatter

java.lang.Object
  extended by org.jscience.linguistics.kif.NLformatter

public class NLformatter
extends java.lang.Object

A class that handles the generation of natural language from logic.


Method Summary
static java.lang.String htmlParaphrase(java.lang.String href, java.lang.String stmt, java.util.Map phraseMap, java.util.Map termMap, java.lang.String language)
          Hyperlink terms in a natural language format string.
static void main(java.lang.String[] args)
           
static java.lang.String nlStmtPara(java.lang.String stmt, java.util.Map phraseMap, java.util.Map termMap, java.lang.String language)
          Create a natural language paraphrase of a logical statement.
static java.util.HashMap readKeywordMap(java.lang.String dir)
          Read a set of standard words and phrases in several languages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readKeywordMap

public static java.util.HashMap readKeywordMap(java.lang.String dir)
Read a set of standard words and phrases in several languages. Each phrase must appear on a new line with alternatives separated by '|'. The first entry should be a set of two letter language identifiers.

Parameters:
dir - DOCUMENT ME!
Returns:
a HashMap of HashMaps where the first HashMap has a key of the English phrase, and the interior HashMap has a key of the two letter language identifier.

nlStmtPara

public static java.lang.String nlStmtPara(java.lang.String stmt,
                                          java.util.Map phraseMap,
                                          java.util.Map termMap,
                                          java.lang.String language)
Create a natural language paraphrase of a logical statement. This is the entry point for this function, but kifExprPara does most of the work.

Parameters:
stmt - The statement to be paraphrased.
phraseMap - An association list of relations and their natural language format statements.
termMap - An association list of terms and their natural language format statements.
language - DOCUMENT ME!
Returns:
A String, which is the paraphrased statement.

htmlParaphrase

public static java.lang.String htmlParaphrase(java.lang.String href,
                                              java.lang.String stmt,
                                              java.util.Map phraseMap,
                                              java.util.Map termMap,
                                              java.lang.String language)
Hyperlink terms in a natural language format string. This assumes that terms to be hyperlinked are in the form &%termName$termString , where termName is the name of the term to be browsed in the knowledge base and termString is the text that should be displayed hyperlinked.

Parameters:
href - the anchor string up to the term= parameter, which this method will fill in.
stmt - the KIF statement that will be passed to nlStmtPara for formatting.
phraseMap - the set of NL formatting statements that will be passed to nlStmtPara.
termMap - the set of NL statements for terms that will be passed to nlStmtPara.
language - the natural language in which the paraphrase should be generated.
Returns:
DOCUMENT ME!

main

public static void main(java.lang.String[] args)
Parameters:
args - DOCUMENT ME!