Questions tagged [nlg]

Natural Language Generation (NLG) is a field dealing with automatic generation of natural languages.

Natural Language Generation (NLG) is used in systems which communicate in a natural language, such as a program to automatically build a weather report based on weather data.

NLG is often thought as the reverse of sentence parsing in Natural Language Processing (NLP), but it is not, since sentence parsing only deals with the syntactic representation of a language, while NLG deals much deeper than that, touching the semantics (meaning) of language1.

Although similar in nature, NLG is significantly more difficult than NLP, due to the inherent expressiveness of natural language. NLG involves making many choices, e.g. which content to include, what order to say it in, what words and syntactic constructions to use2.

See also the Wikipedia page on Natural Language Generation: http://en.wikipedia.org/wiki/Natural_language_generation

Linked resources:

  1. http://web.science.mq.edu.au/%7Erdale/teaching/esslli/part01.pdf
  2. http://homepages.abdn.ac.uk/k.vdeemter/pages/teaching/NLP/lectures/lec19.prn.pdf
52 questions
8
votes
1 answer

How do I train gpt 2 from scratch?

I want to train gpt 2 from scratch but there is only fine-tuning approach based on pretrained models in articles I found. I've used this https://github.com/nshepperd/gpt-2 for train with existing model. Should I edit these Python scripts to train…
Alex
  • 1,047
  • 8
  • 21
7
votes
2 answers

ModuleNotFoundError: No module named 'tensorflow.contrib' with tensorflow=2.0.0

I am using TensorFlow version=2.0.0 python version=3.7.3 I am trying to import the below statement from tensorflow.contrib import rnn And it gives error as Module 'tensorflow' has no attribute 'contrib' How can I resolve this?
kriti
  • 145
  • 3
  • 4
  • 13
5
votes
2 answers

Natural Language Generation - how to go beyond templates

We've build a system that analyzes some data and outputs some results in plain English (i.e. no charts etc.). The current implementation relies on lots of templates and some randomization in order to give as much diversity to the text as…
Stergios
  • 3,126
  • 6
  • 33
  • 55
5
votes
1 answer

SimpleNLG - How to get the plural of a noun?

I'm using SimpleNLG 4.4.2 to get plural form for a noun: final XMLLexicon xmlLexicon = new XMLLexicon(); final WordElement word = xmlLexicon.getWord("apple",…
Fluffy
  • 27,504
  • 41
  • 151
  • 234
4
votes
1 answer

SimpleNLG: how we specify the quantity?

My question is how to specify the quantity in a noun phrase? For example: NPPhraseSpec np = nlgFactory.createNounPhrase("", "apple"); How to generate "5 apples", for example? A solution is to put a preModifier, the code would be: Lexicon…
Karim
  • 133
  • 5
3
votes
1 answer

NLG - Create text descriptions with simplenlg

I'm trying to generate product descriptions with the help of NLG. For example if I specify the properties of the product(say a mobile phone) such as its OS, RAM, processor, display, battery etc., It should output me a readable description of the…
Master Po
  • 1,497
  • 1
  • 23
  • 42
3
votes
2 answers

SimpleNLG - Is it possible to have SimpleNLG automatically detect if a noun is singular or plural?

The following SimpleNLG code which specifies the subject, verb and object using "monkeys", "eat", "bananas", respectively produces the sentence "monkey eats bananas". Thus, you see that it converted the plural nouns into singular ones (and ensured…
blu
  • 829
  • 2
  • 7
  • 14
3
votes
1 answer

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 =…
Jeremy Hunts
  • 353
  • 1
  • 5
  • 14
2
votes
2 answers

Svelte giving me 'Uncaught ReferenceError: require is not defined'

I'm trying to use a natural language generation library called RosaeNLG with my Svelte app but whenever I import any variable from the JavaScript file that 'requires' rosaenlg I get an error saying 'Uncaught ReferenceError: require is not…
2
votes
4 answers

How to generate a meaningful sentence from words only?

I want to generate a sentence from list of words. I have tried n-gram model but it only generates the text from already existing sentence i.e. we input a sentence and it outputs the next generated words based on the value of n. Which model will be…
Maleehak
  • 671
  • 8
  • 17
2
votes
2 answers

Get tense of verb java

I am using simpleNLG to find the actual tense of a verb. But i cannot seem to be doing it right, instead of giving the tense of the verb it converts it to present tense :/ public class TenseWas { public static void main(String[] args) { …
2
votes
2 answers

Convert a plural noun to singular

This is done using SimpleNLG Java API I want to convert "elves" to elf. The code below converts from singular to plural, how can it be modified to convert from plural to singular ? final XMLLexicon xmlLexicon = new XMLLexicon(); final WordElement…
Jeremy Hunts
  • 353
  • 1
  • 5
  • 14
2
votes
1 answer

Sentence generation from Keywords.Each keyword have bag of related words

I am working on Natural Language Generation project. Now I have bags of keywords and I am trying to generate sentence of pattern Subject+verb+object. Is there any tool or package or library to get sentences when i give bag of subject,bag of verb and…
1
vote
0 answers

How to generate an interrogative "WHAT_OBJECT" phrase using SimpleNLG in Python3?

I would generate this question "What are the colors of lightsabers?". I'm using the direct port of the java code of SimpleNLG in python and my version of python is 3.11. This is my wrong solution, which generates "What are lightsaber the colors…
edoardo
  • 11
  • 2
1
vote
0 answers

Adding start token while generating with MT5

I've a specific use case for generating text using mT5 model provided by huggingface. I need to be able to control the language in which text is generated. I tried adding prefixes to encoder input but the model is always generating text in English.…
1
2 3 4