Pyke integrates a form of Logic Programming into Python by providing a knowledge engine that can:
* Do both forward-chaining (data driven) and backward-chaining (goal directed) inferencing.
o Pyke may be embedded into any Python program.
* Automatically generate Python programs by assembling individual Python functions into complete call graphs.
o This is done through a unique design where the individual Python functions are attached to backward-chaining rules.
o Unlike other approaches to code reuse (e.g. Object-oriented programming, Zope adapters, generic functions), this allows the inference engine to ensure that all of the function's requirements are completely satisfied, by examining the entire call graph down to the leaves, before any of the functions are executed.
o This is an optional feature. You don't need to use it if you just want the inferencing capability by itself.
Pyke提供一个知识引擎将一种逻辑编程语言整合进Python中:
*通过一个专门的设计将单独的Python功能关联到后向链接规则中。
*不同于其他代码重用的方式(例如面向对象编程,Zope适配器,通用函数)。Pyke允许推理机通过在执行功能前检查整个调用图直到叶节点,来确保所有的功能需求是完全合适的。
*这是一个可选特性。如果你只想要它的推理能力,你不需要一定使用它
The Knowledge Engine Supports:
* Multiple fact bases, each with its own list of facts.
* Both forward-chaining rules and backward-chaining rules.
* Multiple rule bases, each with its own list of forward-chaining and/or backward-chaining rules.
* Rule base inheritance -- activating the derived rule base includes the rules from the parent rule base.
* The inference rules are compiled into Python functions, allowing Python code snippets to be used within the rules. This greatly enhances the expressiveness of the rules.
知识引擎支持:
Automatic Program Generation:
* Calls the generated Python programs plans.
* Plans may be run multiple times without needing to rerun the inference rules.
* Plans may be pickled and cached to disk to be used by other programs or in later runs of the same program.
* Only one small Pyke module is required to run the plans.
程序自动生成:
Potential Pyke Applications:
* Complicated decision making applications.
* The back-end (code generation and optimization) of compilers. Pyke is used as the back-end of its own compiler that translates rules into Python code.
* Automatic SQL statement generation.
* Automatic HTML generation and automatic HTML template processing.
* Automatic program builder to reuse a common set of functions for many different specific situations. This could also easily incorporate a new custom function into a much larger program, where the use of the custom function might influence the choice of other standard functions in other parts of the program.
* The control module for a web framework tool.
* A high-level planner to automatically distribute the modules of a large system over several computers in a distributed system to meet specific performance and capacity goals. This could be used to automatically scale the same system code from a small one program, one computer system to much larger distributed systems to meet a wide range of performance goals.
* Diagnosis systems, including automated customer service systems.
* Program or library customization for specific uses.
* In addition to being able to build programs, Pyke can instantiate, configure and interconnect a network of objects to meet a specific need or situation.
Pyke可能的应用:
-----------------
硬是没看懂……