Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d311b54
Adding first Iteration of Luis Recognizer
munozemilio Feb 3, 2021
140b56c
Merge branch 'main' into emimunoz/luis-recognizer
munozemilio Feb 3, 2021
293ed8f
Adding tests, comments and fixing bugs
munozemilio Feb 9, 2021
876b517
Enabling live testing, commenting Dialog Recognizer dependency
munozemilio Feb 9, 2021
d7b34ed
Merge branch 'main' into emimunoz/luis-recognizer
munozemilio Feb 9, 2021
2a3413c
Removing spaces and fixing not implemented try catch
munozemilio Feb 9, 2021
583bf50
Fixing linting errors
munozemilio Feb 9, 2021
2b4379f
Fixing style check errors
munozemilio Feb 9, 2021
c22eb94
Fixing style checks
munozemilio Feb 9, 2021
a3d989e
Adding package-info.java file
munozemilio Feb 9, 2021
e67049e
Adding missing Doc on Constructor
munozemilio Feb 9, 2021
e44a01c
Adding missing javadoc at classes
munozemilio Feb 9, 2021
82f5a33
Adding test on send trace Activity
munozemilio Feb 10, 2021
fe9c610
Adding missing test
munozemilio Feb 10, 2021
d1d640f
Merge branch 'main' into emimunoz/luis-recognizer
munozemilio Feb 10, 2021
3ba1ab1
Merge branch 'main' into emimunoz/luis-recognizer
tracyboehrer Feb 10, 2021
c82f737
Added Dialogs Recognizer
tracyboehrer Feb 10, 2021
83fb8cc
Uncommented ExternalEntityRecognizer accessors
tracyboehrer Feb 10, 2021
3944b78
Added missing Dialog.Recognizer.recognize method
tracyboehrer Feb 10, 2021
3a0551f
Adding test for DialogContext scenarios
munozemilio Feb 10, 2021
3add3af
Merge branch 'emimunoz/luis-recognizer' of https://github.com/microso…
munozemilio Feb 10, 2021
32bcec6
Merge branch 'main' into emimunoz/luis-recognizer
munozemilio Feb 10, 2021
651ff8f
Adding missing javadoc
munozemilio Feb 11, 2021
aecde2a
Throwing Exception
munozemilio Feb 11, 2021
4b13fe2
Fixing style
munozemilio Feb 11, 2021
e18618c
Missing error message
munozemilio Feb 11, 2021
4cf56ad
Merge branch 'main' into emimunoz/luis-recognizer
munozemilio Feb 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions libraries/bot-ai-luis-v3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,38 @@
<groupId>com.microsoft.bot</groupId>
<artifactId>bot-applicationinsights</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.bot</groupId>
<artifactId>bot-dialogs</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>4.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>3.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.microsoft.bot.ai.luis;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/**
* Request Body element to use when passing Dynamic lists to the Luis Service call.
*
*/
public class DynamicList {

/**
* Initializes a new instance of the DynamicList class.
*/
public DynamicList() {
}

/**
* Initializes a new instance of the DynamicList class.
* @param entity Entity field.
* @param requestLists List Elements to use when querying Luis Service.
*/
public DynamicList(String entity, List<ListElement> requestLists) {
this.entity = entity;
this.list = requestLists;
}

@JsonProperty(value = "listEntityName")
private String entity;

@JsonProperty(value = "requestLists")
private List<ListElement> list;

/**
* Gets the entity.
* @return Entity name.
*/
public String getEntity() {
return entity;
}

/**
* Sets the entity name.
* @param entity entity name.
*/
public void setEntity(String entity) {
this.entity = entity;
}

/**
* Gets the List.
* @return Element list of the Dynamic List.
*/
public List<ListElement> getList() {
return list;
}

/**
* Sets the List.
* @param list Element list of the Dynamic List.
*/
public void setList(List<ListElement> list) {
this.list = list;
}

/**
* Validate the object.
* @throws IllegalArgumentException on null or invalid values.
*/
public void validate() throws IllegalArgumentException {
// Required: ListEntityName, RequestLists
if (entity == null || list == null) {
throw new IllegalArgumentException("ExternalEntity requires an EntityName and EntityLength > 0");
}

for (ListElement e: list) {
e.validate();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.microsoft.bot.ai.luis;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;

/**
* Request Body element to use when passing External Entities to the Luis Service call.
*
*/
public class ExternalEntity {

/**
* Initializes a new instance of ExternalEntity.
*/
public ExternalEntity() {
}

/**
* Initializes a new instance of ExternalEntity.
* @param entity name of the entity to extend.
* @param start start character index of the predicted entity.
* @param length length of the predicted entity.
* @param resolution supplied custom resolution to return as the entity's prediction.
*/
public ExternalEntity(String entity, int start, int length, JsonNode resolution) {
this.entity = entity;
this.start = start;
this.length = length;
this.resolution = resolution;
}

@JsonProperty(value = "entityName")
private String entity;


@JsonProperty(value = "startIndex")
private int start;


@JsonProperty(value = "entityLength")
private int length = -1;

@JsonProperty(value = "resolution")
private JsonNode resolution;

/**
* Gets the start character index of the predicted entity.
* @return start character index of the predicted entity.
*/
public int getStart() {
return start;
}

/**
* Sets the start character index of the predicted entity.
* @param start character index of the predicted entity.
*/
public void setStart(int start) {
this.start = start;
}

/**
* Gets the name of the entity to extend.
* @return name of the entity to extend.
*/
public String getEntity() {
return entity;
}

/**
* Sets the name of the entity to extend.
* @param entity name of the entity to extend.
*/
public void setEntity(String entity) {
this.entity = entity;
}

/**
* Gets the length of the predicted entity.
* @return length of the predicted entity.
*/
public int getLength() {
return length;
}

/**
* Sets the length of the predicted entity.
* @param length of the predicted entity.
*/
public void setLength(int length) {
this.length = length;
}

/**
* Gets a user supplied custom resolution to return as the entity's prediction.
* @return custom resolution to return as the entity's prediction.
*/
public JsonNode getResolution() {
return resolution;
}

/**
* Sets External entities to be recognized in query.
* @param resolution custom resolution to return as the entity's prediction.
*/
public void setResolution(JsonNode resolution) {
this.resolution = resolution;
}

/**
* Validate the object.
* @throws IllegalArgumentException on null or invalid values
*/
public void validate() throws IllegalArgumentException {
if (entity == null || length == -1) {
throw new IllegalArgumentException("ExternalEntity requires an EntityName and EntityLength > 0");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.microsoft.bot.ai.luis;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

/**
* List Element for Dynamic Lists.
*
*/
public class ListElement {

/**
* Initializes a new instance of the ListElement class.
*/
public ListElement() {
}

/**
* Initializes a new instance of the ListElement class.
* @param canonicalForm The canonical form of the sub-list.
* @param synonyms The synonyms of the canonical form.
*/
public ListElement(String canonicalForm, List<String> synonyms) {
this.canonicalForm = canonicalForm;
this.synonyms = synonyms;
}

/**
* The canonical form of the sub-list.
*/
@JsonProperty(value = "canonicalForm")
private String canonicalForm;

/**
* The synonyms of the canonical form.
*/
@JsonProperty(value = "synonyms")
@JsonInclude(JsonInclude.Include.NON_NULL)
private List<String> synonyms;

/**
* Gets the canonical form of the sub-list.
* @return String canonical form of the sub-list.
*/
public String getCanonicalForm() {
return canonicalForm;
}

/**
* Sets the canonical form of the sub-list.
* @param canonicalForm the canonical form of the sub-list.
*/
public void setCanonicalForm(String canonicalForm) {
this.canonicalForm = canonicalForm;
}

/**
* Gets the synonyms of the canonical form.
* @return the synonyms List of the canonical form.
*/
public List<String> getSynonyms() {
return synonyms;
}

/**
* Sets the synonyms of the canonical form.
* @param synonyms List of synonyms of the canonical form.
*/
public void setSynonyms(List<String> synonyms) {
this.synonyms = synonyms;
}

/**
* Validate the object.
* @throws IllegalArgumentException if canonicalForm is null.
*/
public void validate() throws IllegalArgumentException {
if (canonicalForm == null) {
throw new IllegalArgumentException("RequestList requires CanonicalForm to be defined.");
}
}

}
Loading