I am trying to create a simple sentence generator that uses templates and a database of words. It will be a website where essentially a user could click a button to generate a sentence.

For example: The {animal} is on top of the {large_obj}. would choose a item from animals and then choose another item from the list that it points to. And it would also choose a large_obj. A possible outcome would be: The chicken is on top of the house.

data relation

I am looking for suggestions for how to store the data. I was thinking either a database with tables for each collection or a large JSON object. But I don't have enough experience to feel good about either decision.

It is currently planned to use Node.js with a Postgres database. I'm hoping to have 1000-2000 words total.

  • How many words are going to be stored in your word groups (e.g., Large_objs)? How do you account for the word de-referencing of animals to another word group? – Adam Zuckerman Feb 8 '16 at 5:29
  • Im hoping to have 1000-2000 words total. By de-referencing to you mean going up the tree from animals back to nouns? If so, that is not something that I will need to do. – Bhough Feb 8 '16 at 5:34
  • Your example shows an animal, but you then have to decide which animal type in order to decide the specific animal. How do you get from {animal} to chicken ? – Adam Zuckerman Feb 8 '16 at 5:37
  • Oh I see your question. Birds would be randomly chosen from Animals and then chicken would be randomly chosen from Birds – Bhough Feb 8 '16 at 5:40
  • 4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.