马尔可夫算法是使用类似形式文法的规则在符号上操作的字符串重写系统马尔可夫算法被证明是图灵完全的,这意味着它们适合作为一般的计算模型,并可以用它的简单概念表示任何数学表达式

Refal是基于马尔可夫算法的编程语言

算法

编辑
  1. 自顶向下依次检查规则,看是否能在符号串中找到任何在箭头左边的字符串。
  2. 如果没有找到,停止执行算法。
  3. 如果找到一个或多个,把符号串中的最左匹配的文字替换为在第一个相应规则的箭头右边的字符串。
  4. 返回步骤1并继续。(如果应用的规则是终止规则,则停止执行算法。)

例子

编辑

下列例子展示了马尔可夫算法的基本操作。

规则

编辑
  1. "A" -> "apple"
  2. "B" -> "bag"
  3. "S" -> "shop"
  4. "T" -> "the"
  5. "the shop" -> "my brother"
  6. "从不使用的" -> ."终止规则"

符号串

编辑

"I bought a B of As from T S."

执行

编辑

如果算法应用于上述例子,符号串将被以如下方式变更。

  1. "I bought a B of apples from T S."
  2. "I bought a bag of apples from T S."
  3. "I bought a bag of apples from T shop."
  4. "I bought a bag of apples from the shop."
  5. "I bought a bag of apples from my brother."

算法接着就终止了。

引用

编辑
  • Caracciolo di Forino, A. String processing languages and generalized Markov algorithms. In Symbol manipulation languages and techniques, D. G. Bobrow (Ed.), North-Holland Publ. Co., Amsterdam, The Netherlands, 1968, pp. 191-206.
  • Andrey Andreevich Markov (1903-1979) 1960. The Theory of Algorithms. American Mathematical Society Translations, series 2, 15, 1-14.

外部链接

编辑

📚 Artikel Terkait di Wikipedia

Python

(原始内容存档于2012-11-02).  The Python Standard Library - Text Processing Services - string — Common string operations - Format String Syntax. [2023-03-21]. (原始内容存档于2023-06-06)

XPath

count(node-set) 返回符合XPath的节点集合的节点总数。 string(object?) 根据内建法则转换任何四种XPath数据型别为字符串。参数可为XPath,此时符合条件的节点(群)被转换成字符串返回。 concat(string, string, string*) 链接任何数量的字符串。 contains(s1

COMIT

Greenwood Press. June 2003: 95. ISBN 1-57356-521-0.  Sammet, J.E.. "String and list processing languages", in Programming Languages: History and Fundamentals

Ada

Element(To_Unbounded_String(str), len) then declare new_str : String(1..len-2); begin new_str := Slice(Source => To_Unbounded_String(str), Low => 2, High

Java注解

提出了通用需求的注解(或者说元注解)手段,并在 2004 年 9 月收到许多人的赞赏。从 JDK 1.5 开始,java 开始支持注解。Annotation Processing tool (或者说 apt tool) 提供了一个补充性的编译时注解操作的接口。文档 JSR-269 将它规范化,在 JDK 1.6 写入编译器

C++/CLI

int main() { array<String^>^ arr = gcnew array<String^>(10); int i = 0; for each(String^% s in arr) s = gcnew String(i++.ToString()); return 0; }

C♯

Person(string firstName, string lastName) { fname = firstName; lname = lastName; } private string fname; private string lname; public override string ToString()

Kotlin

id: Int, val name: String, val address: String) { fun saveUser(user: User) { fun validate(user: User, value: String, fieldName: String) { if (value.isBlank())