From c39bc3c6ca3e302e309bcc459a1338d95d4711c5 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Tue, 25 Oct 2022 16:51:51 +0400 Subject: [PATCH] #74 -- fix --- .../ulstu/extractor/rule/service/FuzzyInferenceService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/ulstu/extractor/rule/service/FuzzyInferenceService.java b/src/main/java/ru/ulstu/extractor/rule/service/FuzzyInferenceService.java index 1a4fe35..88e0026 100644 --- a/src/main/java/ru/ulstu/extractor/rule/service/FuzzyInferenceService.java +++ b/src/main/java/ru/ulstu/extractor/rule/service/FuzzyInferenceService.java @@ -116,7 +116,9 @@ public class FuzzyInferenceService { if (outputVariable != null) { outputVariable.defuzzify(); } - return outputVariable == null ? "" : outputVariable.highestMembership(outputVariable.getValue()).getSecond().getName(); + return (outputVariable == null || Double.isNaN(outputVariable.getValue())) + ? "Нет рекомендаций" + : outputVariable.highestMembership(outputVariable.getValue()).getSecond().getName(); //return outputVariable == null ? "" : outputVariable.fuzzyOutputValue(); } }