Commit 846f616b authored by Matija Obreza's avatar Matija Obreza
Browse files

Fixed parenthesis bug

parent 2e352f15
......@@ -35,6 +35,8 @@ import org.slf4j.LoggerFactory;
*/
public class InMemoryTaxonomyDatabase implements TaxonomyDatabase {
private static final double NONMATCH_MARGIN = 0.8;
/** The Constant LOG. */
private final static Logger LOG = LoggerFactory.getLogger(InMemoryTaxonomyDatabase.class);
......@@ -130,7 +132,7 @@ public class InMemoryTaxonomyDatabase implements TaxonomyDatabase {
// debug print
// .peek(InMemoryTaxonomyDatabase::print)
// Prefer full match
.filter(scored -> scored.getScore() >= (bestScore.getBestScore() == 1.0 ? 0.95 : bestScore.getBestScore() * 0.8))
.filter(scored -> scored.getScore() >= (bestScore.getBestScore() == 1.0 ? 0.95 : (bestScore.getBestScore() * NONMATCH_MARGIN)))
// debug print
.peek(InMemoryTaxonomyDatabase::print)
// convert to suggested Strings
......@@ -231,7 +233,7 @@ public class InMemoryTaxonomyDatabase implements TaxonomyDatabase {
.peek(scored -> bestScore.update(scored.getScore()))
// keep suggestions: when bestScore is 1.0 keep suggestions over 0.95 otherwise keep suggestions within
// 80%
.filter(scored -> scored.getScore() >= (bestScore.getBestScore() == 1.0 ? 0.95 : bestScore.getBestScore() * 0.8))
.filter(scored -> scored.getScore() >= (bestScore.getBestScore() == 1.0 ? 0.95 : (bestScore.getBestScore() * 0.8)))
// print
// .peek(InMemoryTaxonomyDatabase::print)
// convert sorted Suggestion list back to Strings
......@@ -332,7 +334,7 @@ public class InMemoryTaxonomyDatabase implements TaxonomyDatabase {
.peek(scored -> bestScore.update(scored.getScore()))
// .peek(InMemoryTaxonomyDatabase::print)
// keep only nice Suggestions
.filter(scored -> scored.getScore() >= (bestScore.getBestScore() == 1.0 ? 0.95 : bestScore.getBestScore() * 0.8))
.filter(scored -> scored.getScore() >= (bestScore.getBestScore() == 1.0 ? 0.95 : (bestScore.getBestScore() * 0.8)))
// debug print
// .peek(InMemoryTaxonomyDatabase::print)
// back to Strings
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment