Release 1.3.1
* Заменил List на Set у NextUnit у класса Unit * CodeStyle
This commit is contained in:
parent
ec0049d602
commit
dc1e6be1bc
2
pom.xml
2
pom.xml
@ -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>
|
||||
|
@ -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() + ")");
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user