计算机是否有可能“学习"?用户提供的示例的正则表达式? [英] Is it possible for a computer to "learn" a regular expression by user-provided examples?
问题描述
计算机是否有可能通过用户提供的示例来学习"正则表达式?
Is it possible for a computer to "learn" a regular expression by user-provided examples?
澄清:
- 我不想想学习正则表达式.
- 我想创建一个程序,从用户交互式提供的示例中学习"正则表达式,可能是通过从文本中选择部分或选择开始或结束标记.
有可能吗?是否有我可以在 Google 上搜索的算法、关键字等?
Is it possible? Are there algorithms, keywords, etc. which I can Google for?
编辑:感谢您的回答,但我对提供此功能的工具不感兴趣.我正在寻找理论信息,例如论文、教程、源代码、算法名称,以便我可以为自己创造一些东西.
EDIT: Thank you for the answers, but I'm not interested in tools which provide this feature. I'm looking for theoretical information, like papers, tutorials, source code, names of algorithms, so I can create something for myself.
推荐答案
计算学习理论导论 包含学习有限自动机的算法.由于每一种正则语言都相当于一个有限自动机,因此可以通过程序学习一些正则表达式.卡恩斯与英勇展示一些不可能学习有限自动机的情况.一个相关的问题是学习隐马尔可夫模型,这是一种概率自动机,可以描述一个字符序列.请注意,编程语言中使用的大多数现代正则表达式"实际上比正则语言更强大,因此有时更难学习.
The book An Introduction to Computational Learning Theory contains an algorithm for learning a finite automaton. As every regular language is equivalent to a finite automaton, it is possible to learn some regular expressions by a program. Kearns and Valiant show some cases where it is not possible to learn a finite automaton. A related problem is learning hidden Markov Models, which are probabilistic automata that can describe a character sequence. Note that most modern "regular expressions" used in programming languages are actually stronger than regular languages, and therefore sometimes harder to learn.
这篇关于计算机是否有可能“学习"?用户提供的示例的正则表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!