### Question:
EditDistance { public static int charDistance(String s1, String s2, EdOpWeight w, int chunkLen) { EditSequence seq = new EditSequence(s1, s2, w, chunkLen); return seq.cost(s1, s2, w); }  static int charDistance(String s1, String s2, EdOpWeight w, int chunkLen); static int[] wordDistance(String s1, String s2, int chunkLen); static int[] wordDistance(String s1, String s2,
            WordSet stopwords, int chunkLen); static int distance(String first, String second,
            int chunkLen, EditDistanceType type); static void main(String[] args);  }### Answer:
@Test public void testWeights() { System.out.println("Weighted distance"); EdOpWeight w = new OcrOpWeight(); String s1 = "a b"; String s2 = "acb"; int expResult = 2; int result = EditDistance.charDistance(s1, s2, w, 50); assertEquals(expResult, result); }
@Test public void testWeightedDistance() { String s1 = "ÁÁÁÁ"; String s2 = "ÁAáa"; OcrOpWeight W = new OcrOpWeight(); String r1 = StringNormalizer.canonical(s1, false, false, false); String r2 = StringNormalizer.canonical(s2, false, false, false); assertEquals(3, EditDistance.charDistance(r1, r2, W, 1000)); W = new OcrOpWeight(true); r1 = StringNormalizer.canonical(s1, true, true, true); r2 = StringNormalizer.canonical(s2, true, true, true); assertEquals(0, EditDistance.charDistance(r1, r2, W, 1000)); W = new OcrOpWeight(true); r1 = StringNormalizer.canonical(s1, false, true, true); r2 = StringNormalizer.canonical(s2, false, true, true); assertEquals(2, EditDistance.charDistance(r1, r2, W, 1000)); W = new OcrOpWeight(true); r1 = StringNormalizer.canonical(s1, true, false, true); r2 = StringNormalizer.canonical(s2, true, false, true); assertEquals(2, EditDistance.charDistance(r1, r2, W, 1000)); }