馬可夫演算法
閱讀設定
馬可夫演算法(粵拼:maa5 ho2 fu1 jin2 syun3 faat3;英文:Markov algorithm)係用咗類似形式文法嘅規則喺符號串上操作嘅字符串重寫系統。
例子
[編輯]以下係一個馬可夫演算法嘅例子。
規則
[編輯]- "A" -> "apple"(最先)
- "B" -> "bag"
- "S" -> "shop"
- "T" -> "the"
- "the shop" -> "my brother"
- "a never used" -> ."terminating rule"(最後)
輸入
[編輯]"I bought a B of As from T S."
執行
[編輯]如果段馬可夫演算法收到呢個輸入,段演算法會以以下嘅步驟改變串字:
- "I bought a B of As from T S."(開始)
- "I bought a B of apples from T S."
- "I bought a bag of apples from T S."
- "I bought a bag of apples from T shop."
- "I bought a bag of apples from the shop."
- "I bought a bag of apples from my brother."
然後段演算法終結。