private void compareApiUsage ( ) throws ApiException , JsonProcessingException { LOG . info ( "The Compare API usage." ) ; Compare compareApiInstance = retinaApisInstance . compareApi ( ) ; LOG . info ( "Compare API: compare" ) ; Metric metric = compareApiInstance . compare ( new Term ( "apple" ) , new Term ( "banana" ) ) ; logMetric ( metric ) ; String inputText = "Gustav Klimt (July 14, 1862 – February 6, 1918) was an Austrian symbolist painter and one " + "of the most prominent members of the Vienna Secession movement. Klimt is noted for his paintings, " + "murals, sketches, and other objets d'art. Klimt's primary subject was the female body;[1] " + "his works are marked by a frank eroticism.[2]" ; metric = compareApiInstance . compare ( new Term ( "painter" ) , new Text ( inputText ) ) ; logMetric ( metric ) ; LOG . info ( "Compare API: compareBulk" ) ; CompareModels toCompare1 = new CompareModels ( new Term ( "apple" ) , new Term ( "banana" ) ) ; CompareModels toCompare2 = new CompareModels ( new Term ( "banana" ) , new Term ( "fruit" ) ) ; CompareModels toCompare3 = new CompareModels ( new Term ( "apple" ) , new Term ( "orange" ) ) ; CompareModels [ ] toCompareBulk = { toCompare1 , toCompare2 , toCompare3 } ; Metric [ ] metrics = compareApiInstance . compareBulk ( toCompareBulk ) ; for ( Metric metricFromBulk : metrics ) { logMetric ( metricFromBulk ) ; } }
The Compare API usage .