Jeremy Hunts
Jeremy Hunts

Reputation: 363

Get Gerund of a verb

I'm new to Simple NLG, I want to get the gerund of the verb I enter. here is a sample code, but i tried entering gerund for tense but it didn't work

XMLLexicon lexicon = new XMLLexicon("path\\to\\default-lexicon.xml");
WordElement word = lexicon.getWord("live", LexicalCategory.VERB);
InflectedWordElement infl = new InflectedWordElement(word);
infl.setFeature(Feature.TENSE, Tense.PAST); //I want the verb to be in gerund not past
Realiser realiser = new Realiser(lexicon);
String gerund = realiser.realise(infl).getRealisation();
System.out.println(gerund);

Upvotes: 3

Views: 328

Answers (1)

Edwin Buck
Edwin Buck

Reputation: 70909

I don't know the API, but from what I could piece together, it looks like an approach similar to

XMLLexicon lexicon = ...
NLGFactory phraseFactory = new NLGFactory(lexicon);
VPPhraseSpec live = phraseFactory.createVerbPhrase("live");
SPhraseSpec clause = phraseFactory.createClause();
clause.setVerbPhrase(live);
clause.setFeature(Feature.FORM, Form.GERUND);
Realizer realizer = new Realizer(lexicon);
String gerund = realizer.realize(clause).getRealisation();

Might be better for you.

Look at the unit tests for hints on how to use an API if you cannot find a better resource.

Upvotes: 3

Related Questions