Exemple #1
0
def get_fact(csubj, cpred, ctime, ctruth):
    try:
        subj = Namable.from_clips(csubj)
    except clips.ClipsError:
        subj = Word.from_clips(csubj)
    pred = Namable.from_clips(cpred)
    t = Time.from_clips(ctime)
    truth = int(str(ctruth))
    fact = Fact(subj, pred, t, truth=truth)
    return fact
Exemple #2
0
 def from_clips(cls, instance):
     if not isinstance(instance, clips._clips_wrap.Instance):
         instance = clips.FindInstance(instance)
     s = instance.GetSlot('subject')
     if isinstance(instance, clips._clips_wrap.Class):
         s = Word.from_clips(s)
     else:
         s = Namable.from_clips(s)
     p = Exists.from_clips(instance.GetSlot('predicate'))
     t = Time.from_clips(instance.GetSlot('time'))
     truth = instance.GetSlot('truth')
     return Fact(s, p, t, truth=truth)
Exemple #3
0
def factback(csubj, cpred, ctime, ctruth):
    """
    """
    try:
        subj = Namable.from_clips(csubj)
    except clips.ClipsError:
        subj = Word.from_clips(csubj)
    pred = Namable.from_clips(cpred)
    t = Time.from_clips(ctime)
    truth = int(str(ctruth))
    fact = Fact(subj, pred, t, truth=truth)
    pred.in_fact(fact)
    for plugin in utils.plugins:
        plugin(fact)