Markov algorithm: Difference between revisions

Content deleted Content added
AlainD (talk | contribs)
Link to Rewriting system category
AlainD (talk | contribs)
Algorithm: Beautification
Line 4:
 
==Algorithm==
 
#Check the Rules in order from top to bottom to see whether any of the strings to the left of the arrow can be found in the Symbol string.
The ''Rules'' is a sequence of pair of strings, usually presented in the form of ''pattern'' → ''remplacement''. Some rules may be terminating.
#If none is found, stop executing the Algorithm.
 
#If one or more is found, replace the leftmost matching text in the Symbol string with the text to the right of the arrow in the first corresponding Rule.
Given a ''input'' string:
#If the applied rule was a terminating one, stop executing the Algorithm.
 
#Check the Rules in order from top to bottom to see whether any of the strings to the left of the arrow''patterns'' can be found in the Symbol''input'' string.
#If none is found, stopthe executing thealgorithm Algorithmstops.
#If one (or more) is found, replace the leftmost matching text in the Symbol''input'' string with the text to the right of theits arrow''replacement'' in the first correspondingapplicable Rulerule.
#If the applied rule was a terminating one, stopthe executing thealgorithm Algorithmstops.
#Return to step 1 and carry on.