Sulekha

This algorithm isn’t restricted to words. You can also apply it to letters. In this case, you would check to see what letter follows a certain letter (or a letter-pair, letter-triplet and so on). To see the Markov chain in action, consider the following body of text. It is the opening two paragraphs of the Declaration of Independence:

When in the Course of human events it becomes necessary for one people to dissolve the political bands which have connected them with another and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature’s God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.

We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness. Prudence, indeed, will dictate that Governments long established should not be changed for light and transient causes; and accordingly all experience hath shewn that mankind are more disposed to suffer, while evils are sufferable than to right themselves by abolishing the forms to which they are accustomed. But when a long train of abuses and usurpations, pursuing invariably the same Object evinces a design to reduce them under absolute Despotism, it is their right, it is their duty, to throw off such Government, and to provide new Guards for their future security. Such has been the patient sufferance of these Colonies; and such is now the necessity which constrains them to alter their former Systems of Government. The history of the present King of Great Britain is a history of repeated injuries and usurpations, all having in direct object the establishment of an absolute Tyranny over these States. To prove this, let Facts be submitted to a candid world.

An order-1 Markov Chain with this text as input looks like this:

prove this, That whenever any Form of an absolute Despotism, and to the patient sufferance of Nature and of Government, Liberty and to throw off such principles and accordingly all experience hath shewn that Governments are accustomed. The history of Nature’s God entitle them to alter their just powers in the necessity which they are endowed by their just powers of the present King of the powers of Government becomes necessary for their former Systems of the Course of Happiness. To prove this, that mankind requires that they should declare the Laws of the earth, as to assume among Men, the necessity which the separation. The history of Government, Governments are accustomed. Prudence, to secure these Colonies; and accordingly all men are created equal station to secure these ends, laying its foundation on such is now the Course of abuses and organizing its powers in direct object the forms to which the Course of mankind requires that they are Life, that mankind are endowed by their Safety and Happiness. To prove this, while evils are created equal, pursuing invariably the earth, that all having in such principles and usurpations, let Facts be changed for their Creator with another and transient causes; and usurpations, laying its foundation on such principles and usurpations, as to alter their Safety and usurpations, let Facts be changed for one people to a decent respect to abolish it is their Safety and accordingly all men are created equal station to dissolve the separate and organizing its foundation on such is the Right of Happiness.

Order-2:

all men are created equal, that all men are created equal, that among these are Life, Liberty and the pursuit of Happiness. That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the present King of Great Britain is a history of the People to alter their former Systems of Government becomes destructive of these ends, it is their right, it is the Right of the earth, the separate and equal station to which the Laws of Nature and of Nature’s God entitle them, a decent respect to the opinions of mankind requires that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, That whenever any Form of Government becomes destructive of these ends, it is the Right of the present King of Great Britain is a history of the People to alter their former Systems of Government becomes destructive of these ends, it is the Right of the governed, That whenever any Form of Government. The history of the earth, the separate and equal station to which they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. Prudence, indeed, will dictate that Governments long established should not be changed for light and transient causes; and accordingly all experience hath shewn that mankind are more disposed to suffer, while evils are sufferable than to right themselves by abolishing the forms to which they are accustomed. But when a long train of abuses and usurpations, all having in direct object the establishment of an absolute Tyranny over these States. To prove this, let Facts be submitted to a candid world.

Order-3:

We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to provide new Guards for their future security. Such has been the patient sufferance of these Colonies; and such is now the necessity which constrains them to alter their former Systems of Government. The history of the present King of Great Britain is a history of repeated injuries and usurpations, all having in direct object the establishment of an absolute Tyranny over these States. To prove this, let Facts be submitted to a candid world.

Order-4:

That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness. Prudence, indeed, will dictate that Governments long established should not be changed for light and transient causes; and accordingly all experience hath shewn that mankind are more disposed to suffer, while evils are sufferable than to right themselves by abolishing the forms to which they are accustomed. But when a long train of abuses and usurpations, pursuing invariably the same Object evinces a design to reduce them under absolute Despotism, it is their right, it is their right, it is their duty, to throw off such Government, and to provide new Guards for their future security. Such has been the patient sufferance of these Colonies; and such is now the necessity which constrains them to alter their former Systems of Government. The history of the present King of Great Britain is a history of repeated injuries and usurpations, all having in direct object the establishment of an absolute Tyranny over these States. To prove this, let Facts be submitted to a candid world.