### Question:
TermFrequencyVector { public int distance(TermFrequencyVector other) { int dplus = 0; int dminus = 0; for (Integer word : this.tf.keySet()) { int delta = this.tf.value(word) - other.tf.value(word); if (delta > 0) { dplus += delta; } else { dminus -= delta; } } for (Integer word : other.tf.keySet()) { if (!this.tf.containsKey(word)) { int delta = this.tf.value(word) - other.tf.value(word); if (delta > 0) { dplus += delta; } else { dminus -= delta; } } } return Math.max(dplus, dminus); } TermFrequencyVector(String s); int distance(TermFrequencyVector other); int total(); @Override String toString();  }### Answer:
@Test public void testDistance() { System.out.println("distance"); TermFrequencyVector tf1 = new TermFrequencyVector(s1); TermFrequencyVector tf2 = new TermFrequencyVector(s2); int expResult = EditDistance.wordDistance(s1, s2, 1000)[2]; int result = tf1.distance(tf2); assertEquals(expResult, result); }