Ejemplo n.º 1
0
double
characteristic_distance (array<string> a1, array<string> a2) {
  double d_mono    = discrete_distance (a1, a2, "mono") * 2.0;
  double d_sans    = discrete_distance (a1, a2, "sans") * 2.0;
  double d_italic  = discrete_distance (a1, a2, "italic") * 2.0;
  double d_case    = discrete_distance (a1, a2, "case") * 2.0;
  double d_ex      = relative_distance (a1, a2, "ex", 1.5);
  double d_em      = relative_distance (a1, a2, "em", 1.5);
  double d_lvw     = relative_distance (a1, a2, "lvw", 2.0);
  double d_lhw     = relative_distance (a1, a2, "lhw", 2.0);
  double d_fillp   = relative_distance (a1, a2, "fillp", 1.25);
  double d_vcnt    = relative_distance (a1, a2, "vcnt", 1.25);
  double d_lasprat = relative_distance (a1, a2, "lasprat", 1.33);
  double d_pasprat = relative_distance (a1, a2, "pasprat", 1.33);
  double d_loasc   = relative_distance (a1, a2, "loasc", 1.5);
  double d_lodes   = relative_distance (a1, a2, "lodes", 1.5);
  double d_dides   = relative_distance (a1, a2, "dides", 1.5);
  double d_slant   = numeric_distance  (a1, a2, "slant", 33.3) * 3.0;
  //double d_upw     = vector_distance   (a1, a2, "upw", 0.33);
  //double d_uph     = vector_distance   (a1, a2, "uph", 0.33);
  //double d_upc     = vector_distance   (a1, a2, "upc", 0.33);
  //double d_low     = vector_distance   (a1, a2, "low", 0.33);
  //double d_loh     = vector_distance   (a1, a2, "loh", 0.33);
  //double d_loc     = vector_distance   (a1, a2, "loc", 0.33);
  double r =
    d_mono + d_sans + d_italic + d_case +
    d_ex + d_em + d_lvw + d_lhw + d_fillp + d_vcnt +
    d_lasprat + d_pasprat +
    d_loasc + d_lodes + d_dides + d_slant;
  //+ d_upw + d_uph + d_upc + d_low + d_loh + d_loc;
  //cout << a1 << ", " << a2 << "\n";
  //cout << "  ----> " << d_fillp << ", " << d_vcnt << ", " << r << "\n";
  return r;
}
 static Difference distance(Incrementable1 x, Incrementable2 y)
 {
     return numeric_distance(x, y);
 }