|
International Journal of Computer Applications
Foundation of Computer Science (FCS), NY, USA
|
| Volume 187 - Issue 66 |
| Published: December 2025 |
| Authors: Ahmad Farhan Alshammari |
10.5120/ijca2025926115
|
Ahmad Farhan Alshammari . Implementation of Text Generation using Markov Chains in Python. International Journal of Computer Applications. 187, 66 (December 2025), 35-40. DOI=10.5120/ijca2025926115
@article{ 10.5120/ijca2025926115,
author = { Ahmad Farhan Alshammari },
title = { Implementation of Text Generation using Markov Chains in Python },
journal = { International Journal of Computer Applications },
year = { 2025 },
volume = { 187 },
number = { 66 },
pages = { 35-40 },
doi = { 10.5120/ijca2025926115 },
publisher = { Foundation of Computer Science (FCS), NY, USA }
}
%0 Journal Article
%D 2025
%A Ahmad Farhan Alshammari
%T Implementation of Text Generation using Markov Chains in Python%T
%J International Journal of Computer Applications
%V 187
%N 66
%P 35-40
%R 10.5120/ijca2025926115
%I Foundation of Computer Science (FCS), NY, USA
The goal of this research is to implement text generation using Markov chains in Python. Text generation is the process of creating a new text by analyzing the input text and then predicting the new words. It is used to make posts, reviews, reports, stories, poems, summaries, etc. Markov chains is a mathematical method used to predict the next state based on the current state. The text is generated by randomly selecting the new words based on their probabilities (or weights). The basic steps of text generation using Markov chains are explained: reading file, cleaning text, creating words, creating chains, computing frequency, computing transition probability, generating text, and printing generated text. The developed program was tested on an experimental text. The program has successfully performed the basic steps of text generation using Markov chains and provided the required results.