Random Text Generator
This Python code is a random text generator that generates random sentences based on a given input file. It uses the Spacy library for natural language processing and the Counter class for generating statistics about the text. The code can generate random sentences and answer questions based on a character's name found in the input text file.
Installation
This code requires Python 3 and the Spacy library.
Usage To use the random text generator, run the Python code and follow the prompts. The code will ask the user to select an input file, either a test file or a URL address for another text file. The program will then generate statistics for the input file, such as the number of words, the number of sentences, the number of unique words, and the most common named entities and nouns.
After generating statistics, the program will prompt the user to select an option. The user can choose to generate random sentences based on the input text, or to ask about a character's name found in the text. If the user chooses to generate random sentences, the program will prompt the user to input the number of sentences to generate. The program will then generate random sentences based on the input text using a combination of randomly selected words, phrases, and noun chunks.
#Alex_K