且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在clipspy中获取事实值并将其存储在python变量中

更新时间:2022-12-12 13:02:05

您可以通过事实迭代器访问环境事实.

You can access to the environment facts via the facts iterator.

根据事实是有序或无序.

for fact in env.facts():
    if fact.template.name == 'dis':
        print(fact[0])

关于注释中的问题,取决于您的应用程序.对于您的情况,我建议使用事实来代表决策结果.事实代表了专家的系统知识,因此非常适合.

Regarding your question in the comments, it depends on your application. In your case, I would recommend to use facts to represent the decision outcome. Expert systems knowledge is represented by facts and therefore it's a good fit.

您可以使用生成的知识来进一步推理并激活更多规则,例如,可以对用户生病这一事实做出反应并采取相应的行动.

You can use the generated knowledge to further reason and activate more rules which, for example, could react to the fact the User is ill and take actions accordingly.