[Everyone’s AI] Explore AI Model : Pride and Prejudice

This is a revised post written by dleunji on the AI Network Forum to fit the blog format.

Whenever you are reading a novel and you think the narrative of the story should have a different flow, have you ever come across with this thought? “Oh, only if the story went a little different…” In order to relieve this frustration, let’s learn how to change the story in a novel using an AI model.

The novel I chose is Pride and Prejudice. In this novel, Mrs.Elizabeth met Mr. Darcy at a ball and she immediately perceived he was arrogant, therefore, she developed prejudice towards Mr. Darcy and initially this caused their relationship to fail. However, Mr.Darcy and Ms. Elizabeth managed to overcome his pride and her prejudice so their relationship eventually worked out. If the outcome should have been different, would the love between the two have ever flourished?


  • They fall in love at first sight?
  • Mrs. Elizabeth doesn’t believe Mr.Wickham who slanders Mr. Darcy?
  • Mr. Darcy doesn’t send a letter containing the truth to convice her?
  • Mr. Wickham and Mrs. Lydia (Elizabeth’s younger sister) don’t run away in the nighttime?
  • etc…

To find out, let’s train with Pride and Prejudice.

Pride and Prejudice.

I got the original ‘Pride & Prejudice’ from Project Gutenburg. It is free to use for machine learning or editing because the copyright of the text is in the public domain.

First, let’s take a look at the data for data preprocessing. You can see there are headings for each chapter and newline characters in the data. Both headings and newline characters are unnecessary so I’ll remove them. However, the parts in quotation marks (“”) should remain as quoted dialogue between the characters, considering it is a novel.

Let’s become a novelist

  • Using Ainize’s DEMO

First, let’s use Pride and Prejudice model without a code.

On the DEMO page provided by Ainize, enter the content you want to adapt and press the Summit button to check the adapted content. The demo used above is available link .

  • Using Ainize’s API

This time, we will use a model using the API provided by Ainize. You can check the information on the API in the link .

  • Train and use the model yourself

This time, we will use the model by fine-tuning the GPT-2 through Teachable NLP.

In order to fine-tune the GPT-2 model, first upload the pre-processed data in Teachable-NLP and set the model size to small and epoch to 5. Now, when the training process is over, click Test your model.

Click to open the TabTab screen where you can adapt ‘Pride and Prejudice’


As I was reading this novel, I thought: “what if Elizabeth would fall in love right after dancing with Darcy”? So I will modify the story in accordance with my idea. Then it was adapted like this.

Mr. Darcy was nice and danced only once with Elizabeth. That was all. He liked nothing else but the dancing." “Indeed,” said Elizabeth gravely, “but dancing means dancing. It means thinking what you think.” And so she did. With some degree of amusement, and the most earnestness, she began in earnest with these remarks: "You see, I think, a slight change in Mr. Bennet’s manner; but I think it is due to his taste for dancing which has given him an advantage in his own society. When I was young, and not much better acquainted with Mr. Bennet, than with him himself, I tried to imitate him and learn his manners; and I was obliged to lose it. The object, moreover, is to be in the habit of dancing, and Mr. Bingley is a very good fellow; and I must confess that I had been at first the little more surprised I was when I was asked to join him, for, while Mr. Bingley danced, he gave a little account of dancing.

In what direction will their romance go? Adapt your own version of Pride and Prejudice following your heart!


  1. [Teachable NLP] New Pride and Prejudice with GPT-2
  2. Pride and Prejudice by Jane Austen
  3. Pride and Prejudice Ainize
  4. Pride and Prejudice TabTab
  5. Teachable NLP