From c7eda5c61d396a846a0f2a1400469d0c72aee2d5 Mon Sep 17 00:00:00 2001 From: Mark Struchkov Date: Fri, 12 Jul 2019 11:38:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B0=D1=80=D1=81=D0=B5=D1=80?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/sadtech/autoresponder/util/Parser.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/sadtech/autoresponder/util/Parser.java b/src/main/java/org/sadtech/autoresponder/util/Parser.java index da76c27..ffff117 100644 --- a/src/main/java/org/sadtech/autoresponder/util/Parser.java +++ b/src/main/java/org/sadtech/autoresponder/util/Parser.java @@ -1,10 +1,7 @@ package org.sadtech.autoresponder.util; import java.util.Arrays; -import java.util.HashSet; import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -27,12 +24,13 @@ public class Parser { /** * Метод по разбиению строки на множество слов + * * @param text Строка * @return Множество слов */ public static Set parse(String text) { String[] split = text.split("\\P{L}+"); - Set words = new HashSet<>(Arrays.asList(split)); + Set words = Arrays.stream(split).map(String::toLowerCase).collect(Collectors.toSet()); words.removeAll(pretexts); return words; }