Merge tag 'release-1.3.1' into develop
release-1.3.1
This commit is contained in:
commit
086c14e9d6
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>org.sadtech.autoresponder</groupId>
|
<groupId>org.sadtech.autoresponder</groupId>
|
||||||
<artifactId>autoresponder</artifactId>
|
<artifactId>autoresponder</artifactId>
|
||||||
<version>1.4.0-SNAPSHOT</version>
|
<version>1.3.1-RELEASE</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -17,6 +17,7 @@ public class Autoresponder {
|
|||||||
public static final Logger log = Logger.getLogger(Autoresponder.class);
|
public static final Logger log = Logger.getLogger(Autoresponder.class);
|
||||||
|
|
||||||
private UnitService unitService;
|
private UnitService unitService;
|
||||||
|
private PersonService personService;
|
||||||
|
|
||||||
public PersonService getPersonService() {
|
public PersonService getPersonService() {
|
||||||
return personService;
|
return personService;
|
||||||
@ -26,8 +27,6 @@ public class Autoresponder {
|
|||||||
this.personService = personService;
|
this.personService = personService;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PersonService personService;
|
|
||||||
|
|
||||||
public Autoresponder(UnitService unitService, PersonService personService) {
|
public Autoresponder(UnitService unitService, PersonService personService) {
|
||||||
this.unitService = unitService;
|
this.unitService = unitService;
|
||||||
this.personService = personService;
|
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);
|
Optional<Unit> patternUnits = nextUnits.stream().filter(nextUnit -> nextUnit.getPattern() != null).filter(nextUnit -> patternReg(nextUnit, message)).max(unitPriorityComparator);
|
||||||
|
|
||||||
if (!patternUnits.isPresent()) {
|
if (!patternUnits.isPresent()) {
|
||||||
patternUnits = nextUnits.stream().filter(nextUnit -> (textPercentageMatch(nextUnit, new HashSet<>(Collections.singleton(message))) == 100.0)).max(unitPriorityComparator);
|
Parser parser = new Parser();
|
||||||
if (!patternUnits.isPresent()) {
|
parser.setText(message);
|
||||||
Parser parser = new Parser();
|
parser.parse();
|
||||||
parser.setText(message);
|
patternUnits = nextUnits.stream().filter(nextUnit -> textPercentageMatch(nextUnit, parser.getWords()) >= nextUnit.getMatchThreshold()).max(unitPriorityComparator);
|
||||||
parser.parse();
|
|
||||||
patternUnits = nextUnits.stream().filter(nextUnit -> textPercentageMatch(nextUnit, parser.getWords()) >= nextUnit.getMatchThreshold()).max(unitPriorityComparator);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!patternUnits.isPresent()) {
|
if (!patternUnits.isPresent()) {
|
||||||
@ -100,6 +96,7 @@ public class Autoresponder {
|
|||||||
if (unit.getKeyWords() != null) {
|
if (unit.getKeyWords() != null) {
|
||||||
Set<String> temp = new HashSet<>(unit.getKeyWords());
|
Set<String> temp = new HashSet<>(unit.getKeyWords());
|
||||||
temp.retainAll(words);
|
temp.retainAll(words);
|
||||||
|
log.info("Юнит: " + unit.getClass().getSimpleName());
|
||||||
log.info("Ключевые слова юнита: " + unit.getKeyWords() + " (" + unit.getKeyWords().size() + ")");
|
log.info("Ключевые слова юнита: " + unit.getKeyWords() + " (" + unit.getKeyWords().size() + ")");
|
||||||
log.info("Ключевые слова от пользователя: " + words);
|
log.info("Ключевые слова от пользователя: " + words);
|
||||||
log.info("Пересечение: " + temp + " (" + temp.size() + ")");
|
log.info("Пересечение: " + temp + " (" + temp.size() + ")");
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package org.sadtech.autoresponder.service;
|
package org.sadtech.autoresponder.service;
|
||||||
|
|
||||||
import org.sadtech.autoresponder.entity.Unit;
|
import org.sadtech.autoresponder.entity.Unit;
|
||||||
import org.sadtech.autoresponder.repository.UnitRepository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public interface UnitService {
|
public interface UnitService {
|
||||||
|
@ -5,8 +5,6 @@ import org.sadtech.autoresponder.entity.Unit;
|
|||||||
import org.sadtech.autoresponder.repository.UnitRepository;
|
import org.sadtech.autoresponder.repository.UnitRepository;
|
||||||
import org.sadtech.autoresponder.service.UnitService;
|
import org.sadtech.autoresponder.service.UnitService;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class UnitServiceImpl implements UnitService {
|
public class UnitServiceImpl implements UnitService {
|
||||||
|
Loading…
Reference in New Issue
Block a user