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 traceFramePartialTruth(Keyword lastmove, OutputStream stream) { { PartialMatchFrame self = this; { double weight = self.propositionWeight(self.controlFrame.proposition); if (lastmove == Logic.KWD_DOWN) { { double cutoff = self.computeDynamicCutoff(); if (cutoff != Stella.NULL_FLOAT) { stream.nativeStream.print("cutoff=" + cutoff); } } } else if ((lastmove == Logic.KWD_UP_TRUE) || (lastmove == Logic.KWD_UP_FAIL)) { { double score = self.positiveScore; stream.nativeStream.print("score=" + score); if ((weight != Stella.NULL_FLOAT) && (!(weight == 1.0))) { stream.nativeStream.print(" weight=" + weight); } } } else { } } } }
public void clearFramePartialTruth() { { PartialMatchFrame self = this; self.positiveScore = Stella.NULL_FLOAT; self.negativeScore = Stella.NULL_FLOAT; } }
public void setDynamicCutoff() { { PartialMatchFrame self = this; { double cutoff = self.computeDynamicCutoff(); if (cutoff != Stella.NULL_FLOAT) { if ((cutoff < -100) || (cutoff > 100)) { Stella.STANDARD_WARNING.nativeStream.println( "Warning: *** fishy dynamic cutoff=`" + cutoff + "' computed, resetting to 0.0"); cutoff = 0.0; } self.dynamicCutoff = cutoff; } } } }
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 void linkToParentPartialMatchFrame(PartialMatchFrame self) { { ControlFrame controlframe = self.controlFrame.up; while ((controlframe != null) && (controlframe.partialMatchFrame == null)) { controlframe = controlframe.up; } if (controlframe != null) { self.parent = controlframe.partialMatchFrame; controlframe.partialMatchFrame.child = self; } } }
public PartialMatchFrame createPartialMatchFrame(ControlFrame frame, Keyword kind) { { PartialMatchFrame self = this; { frame = frame; kind = kind; } { OutputStringStream stream000 = OutputStringStream.newOutputStringStream(); { stream000.nativeStream.println( "Missing concrete method named 'create-partial-match-frame' on the"); stream000.nativeStream.print(" class `" + self.primaryType() + "'"); } ; throw ((StellaException) (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace())); } } }
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 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); }