Skip to content

Commit

Permalink
use ws server 1.1.1; NLU and service improvements to media control
Browse files Browse the repository at this point in the history
  • Loading branch information
fquirin committed May 31, 2019
1 parent 9f6607b commit c4122e1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<dependency>
<groupId>net.b07z.sepia.websockets</groupId>
<artifactId>sepia-websockets</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</dependency>
<!-- included in sepia-websockets
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public String extract(String input) {
off = "(mach|schalte|dreh) .*\\b(aus)|"
+ "^\\w+\\b (aus$)|"
+ "schliessen|schliesse|deaktivieren|deaktiviere|"
+ "beenden|beende|ausschalten|aus schalten|ausmachen|aus machen|ausdrehen|aus drehen|stop(pen|pe|p|)|exit";
+ "beenden|beende|(aus|ab)schalten|aus schalten|ausmachen|aus machen|ausdrehen|aus drehen|stop(pen|pe|p|)|exit";
pause = "pausieren|pause|anhalten|halte .*\\b(an)";
increase = "(mach|dreh) .*\\b(auf|hoch)|"
+ "(?<!(wie ))hoch|rauf|hoeher|groesser|erhoehen|aufdrehen|erhoehe|verstaerk(en|e)|heller|(?<!(ist ))schneller|(?<!(ist ))staerker|waermer|warm|lauter|laut";
Expand Down Expand Up @@ -253,7 +253,7 @@ public String remove(String input, String found) {
}
if (language.matches(LANGUAGES.DE)){
input = input.replaceFirst("\\b(mach|schalte|dreh|nimm|fuege|trage)\\b", "");
input = input.replaceFirst("\\b(an|ein|aus|auf|zu|von|hoch|runter|hinzu)$", "").trim();
input = input.replaceFirst("\\b(an|ein|aus|ab|auf|zu|von|hoch|runter|hinzu)$", "").trim();
}else{
input = input.replaceFirst("\\b(make|switch|turn|shut|take|put|add|enter)( on| off| up| down| to|)\\b", "");
input = input.replaceFirst("\\b(on|off|up|down)$", "").trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ public String extract(String input) {
String play, pause, stop, close, next, previous, resume, repeat, vol_up, vol_down, vol_set;
//German
if (language.matches(LANGUAGES.DE)){
play = "(spiele(n|)|abspielen|starten|oeffne(n|)|play)(?!.*\\b(naechste(\\w|)|vorherige(\\w|)))";
play = "(spiele(n|)|abspielen|starten|oeffne(n|)|play)(?!.*\\b(naechste(\\w|)|vorherige(\\w|)))|(an|ein)schalten|an$|ein$";
pause = "pausieren|pause|anhalten";
stop = "stoppen|stop(p|)";
close = "schliesse(n|)";
close = "schliesse(n|)|(aus|ab)schalten|aus$";
next = "naechste(\\w|)|vorwaerts|vor|next";
previous = "zurueck|vorherige(\\w|)";
resume = "weiter|fortsetzen";
Expand All @@ -142,10 +142,10 @@ public String extract(String input) {

//English and other
}else{
play = "(play|start|open)(?!.*\\b(next|previous))";
play = "(play|start|open)(?!.*\\b(next|previous))|turn on|on$";
pause = "pause";
stop = "stop|end";
close = "close";
stop = "stop";
close = "close|end|off";
next = "next|forward";
previous = "back|previous";
resume = "continue|resume";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import net.b07z.sepia.server.assist.assistant.LANGUAGES;
import net.b07z.sepia.server.assist.data.Parameter;
import net.b07z.sepia.server.assist.interpreters.NluResult;
import net.b07z.sepia.server.assist.interpreters.NluTools;
import net.b07z.sepia.server.assist.interviews.InterviewData;
import net.b07z.sepia.server.assist.parameters.Action;
import net.b07z.sepia.server.assist.parameters.ClientFunction;
import net.b07z.sepia.server.assist.parameters.MediaControls;
Expand Down Expand Up @@ -80,8 +78,8 @@ public ServiceInfo getInfo(String language) {
+ "(.* |)medi(a|en)(-| |)(player|wiedergabe)( .*|)|"
+ "(.* |)(naechste(\\w|)|vorherige(\\w|)) (musik|song|lied|medien|media|titel)( .*|)|"
+ "(naechste(\\w|)|vorherige(\\w|)|vor|zurueck|stop(pen|p|)|play|abspielen|lauter|leiser|fortsetzen|weiter)|"
+ "(.* |)(musik|song|lied|medien|media|titel|player|wiedergabe) (anhalten|stoppen|stop(p|)|beenden|schliessen|fortsetzen|weiter|wiederholen)( .*|)|"
+ "(.* |)(stoppe|stop(p|)|schliesse)( .* | )(musik|song|lied|medien|media|titel|player|sound|wiedergabe)( .*|)"
+ "(.* |)(musik|song|lied|medien|media|titel|player|wiedergabe) (anhalten|stoppen|stop(p|)|beenden|schliessen|(aus|ab)schalten|fortsetzen|weiter|wiederholen)( .*|)|"
+ "(.* |)(stoppe|stop(p|)|schliesse|schalte|beende|halte)( .* | )(musik|song|lied|medien|media|titel|player|sound|wiedergabe)( .*|)"
+ ")$", DE);
info.setCustomTriggerRegX("^("
+ "(.* |)open setting(s|)( .*|)|"
Expand Down Expand Up @@ -177,20 +175,20 @@ public ServiceResult getResult(NluResult nluResult) {
}
}else if (isMedia && !isVolume){
//media support
if (mediaControls.equals(MediaControls.Type.close.name())){
if (mediaControls.equals(MediaControls.Type.close.name()) || action.equals(Action.Type.remove.name())){
actionName = "close";
}else if (mediaControls.equals(MediaControls.Type.stop.name())){
}else if (mediaControls.equals(MediaControls.Type.stop.name()) || action.equals(Action.Type.off.name())){
actionName = "stop";
}else if (mediaControls.equals(MediaControls.Type.pause.name())){
}else if (mediaControls.equals(MediaControls.Type.pause.name()) || action.equals(Action.Type.pause.name())){
actionName = "pause";
}else if (mediaControls.equals(MediaControls.Type.play.name())){
actionName = "play";
}else if (mediaControls.equals(MediaControls.Type.next.name())){
actionName = "next";
}else if (mediaControls.equals(MediaControls.Type.previous.name())){
actionName = "previous";
}else if (mediaControls.equals(MediaControls.Type.resume.name())){
actionName = "resume";
}else if (mediaControls.equals(MediaControls.Type.play.name()) || isActionOpen){
actionName = "play";
/*}else if (isActionOpen){
}else if (isActionClose){*/
Expand Down

0 comments on commit c4122e1

Please sign in to comment.