1

I’m looking for a tool that can generate text (natural language) according to a list of words and their syntactic/morphological rules, both which I specify.

So for example, I might add the word "table", put it in the category "noun", and select the plural construction rule "append -s".

The tool should offer a way to generate a list of possible sentences, using my vocabulary and the rules I created. It should also be possible to input a sentence which the tool should check for correctness (according to the vocabulary/rules it knows).

The tool must be gratis (and ideally FLOSS). OS doesn’t matter (but native GNU/Linux support is preferred). No hosted solutions (self-hosted is okay).

(I used such a tool with a text-based user interface some years ago, but can’t remember its name.)

3

It sound like you are looking for pythons Natural Language Toolkit, NLTK. It fits all your requirements:

  • Free (both Libra & FLOSS)
  • Cross platform - Linux has python installed by default in most distros but installs are available for just about everything.
  • Not hosted.
  • An example of what you are looking to do can be found here but looks like:

    from nltk.parse.generate import generate, demo_grammar
    from nltk import CFG
    grammar = CFG.fromstring(demo_grammar)
    print(grammar)
    for sentence in generate(grammar, n=10):
         print(' '.join(sentence))
    
the man slept
the man saw the man
the man saw the park
the man saw the dog
the man saw a man
the man saw a park
the man saw a dog
the man walked in the man
the man walked in the park
the man walked in the dog

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.