public abstract class NLGModule extends Object
NLGModule is the base class that all processing modules extend
from. This is abstract and cannot therefore be instantiated itself. The
supplied processing modules that come pre-packaged in SimpleNLG can be found
within their appropriate packages.
All processing modules perform realisation on a tree of
NLGElements. The modules can alter the tree in whichever way
they wish. For example, the syntax processor replaces phrase elements with
list elements consisting of inflected words while the morphology processor
replaces inflected words with string elements.
N.B. the use of module, processing module and processor is interchangeable. They all mean an instance of this class.
| Modifier and Type | Field and Description |
|---|---|
protected Lexicon |
lexicon
The lexicon that is to be used by this module.
|
| Constructor and Description |
|---|
NLGModule() |
| Modifier and Type | Method and Description |
|---|---|
Lexicon |
getLexicon()
Retrieves the lexicon currently being used by this module.
|
abstract void |
initialise()
Performs one-time initialisation of the module.
|
abstract List<NLGElement> |
realise(List<NLGElement> elements)
Realises a
List of NLGElements usually by
iteratively calling the realise(NLGElement) method on each
element in the list and adding the result into a new a List |
abstract NLGElement |
realise(NLGElement element)
Realises the given element.
|
void |
setLexicon(Lexicon newLexicon)
Sets the lexicon to be used by this module.
|
protected Lexicon lexicon
public abstract void initialise()
public abstract NLGElement realise(NLGElement element)
element - the NLGElement to be realised.NLGElement representing the realised state. This
may be the initial element in a changed form or be a completely
new element.public abstract List<NLGElement> realise(List<NLGElement> elements)
List of NLGElements usually by
iteratively calling the realise(NLGElement) method on each
element in the list and adding the result into a new a Listelements - the List of NLGElements to be
realised.List of realised NLGElements.public void setLexicon(Lexicon newLexicon)
null
will remove the existing lexicon and no lexicon will be used.newLexicon - the new Lexicon to be used.public Lexicon getLexicon()
Lexicon in use. This will be null
if there is currently no lexicon associated with this module.Copyright © 2020. All Rights Reserved.