I am looking to combine two sentences using the TextSpec Class as mentioned in the link: https://code.google.com/p/simplenlg/wiki/Section16 . But looks like the class is no longer available. Could someone please guide me on this?
Asked
Active
Viewed 178 times
1 Answers
1
That part of the tutorial has been deprecated.TextSpec was part of an earlier version of SimpleNLG that is no longer present. If we want to create canned text clauses we can use a StringElement (https://cdn.rawgit.com/simplenlg/simplenlg/master/docs/javadoc/simplenlg/framework/StringElement.html) and add these to a CoordinatedPhraseElement to aggregated them together as shown below:
NLGFactory factory = new NLGFactory(lexicon);
Realiser realiser = new Realiser(lexicon);
CoordinatedPhraseElement coordinate = factory.createCoordinatedPhrase(new StringElement("John is going to Tesco"), new StringElement("Mary is going to Sainsburys"));
SPhraseSpec sentence = factory.createClause();
sentence.addComplement(coordinate);
String text = realiser.realiseSentence(sentence);
Produces the following output:
John is going to Tesco and Mary is going to Sainsburys.
Finally, SimpleNLG has moved to GitHub: https://github.com/simplenlg/simplenlg. The current maintained version of tutorial can be found here: https://github.com/simplenlg/simplenlg/wiki/Section-0-–-SimpleNLG-Tutorial

Gayatri
- 2,197
- 4
- 23
- 35