Nlg Builds an Offer

I would like to generate a sentence that has input words. For instance.

Input:

Mary chase the monkey 

Conclusion:

 Mary chases the monkey. 

This can be done using the simple NLG library: http://code.google.com/p/simplenlg/ as follows:

 String subject = "Mary"; String verb = "chase"; String object = "the monkey"; p.setSubject(subject); p.setVerb(verb); p.setObject(object); String output = realiser.realiseSentence(p); System.out.println(output); 

This will generate a sentence Mary chasing the monkey. But I would like this to be automated when I type in words and a sentence is generated. This will require some preliminary processing, which will indicate which word is the subject, the word is a verb and is an object. I know that there are libraries of POS tags (parts of speech), but they do not indicate whether this is an object or an object. Any suggestions how to do this? Also, so that it works for large sentences with several objects, adverbs, etc.

+6
source share
3 answers

To get an object, verb, or object for an input sentence, you need to do parsing or parsing.

There are two main groups of parsing tools, compilers of parsers and dependency parsers, but usually the first is a more direct way to get what you need.

Here are some analytic components you can try:

This related question may also help: Simple start of natural language processing for Java

+1
source

The most common approach is to build ngramm statistics, and then to build the most appropriate word. A famous example of Oen can be found here http://scribe.googlelabs.com/

+3
source

It will depend on the word order. If Mary's order pursues the monkey, then the exit will be Mary pursues the monkey. If the order is a monkey to chase Mary, then the exit will be a monkey chasing Mary.

I looked at the OpenNLP parser, but as input, it accepts a sentence that is parsed. What I have as input are words, and I need to build a sentence.

And anyway, when I look at an example: A quick brown fox jumps over a lazy dog.

The parser should now print the following to the console. (PP (IN) (NP (DT)) (JJ lazy) (NN dog))) (.)))

All I see is parts of speech. I do not see it indicating objects, objects, etc., if the API does not have such a function.

If I am wrong, correct me.

0
source

Source: https://habr.com/ru/post/889617/


All Articles