public void setBasePartialMatchTruth(Proposition prop, Keyword truth) { { PartialMatchFrame self = this; prop = prop; if (truth == Logic.KWD_TRUE) { KeyValueList.setDynamicSlotValue( ((QueryIterator) (Logic.$QUERYITERATOR$.get())).dynamicSlots, Logic.SYM_LOGIC_LATEST_POSITIVE_SCORE, FloatWrapper.wrapFloat(1.0), Stella.NULL_FLOAT_WRAPPER); } else if (truth == Logic.KWD_FAIL) { KeyValueList.setDynamicSlotValue( ((QueryIterator) (Logic.$QUERYITERATOR$.get())).dynamicSlots, Logic.SYM_LOGIC_LATEST_POSITIVE_SCORE, FloatWrapper.wrapFloat(0.0), Stella.NULL_FLOAT_WRAPPER); } else { { OutputStringStream stream000 = OutputStringStream.newOutputStringStream(); stream000.nativeStream.print("`" + truth + "' is not a valid case option"); throw ((StellaException) (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace())); } } } }
public void setFramePartialTruth( TruthValue truthvalue, double posscore, double negscore, boolean ignorepolarityP) { { PartialMatchFrame self = this; { boolean flippolarityP = self.controlFrame.reversePolarityP && (!ignorepolarityP); if ((posscore == Stella.NULL_FLOAT) && (truthvalue != null)) { posscore = truthvalue.positiveScore; } if ((negscore == Stella.NULL_FLOAT) && (truthvalue != null)) { negscore = TruthValue.invertTruthValue(truthvalue).positiveScore; } if (flippolarityP) { { double aux = posscore; posscore = 0 - posscore; negscore = aux; } } self.positiveScore = posscore; self.negativeScore = negscore; KeyValueList.setDynamicSlotValue( ((QueryIterator) (Logic.$QUERYITERATOR$.get())).dynamicSlots, Logic.SYM_LOGIC_LATEST_POSITIVE_SCORE, FloatWrapper.wrapFloat(posscore), Stella.NULL_FLOAT_WRAPPER); } } }
public void propagateFramePartialTruth(ControlFrame target) { { PartialMatchFrame source = this; { PartialMatchFrame targetpmf = target.partialMatchFrame; boolean flippolarityP = !(source.controlFrame.reversePolarityP == target.reversePolarityP); if (targetpmf == null) { if (flippolarityP) { targetpmf = ((PartialMatchFrame) (Surrogate.createObject( source.primaryType(), Stella_Object.cons( Logic.KWD_CONTROL_FRAME, Stella_Object.cons( target, Stella_Object.cons( Logic.KWD_KIND, Stella_Object.cons(target.state, Stella.NIL))))))); targetpmf.parent = source.parent; targetpmf.child = source; } else { targetpmf = source; } target.partialMatchFrame = targetpmf; } if (flippolarityP) { targetpmf.positiveScore = 0 - source.positiveScore; targetpmf.negativeScore = source.positiveScore; } else { targetpmf.positiveScore = source.positiveScore; targetpmf.negativeScore = source.negativeScore; } KeyValueList.setDynamicSlotValue( ((QueryIterator) (Logic.$QUERYITERATOR$.get())).dynamicSlots, Logic.SYM_LOGIC_LATEST_POSITIVE_SCORE, FloatWrapper.wrapFloat(targetpmf.positiveScore), Stella.NULL_FLOAT_WRAPPER); } } }
public void initializePartialMatchStrategy(QueryIterator query) { { PartialMatchFrame self = this; { FloatWrapper minimumscore = ((FloatWrapper) (query.options.lookup(Logic.KWD_MINIMUM_SCORE))); double epsilon = 0.001; query.partialMatchStrategy = self; self.dynamicCutoff = ((minimumscore != null) ? minimumscore.wrapperValue : epsilon); KeyValueList.setDynamicSlotValue( query.dynamicSlots, Logic.SYM_LOGIC_LATEST_POSITIVE_SCORE, FloatWrapper.wrapFloat(0.0), Stella.NULL_FLOAT_WRAPPER); } } }
public static Stella_Object accessPartialMatchFrameSlotValue( PartialMatchFrame self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Logic.SYM_LOGIC_KIND) { if (setvalueP) { self.kind = ((Keyword) (value)); } else { value = self.kind; } } else if (slotname == Logic.SYM_LOGIC_CONTROL_FRAME) { if (setvalueP) { self.controlFrame = ((ControlFrame) (value)); } else { value = self.controlFrame; } } else if (slotname == Logic.SYM_LOGIC_PARENT) { if (setvalueP) { self.parent = ((PartialMatchFrame) (value)); } else { value = self.parent; } } else if (slotname == Logic.SYM_LOGIC_CHILD) { if (setvalueP) { self.child = ((PartialMatchFrame) (value)); } else { value = self.child; } } else if (slotname == Logic.SYM_LOGIC_POSITIVE_SCORE) { if (setvalueP) { self.positiveScore = ((FloatWrapper) (value)).wrapperValue; } else { value = FloatWrapper.wrapFloat(self.positiveScore); } } else if (slotname == Logic.SYM_LOGIC_NEGATIVE_SCORE) { if (setvalueP) { self.negativeScore = ((FloatWrapper) (value)).wrapperValue; } else { value = FloatWrapper.wrapFloat(self.negativeScore); } } else if (slotname == Logic.SYM_LOGIC_DYNAMIC_CUTOFF) { if (setvalueP) { self.dynamicCutoff = ((FloatWrapper) (value)).wrapperValue; } else { value = FloatWrapper.wrapFloat(self.dynamicCutoff); } } else if (slotname == Logic.SYM_LOGIC_ARGUMENT_SCORES) { if (setvalueP) { self.argumentScores = ((Cons) (value)); } else { value = self.argumentScores; } } else if (slotname == Logic.SYM_LOGIC_ARGUMENT_WEIGHTS) { if (setvalueP) { self.argumentWeights = ((Cons) (value)); } else { value = self.argumentWeights; } } else if (slotname == Logic.SYM_LOGIC_UNBOUND_VARS) { if (setvalueP) { self.unboundVars = ((Cons) (value)); } else { value = self.unboundVars; } } else if (slotname == Logic.SYM_LOGIC_SUCCESSp) { if (setvalueP) { self.successP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value))); } else { value = (self.successP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER); } } else { { OutputStringStream stream000 = OutputStringStream.newOutputStringStream(); stream000.nativeStream.print("`" + slotname + "' is not a valid case option"); throw ((StellaException) (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace())); } } return (value); }