Esempio n. 1
0
        public float LevenshteinSimilarity(AbstractContextInfo context)
        {
            var left  = ExtendedContext.Split(' ');
            var right = LocalContext.Split(' ');

            var distance = Levenshtein.Compute(left, right);

            return(1.0f - distance / Math.Max(left.Length, right.Length));
        }
Esempio n. 2
0
        public float NormalizedLCS(AbstractContextInfo context)
        {
            var left  = ExtendedContext.Split(' ');
            var right = LocalContext.Split(' ');

            var lcs = LCS.Compute(left, right);

            return(2.0f * lcs / (left.Length + right.Length));
        }
Esempio n. 3
0
 public PredictionInfo(AbstractContextInfo context, float extendedSimilarity = 0.0f, float localSimilarity = 0.0f)
 {
     Context            = context;
     ExtendedSimilarity = extendedSimilarity;
     LocalSimilarity    = localSimilarity;
 }
Esempio n. 4
0
 public float LocalSimilarity(AbstractContextInfo context)
 {
     return(Sim.GetSimilarity(_localContext, context._localContext));
 }
Esempio n. 5
0
 public float ExtendedSimilarity(AbstractContextInfo context)
 {
     return(Sim.GetSimilarity(_extendedContext, context._extendedContext));
 }