Esempio n. 1
0
    // Make the decision: is it Logical or Visual?
    public override string GetCharsetName()
    {
        // If the final letter score distance is dominant enough, rely on it.
        int finalsub = finalCharLogicalScore - finalCharVisualScore;

        if (finalsub >= MIN_FINAL_CHAR_DISTANCE)
        {
            return(LOGICAL_NAME);
        }
        if (finalsub <= -(MIN_FINAL_CHAR_DISTANCE))
        {
            return(VISUAL_NAME);
        }

        // It's not dominant enough, try to rely on the model scores instead.
        float modelsub = logicalProber.GetConfidence() - visualProber.GetConfidence();

        if (modelsub > MIN_MODEL_DISTANCE)
        {
            return(LOGICAL_NAME);
        }
        if (modelsub < -(MIN_MODEL_DISTANCE))
        {
            return(VISUAL_NAME);
        }

        // Still no good, back to final letter distance, maybe it'll save the day.
        if (finalsub < 0)
        {
            return(VISUAL_NAME);
        }

        // (finalsub > 0 - Logical) or (don't know what to do) default to Logical.
        return(LOGICAL_NAME);
    }
Esempio n. 2
0
 /// <summary>
 /// New Result
 /// </summary>
 public DetectionDetail(CharsetProber prober, TimeSpan?time = null)
     : this(prober.GetCharsetName(), prober.GetConfidence(), prober, time)
 {
 }