Release 1.3.1

* Заменил List на Set у NextUnit у класса Unit
* CodeStyle
This commit is contained in:
Mark Struchkov 2019-02-07 18:00:40 +03:00
parent ec0049d602
commit dc1e6be1bc
4 changed files with 7 additions and 14 deletions

View File

@ -6,7 +6,7 @@
<groupId>org.sadtech.autoresponder</groupId>
<artifactId>autoresponder</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.3.1-RELEASE</version>
<packaging>jar</packaging>
<build>
<plugins>

View File

@ -17,6 +17,7 @@ public class Autoresponder {
public static final Logger log = Logger.getLogger(Autoresponder.class);
private UnitService unitService;
private PersonService personService;
public PersonService getPersonService() {
return personService;
@ -26,8 +27,6 @@ public class Autoresponder {
this.personService = personService;
}
private PersonService personService;
public Autoresponder(UnitService unitService, PersonService personService) {
this.unitService = unitService;
this.personService = personService;
@ -68,13 +67,10 @@ public class Autoresponder {
Optional<Unit> patternUnits = nextUnits.stream().filter(nextUnit -> nextUnit.getPattern() != null).filter(nextUnit -> patternReg(nextUnit, message)).max(unitPriorityComparator);
if (!patternUnits.isPresent()) {
patternUnits = nextUnits.stream().filter(nextUnit -> (textPercentageMatch(nextUnit, new HashSet<>(Collections.singleton(message))) == 100.0)).max(unitPriorityComparator);
if (!patternUnits.isPresent()) {
Parser parser = new Parser();
parser.setText(message);
parser.parse();
patternUnits = nextUnits.stream().filter(nextUnit -> textPercentageMatch(nextUnit, parser.getWords()) >= nextUnit.getMatchThreshold()).max(unitPriorityComparator);
}
Parser parser = new Parser();
parser.setText(message);
parser.parse();
patternUnits = nextUnits.stream().filter(nextUnit -> textPercentageMatch(nextUnit, parser.getWords()) >= nextUnit.getMatchThreshold()).max(unitPriorityComparator);
}
if (!patternUnits.isPresent()) {
@ -100,6 +96,7 @@ public class Autoresponder {
if (unit.getKeyWords() != null) {
Set<String> temp = new HashSet<>(unit.getKeyWords());
temp.retainAll(words);
log.info("Юнит: " + unit.getClass().getSimpleName());
log.info("Ключевые слова юнита: " + unit.getKeyWords() + " (" + unit.getKeyWords().size() + ")");
log.info("Ключевые слова от пользователя: " + words);
log.info("Пересечение: " + temp + " (" + temp.size() + ")");

View File

@ -1,9 +1,7 @@
package org.sadtech.autoresponder.service;
import org.sadtech.autoresponder.entity.Unit;
import org.sadtech.autoresponder.repository.UnitRepository;
import java.util.List;
import java.util.Set;
public interface UnitService {

View File

@ -5,8 +5,6 @@ import org.sadtech.autoresponder.entity.Unit;
import org.sadtech.autoresponder.repository.UnitRepository;
import org.sadtech.autoresponder.service.UnitService;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class UnitServiceImpl implements UnitService {