Giter Site home page Giter Site logo

rfdj / simplenlg-nl Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 3.0 4.49 MB

A Java-based surface realiser for Natural Language Generation in Dutch, based on SimpleNLG (https://github.com/simplenlg/simplenlg)

License: Other

Java 98.63% HTML 1.37%
simplenlg natural-language-generation nlg realiser surface-realiser surface-realization java natural-language dutch multilingual

simplenlg-nl's People

Contributors

dependabot[bot] avatar rfdj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

simplenlg-nl's Issues

Complements in interrogative types should go to the back of the sentence in Dutch

Describe the bug
When formulating an interrogative type and adding a postmodifier, this will not be added to the end of the sentence

To Reproduce
Steps to reproduce the behavior:

final private static Lexicon lexicon_nl = new simplenlg.lexicon.dutch.XMLLexicon();
final private static NLGFactory factory_nl = new NLGFactory(lexicon_nl);
final private static Realiser realiser_nl = new Realiser();

SPhraseSpec clause3 = factory_nl.createClause();
NPPhraseSpec subject = factory_nl.createNounPhrase("JIJ");
PPPhraseSpec aboutJan = factory_nl.createPrepositionPhrase("over","Jan");
subject.setFeature(Feature.PRONOMINAL, true);
subject.setFeature(Feature.PERSON, Person.SECOND);
clause3.setSubject(subject);
clause3.setVerb("denk");
clause3.addPostModifier(aboutJan);
clause3.setFeature(Feature.INTERROGATIVE_TYPE, InterrogativeType.WHAT_OBJECT);
String output3 = realiser_nl.realiseSentence(clause3);
System.out.println(output3);	

Expected behavior
I added a fix for taking the right morphology for question types for Person.SECOND, so the verb is denkt most likely in other cases, though in the debug output, also the inflection might differ.

The expected output:
Wat denk jij over Jan?

The actual output:
Wat denk over Jan jij?

Java version
JDK 8 and JDK 13

Additional context
Debug output: link

Interrogative Types for Second Person

Describe the bug
When creating an interrogative type question, the verb does not pick the correct form.

To Reproduce
Steps to reproduce the behavior:

Lexicon lexicon = new XMLLexicon();
NLGFactory nlg = new NLGFactory(lexicon);
Realiser realiser = new Realiser();
SPhraseSpec clause = nlg.createClause("you", "think");
PPPhraseSpec aboutJohn = nlg.createPrepositionPhrase("about", "John");
clause.addPostModifier(aboutJohn);
clause.setFeature(Feature.INTERROGATIVE_TYPE,InterrogativeType.WHAT_OBJECT);
String realisation = realiser.realiseSentence(clause);

The result is:

What does you think about John?

Expected behavior
The result should be:

What do you think about John?

Screenshots
If applicable, add screenshots to help explain your problem.

Java version
Tested with JDK 8 and 13.

Additional context
It seems that in the original SimpleNLG there is a test in which it selects the appropriate verb. See the method testWhatObjectInterrogative() at line 814. The same goes for a Dutch sentence, configured like this:

Lexicon lexicon = new simplenlg.lexicon.dutch.XMLLexicon();
NLGFactory nlg = new NLGFactory(lexicon);
Realiser realiser = new Realiser();

SPhraseSpec phrase = nlg.createClause();
NPPhraseSpec subject = nlg.createNounPhrase("Jij");
subject.setFeature(Feature.PRONOMINAL, true);
subject.setFeature(Feature.PERSON, Person.SECOND);
phrase.setSubject(subject);
phrase.setVerb("doen");
phrase.setObject("dat");
phrase.setFeature(Feature.INTERROGATIVE_TYPE, InterrogativeType.WHY);
phrase.setFeature(Feature.TENSE, Tense.PRESENT);
String result = realiser.realiseSentence(phrase);

The result: Waarom doet jij dat?, the expected result is Waarom doe jij dat?

For the What do you think about John? sentence, the contents of the realization:

SimpleNLG NL:
{realisation=null, category=SENTENCE, features={interrogative=true, textComponents=[InflectedWordElement[what:NOUN], [InflectedWordElement[do:VERB]], [InflectedWordElement[you:PRONOUN]], [InflectedWordElement[think:VERB], [[InflectedWordElement[about:PREPOSITION], [InflectedWordElement[John:ANY]]]]]]}}

Debug: link

Original
{realisation=null, category=SENTENCE, features={interrogative=true, textComponents=[InflectedWordElement[what:PRONOUN], InflectedWordElement[do:VERB], InflectedWordElement[you:PRONOUN], [InflectedWordElement[think:VERB], [[InflectedWordElement[about:PREPOSITION], InflectedWordElement[John:ANY]]]]]}}

Debug: link

It could have to do with that What is a pronoun in the one case, and a noun in the other case?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.