Skip to content

Commit

Permalink
Validate a slot value with German phonetic equivalents
Browse files Browse the repository at this point in the history
  • Loading branch information
Lerch, Kay committed Oct 4, 2016
1 parent ba9ef9f commit 1bdefc6
Show file tree
Hide file tree
Showing 109 changed files with 558 additions and 417 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ state management of your POJO models by using S3, Dynamo or Alexa session as a s
custom criteria - it was never that flexible to react on intents
* Explicit exception handling in intent handlers to have Alexa react accordingly
in any situation
* Helper methods for validating a slot value to comply with not only an exact literal
but also with a phonetic equivalent (leveraging Metaphone or Cologne Phonetic algorithm)

#### References

Expand Down Expand Up @@ -192,16 +194,23 @@ might be interesting to you:
final boolean slotIsNumber = input.hasSlotIsNumber("slotName");
final boolean slotIsNotBlank = input.hasSlotNotBlank("slotName");
final boolean slotEquals = input.hasSlotIsEqual("slotName", "someValue");
final boolean slotPhoneticEqual = input.hasSlotIsDoubleMetaphoneEqual("slotName", "drew");
// find phonetic siblings - best for English language
final boolean slotEngPhoneticEqual = input.hasSlotIsDoubleMetaphoneEqual("slotName", "drew");
// find phonetic siblings - best for German language
final boolean slotGerPhoneticEqual = input.hasSlotIsCologneEqual("slotName", "truhe");
// find phonetic siblings - picks to best algorithm based on the current locale
final boolean slotPhoneticEqual = input.hasSlotIsPhoneticallyEqual("slotName", "truhe");
final boolean slotHasTrueValue = input.hasSlotIsTrue("slotName");
// ...
}
```

So you can check a slot for a number but also for a certain value. Moreover, you
could even check for a phonetic equivalent by levering the [Double Metaphone](https://en.wikipedia.org/wiki/Metaphone#Double_Metaphone) algorithm.
could even check for a phonetic equivalent by levering [Double Metaphone](https://en.wikipedia.org/wiki/Metaphone#Double_Metaphone)
or [Cologne Phonetic](https://en.wikipedia.org/wiki/Cologne_phonetics) algorithm.
For example the line checking for value of "drew" with _hasSlotIsDoubleMetaphoneEqual_ will
return true if the slot value contains "true" as a value - which is a phonetic sibling of "drew".
However, this is not true in German language but instead the word "truhe" is a phonetic sibling for "true".
Finally you can obtain a slots value with _getSlotValue_.

#### AlexaOutput
Expand Down
6 changes: 3 additions & 3 deletions docs/apidocs/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_45) on Tue Sep 27 10:25:37 CEST 2016 -->
<!-- Generated by javadoc (1.8.0_45) on Tue Oct 04 18:52:20 CEST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>All Classes (Alexa Skills Kit Tellask SDK for Java 0.2.1 API)</title>
<meta name="date" content="2016-09-27">
<title>All Classes (Alexa Skills Kit Tellask SDK for Java 0.2.2 API)</title>
<meta name="date" content="2016-10-04">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
Expand Down
6 changes: 3 additions & 3 deletions docs/apidocs/allclasses-noframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_45) on Tue Sep 27 10:25:37 CEST 2016 -->
<!-- Generated by javadoc (1.8.0_45) on Tue Oct 04 18:52:20 CEST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>All Classes (Alexa Skills Kit Tellask SDK for Java 0.2.1 API)</title>
<meta name="date" content="2016-09-27">
<title>All Classes (Alexa Skills Kit Tellask SDK for Java 0.2.2 API)</title>
<meta name="date" content="2016-10-04">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
Expand Down
8 changes: 4 additions & 4 deletions docs/apidocs/constant-values.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_45) on Tue Sep 27 10:25:37 CEST 2016 -->
<!-- Generated by javadoc (1.8.0_45) on Tue Oct 04 18:52:19 CEST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Constant Field Values (Alexa Skills Kit Tellask SDK for Java 0.2.1 API)</title>
<meta name="date" content="2016-09-27">
<title>Constant Field Values (Alexa Skills Kit Tellask SDK for Java 0.2.2 API)</title>
<meta name="date" content="2016-10-04">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Constant Field Values (Alexa Skills Kit Tellask SDK for Java 0.2.1 API)";
parent.document.title="Constant Field Values (Alexa Skills Kit Tellask SDK for Java 0.2.2 API)";
}
}
catch(err) {
Expand Down
8 changes: 4 additions & 4 deletions docs/apidocs/deprecated-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_45) on Tue Sep 27 10:25:37 CEST 2016 -->
<!-- Generated by javadoc (1.8.0_45) on Tue Oct 04 18:52:20 CEST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Deprecated List (Alexa Skills Kit Tellask SDK for Java 0.2.1 API)</title>
<meta name="date" content="2016-09-27">
<title>Deprecated List (Alexa Skills Kit Tellask SDK for Java 0.2.2 API)</title>
<meta name="date" content="2016-10-04">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Deprecated List (Alexa Skills Kit Tellask SDK for Java 0.2.1 API)";
parent.document.title="Deprecated List (Alexa Skills Kit Tellask SDK for Java 0.2.2 API)";
}
}
catch(err) {
Expand Down
8 changes: 4 additions & 4 deletions docs/apidocs/help-doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_45) on Tue Sep 27 10:25:37 CEST 2016 -->
<!-- Generated by javadoc (1.8.0_45) on Tue Oct 04 18:52:20 CEST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>API Help (Alexa Skills Kit Tellask SDK for Java 0.2.1 API)</title>
<meta name="date" content="2016-09-27">
<title>API Help (Alexa Skills Kit Tellask SDK for Java 0.2.2 API)</title>
<meta name="date" content="2016-10-04">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="API Help (Alexa Skills Kit Tellask SDK for Java 0.2.1 API)";
parent.document.title="API Help (Alexa Skills Kit Tellask SDK for Java 0.2.2 API)";
}
}
catch(err) {
Expand Down
18 changes: 14 additions & 4 deletions docs/apidocs/index-all.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_45) on Tue Sep 27 10:25:37 CEST 2016 -->
<!-- Generated by javadoc (1.8.0_45) on Tue Oct 04 18:52:20 CEST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Index (Alexa Skills Kit Tellask SDK for Java 0.2.1 API)</title>
<meta name="date" content="2016-09-27">
<title>Index (Alexa Skills Kit Tellask SDK for Java 0.2.2 API)</title>
<meta name="date" content="2016-10-04">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Index (Alexa Skills Kit Tellask SDK for Java 0.2.1 API)";
parent.document.title="Index (Alexa Skills Kit Tellask SDK for Java 0.2.2 API)";
}
}
catch(err) {
Expand Down Expand Up @@ -556,6 +556,11 @@ <h2 class="title">H</h2>
<dd>
<div class="block">Checks if a slot is contained in the intent request.</div>
</dd>
<dt><span class="memberNameLink"><a href="io/klerch/alexa/tellask/model/AlexaInput.html#hasSlotIsCologneEqual-java.lang.String-java.lang.String-">hasSlotIsCologneEqual(String, String)</a></span> - Method in class io.klerch.alexa.tellask.model.<a href="io/klerch/alexa/tellask/model/AlexaInput.html" title="class in io.klerch.alexa.tellask.model">AlexaInput</a></dt>
<dd>
<div class="block">Checks if a slot is contained in the intent request and has a value which is a
phonetic sibling of the string given to this method.</div>
</dd>
<dt><span class="memberNameLink"><a href="io/klerch/alexa/tellask/model/AlexaInput.html#hasSlotIsDoubleMetaphoneEqual-java.lang.String-java.lang.String-">hasSlotIsDoubleMetaphoneEqual(String, String)</a></span> - Method in class io.klerch.alexa.tellask.model.<a href="io/klerch/alexa/tellask/model/AlexaInput.html" title="class in io.klerch.alexa.tellask.model">AlexaInput</a></dt>
<dd>
<div class="block">Checks if a slot is contained in the intent request and has a value which is a
Expand All @@ -569,6 +574,11 @@ <h2 class="title">H</h2>
<dd>
<div class="block">Checks if a slot is contained in the intent request and its value is a number.</div>
</dd>
<dt><span class="memberNameLink"><a href="io/klerch/alexa/tellask/model/AlexaInput.html#hasSlotIsPhoneticallyEqual-java.lang.String-java.lang.String-">hasSlotIsPhoneticallyEqual(String, String)</a></span> - Method in class io.klerch.alexa.tellask.model.<a href="io/klerch/alexa/tellask/model/AlexaInput.html" title="class in io.klerch.alexa.tellask.model">AlexaInput</a></dt>
<dd>
<div class="block">Checks if a slot is contained in the intent request and has a value which is a
phonetic sibling of the string given to this method.</div>
</dd>
<dt><span class="memberNameLink"><a href="io/klerch/alexa/tellask/model/AlexaInput.html#hasSlotIsTrue-java.lang.String-">hasSlotIsTrue(String)</a></span> - Method in class io.klerch.alexa.tellask.model.<a href="io/klerch/alexa/tellask/model/AlexaInput.html" title="class in io.klerch.alexa.tellask.model">AlexaInput</a></dt>
<dd>
<div class="block">Checks if a slot is contained in the intent request and its value represents a boolean true
Expand Down
4 changes: 2 additions & 2 deletions docs/apidocs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_45) on Tue Sep 27 10:25:37 CEST 2016 -->
<!-- Generated by javadoc (1.8.0_45) on Tue Oct 04 18:52:20 CEST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Alexa Skills Kit Tellask SDK for Java 0.2.1 API</title>
<title>Alexa Skills Kit Tellask SDK for Java 0.2.2 API</title>
<script type="text/javascript">
targetPage = "" + window.location.search;
if (targetPage != "" && targetPage != "undefined")
Expand Down
Loading

0 comments on commit 1bdefc6

Please sign in to comment.