### Question:
TextSimilarity { public static double oliverSimilarity(String text1, String text2) { preprocessDocument(text1); preprocessDocument(text2); String smallerDoc=text1; String biggerDoc=text2; if(text1.length()>text2.length()) { smallerDoc=text2; biggerDoc=text1; } double p=PHPSimilarText.similarityPercentage(smallerDoc, biggerDoc); p/=100.0; return p; }  static double oliverSimilarity(String text1, String text2); static double shinglerSimilarity(String text1, String text2, int w);  }### Answer:
@Test public void testOliverSimilarity() { logger.info("oliverSimilarity"); String text1 = "This book has been written against a background of both reckless optimism and reckless despair. It holds that Progress and Doom are two sides of the same medal; that both are articles of superstition, not of faith. It was written out of the conviction that it should be possible to discover the hidden mechanics by which all traditional elements of our political and spiritual world were dissolved into a conglomeration where everything seems to have lost specific value, and has become unrecognizable for human comprehension, unusable for human purpose. Hannah Arendt, The Origins of Totalitarianism (New York: Harcourt Brace Jovanovich, Inc., 1973 ed.), p.vii, Preface to the First Edition."; String text2 = "The first edition of The Origins of Totalitarianism was written in 1950. Soon after the Second World War, this was a time of both reckless optimism and reckless despair. During this time, Dr. Arendt argues, the traditional elements of the political and spiritual world were dissolved into a conglomeration where everything seems to have lost specific value. In particular, the separation between the State and Society seems to have been destroyed. In this book, she seeks to disclose the hidden mechanics by which this transformation occurred."; double expResult = 0.4064777327935223; double result = TextSimilarity.oliverSimilarity(text1, text2); Assert.assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH); }