|
7 | 7 | import net.b07z.sepia.server.assist.data.Parameter; |
8 | 8 | import net.b07z.sepia.server.assist.interpreters.NluResult; |
9 | 9 | import net.b07z.sepia.server.assist.interviews.InterviewData; |
10 | | -import net.b07z.sepia.server.assist.parameters.GenericEmptyParameter; |
| 10 | +import net.b07z.sepia.server.assist.parameters.CustomParameter; |
11 | 11 | import net.b07z.sepia.server.assist.services.ServiceBuilder; |
12 | 12 | import net.b07z.sepia.server.assist.services.ServiceInfo; |
13 | 13 | import net.b07z.sepia.server.assist.services.ServiceInterface; |
@@ -110,8 +110,8 @@ public ServiceInfo getInfo(String language) { |
110 | 110 |
|
111 | 111 | //Parameters: |
112 | 112 |
|
113 | | - //This service has no fixed parameter. The question is instead generated dynamically inside the result handler. |
114 | | - //We still need to define the custom parameter as optional though to extract it properly later: |
| 113 | + //This service has no required parameter because the question is generated dynamically inside the result handler. |
| 114 | + //We define the custom parameter as optional though to extract it properly later (or in regular expression trigger): |
115 | 115 | Parameter p1 = new Parameter(new SpecialQuestion()); |
116 | 116 | info.addParameter(p1); |
117 | 117 |
|
@@ -198,8 +198,17 @@ public ServiceResult getResult(NluResult nluResult) { |
198 | 198 | //----------------- custom parameters ------------------- |
199 | 199 |
|
200 | 200 | /** |
201 | | - * Parameter handler that is just a placeholder for our custom question. |
202 | | - * It will contain the full input, normalized and raw if used in a response. |
| 201 | + * Custom parameter that tries to extract the question from first input or response. |
| 202 | + * It will contain the normalized and full raw input by default. |
203 | 203 | */ |
204 | | - public static class SpecialQuestion extends GenericEmptyParameter {} |
| 204 | + public static class SpecialQuestion extends CustomParameter { |
| 205 | + |
| 206 | + @Override |
| 207 | + public String extract(String input){ |
| 208 | + //If you use regular expression triggers in 'getInfo' you could try to extract |
| 209 | + //the question here. For now we just return nothing and get the input during |
| 210 | + //response phase (after "what do you want to know?") |
| 211 | + return ""; |
| 212 | + } |
| 213 | + } |
205 | 214 | } |
0 commit comments