Computer AI algorithm to write sentences?

前端 未结 4 1825
清酒与你
清酒与你 2021-01-30 15:28

I am searching for information on algorithms to process text sentences or to follow a structure when creating sentences that are valid in a normal human language such as English

4条回答
  •  不思量自难忘°
    2021-01-30 15:40

    The field you're looking for is called natural language generation, a subfield of natural language processing http://en.wikipedia.org/wiki/Natural_language_processing

    Sentence generation is either really easy or really hard depending on how good you want the sentences to be. Currently, there aren't programs that will be able to generate 100% sensible sentences about given nouns (even with a thesaurus) -- if that is what you mean.

    If, on the other hand, you would be satisfied with nonsense that was sometimes ungrammatical, then you could try an n-gram based sentence generator. These just chain together of words that tend to appear in sequence, and 3-4-gram generators look quite okay sometimes (although you'll recognize them as what generates a lot of spam email).

    Here's an intro to the basics of n-gram based generation, using NLTK: http://www.nltk.org/book/ch02.html#generating-random-text-with-bigrams

提交回复
热议问题