The Markov chain sentence generator app is an app which generates sentences using statistical patterns. The app doesn't use a machine learning library but instead relies on a simple algorithm involving Markov chains, which are mathematical models that describe a sequence of possible events. The probability of each event depends on the state attained in the preceding event. A Markov chain can be used to model the likelihood of transitioning from one word to another based on the words that precede it in a given text. The more the pair of words appear in the trained model, the higher the chance of it being selected.
The generator constructs a Markov chain by recording the frequency of word transitions. For example, if the word "cat" frequently follows the word "the" in the input text, the generator assigns a higher probability to that transition in the Markov chain.
To generate a sentence, the generator starts with a randomly selected word and uses the Markov chain to probabilistically select the next word based on the preceding word. This process continues until a predetermined stopping condition is met, such as reaching a provided sentence length.
The sentence generator app has the following features:
Visit the repository at https://github.com/nchinling/markov_sentence_constructor for a more detailed description of the app's features.
The app implements a simple algorithm to generate sentences. Although it generates sentences which are structurally sound, it lacks the ability to generate meaningful sentences. I created this app as I wanted to know how texts are generated intelligently using statistical methods. Using advanced libraries like TensorFlow and Pytorch would definitely improve the training of the model and the subsequent generation of sentences.