aipj.assignment1.langen
Class TemplateLanguageGenerator

java.lang.Object
  |
  +--aipj.assignment1.langen.TemplateLanguageGenerator

public class TemplateLanguageGenerator
extends java.lang.Object

A simple template driven language generator. Used in AIJP assignment 1 to generate language for the ChatBots

Author:
Judy Robertson

Constructor Summary
TemplateLanguageGenerator()
          Creates a TemplateLanguageGenerator, sets up the sentence templates, initialises WordNet ready for use, and initialises the random number generator
 
Method Summary
 java.lang.String generateReply(java.lang.String remark)
          Generate a reply to the specified remark.
 java.lang.String generateSentence()
          Generates a sentence using a randomly chosen template
 java.lang.String generateSentence(java.lang.String seed)
          Generate a sentence related to the specified seed word
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateLanguageGenerator

public TemplateLanguageGenerator()
Creates a TemplateLanguageGenerator, sets up the sentence templates, initialises WordNet ready for use, and initialises the random number generator

Method Detail

generateReply

public java.lang.String generateReply(java.lang.String remark)
Generate a reply to the specified remark. The reply is related to the input remark in the vague sense that it contains a word relating to one of the words in the input

Parameters:
remark - The remark which must be responded to
Returns:
A string containing a response to the specified remark

generateSentence

public java.lang.String generateSentence()
Generates a sentence using a randomly chosen template

Returns:
A string containing the sentence

generateSentence

public java.lang.String generateSentence(java.lang.String seed)
Generate a sentence related to the specified seed word

Parameters:
seed - The seed word which the sentence should relate to
Returns:
A sentence relating to the seed word