Skip to content

Commit

Permalink
V1.6 (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenarsa authored Dec 2, 2020
1 parent 91ae520 commit 4a69bd1
Show file tree
Hide file tree
Showing 97 changed files with 1,109 additions and 2,048 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

588 changes: 379 additions & 209 deletions README.md

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified binding/android/Rhino/rhino/src/main/res/raw/rhino_params.pv
Binary file not shown.
6 changes: 2 additions & 4 deletions binding/dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)

Rhino is Picovoice's Speech-to-Intent engine. It directly infers intent from spoken commands within a given context of
interest, in real-time. For example, given a spoken command *"Can I have a small double-shot espresso with a lot of sugar
and some milk"*, Rhino infers that the user wants to order a drink with these specifications:
and some milk"*, Rhino infers that the user wants to order a drink and emits the following inference result:

```json
{
"type": "espresso",
"size": "small",
"numberOfShots": "2",
"sugar": "a lot",
"milk": "some"
"numberOfShots": "2"
}
```

Expand Down
4 changes: 2 additions & 2 deletions binding/dotnet/Rhino/Rhino.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<Version>1.5.1</Version>
<Version>1.6.0</Version>
<Authors>Picovoice</Authors>
<Company />
<Product>Rhino Speech-to-Intent Engine</Product>
Expand All @@ -15,7 +15,7 @@
<Copyright>Picovoice 2020</Copyright>
<Description>Rhino is Picovoice's Speech-to-Intent engine. It directly infers intent from spoken commands within a given context of interest, in real-time.

For example, given a spoken command "Can I have a small double-shot espresso with a lot of sugar and some milk", Rhino infers that the user wants to order a drink with these specifications: { "type": "espresso", "size": "small", "numberOfShots": "2", "sugar": "a lot", "milk": "some" }
For example, given a spoken command "Can I have a small double-shot espresso?", Rhino infers that the user wants to order a drink with these specifications: { "type": "espresso", "size": "small", "numberOfShots": "2" }

Rhino is:
- using deep neural networks trained in real-world environments.
Expand Down
6 changes: 2 additions & 4 deletions binding/dotnet/RhinoTest/MainTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,13 @@ public void TestWithinContext()

Inference inference = r.GetInference();
Assert.IsTrue(inference.IsUnderstood, "Couldn't understand.");
Assert.AreEqual("orderDrink", inference.Intent, "Incorrect intent.");
Assert.AreEqual("orderBeverage", inference.Intent, "Incorrect intent.");

Dictionary<string, string> expectedSlotValues = new Dictionary<string, string>()
{
{"size", "medium"},
{"numberOfShots", "double shot"},
{"coffeeDrink", "americano"},
{"milkAmount", "lots of milk"},
{"sugarAmount", "some sugar"},
{"beverage", "americano"},
};
Assert.IsTrue(inference.Slots.All((keyValuePair) =>
expectedSlotValues.ContainsKey(keyValuePair.Key) &&
Expand Down
2 changes: 1 addition & 1 deletion binding/java/.idea/artifacts/Rhino_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions binding/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)

Rhino is Picovoice's Speech-to-Intent engine. It directly infers intent from spoken commands within a given context of
interest, in real-time. For example, given a spoken command *"Can I have a small double-shot espresso with a lot of sugar
and some milk"*, Rhino infers that the user wants to order a drink with these specifications:
interest, in real-time. For example, given a spoken command *"Can I have a small double-shot espresso?"*, Rhino infers that the user wants to order a drink and emits the following inference result:

```json
{
"type": "espresso",
"size": "small",
"numberOfShots": "2",
"sugar": "a lot",
"milk": "some"
"numberOfShots": "2"
}
```

Expand Down Expand Up @@ -103,4 +100,4 @@ handle.delete();
## Demos

The [Rhino Java demo](/demo/java) is a Java command-line application that allows for
processing real-time audio (i.e. microphone) and files using Rhino.
processing real-time audio (i.e. microphone) and files using Rhino.
35 changes: 1 addition & 34 deletions binding/java/Rhino.iml
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,10 @@
</content>
<content url="file://$MODULE_DIR$/../../lib">
<sourceFolder url="file://$MODULE_DIR$/../../lib/common" type="java-resource" relativeOutputPath="rhino/lib/common" />
<sourceFolder url="file://$MODULE_DIR$/../../lib/common" type="java-test-resource" relativeOutputPath="rhino/lib/common" />
<sourceFolder url="file://$MODULE_DIR$/../../lib/java" type="java-resource" relativeOutputPath="rhino/lib/java" />
<sourceFolder url="file://$MODULE_DIR$/../../lib/java" type="java-test-resource" relativeOutputPath="rhino/lib/java" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" scope="TEST">
<library name="JUnit5.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.4.2/junit-jupiter-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.4.2/junit-jupiter-api-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.4.2/junit-platform-commons-1.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.4.2/junit-jupiter-params-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.4.2/junit-jupiter-engine-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.4.2/junit-platform-engine-1.4.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.4.2/junit-jupiter-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.4.2/junit-jupiter-api-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.4.2/junit-platform-commons-1.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.4.2/junit-jupiter-params-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.4.2/junit-jupiter-engine-5.4.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.4.2/junit-platform-engine-1.4.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="org.junit.jupiter:junit-jupiter:5.4.2" level="project" />
</component>
</module>
Binary file not shown.
6 changes: 2 additions & 4 deletions binding/java/test/ai/picovoice/rhino/RhinoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,12 @@ void testWithinContext() throws IOException, UnsupportedAudioFileException, Rhin

RhinoInference inference = rhino.getInference();
assertTrue(inference.getIsUnderstood());
assertEquals("orderDrink", inference.getIntent());
assertEquals("orderBeverage", inference.getIntent());

Map<String, String> expectedSlotValues = new HashMap<>() {{
put("size", "medium");
put("numberOfShots", "double shot");
put("coffeeDrink", "americano");
put("milkAmount", "lots of milk");
put("sugarAmount", "some sugar");
put("beverage", "americano");
}};
assertEquals(inference.getSlots(), expectedSlotValues);
}
Expand Down
5 changes: 3 additions & 2 deletions binding/javascript/rhino.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ let Rhino = (function () {
initWasm = Module.cwrap("pv_rhino_wasm_init", "number", [
"number",
"number",
"number",
]);
releaseWasm = Module.cwrap("pv_rhino_wasm_delete", ["number"]);
processWasm = Module.cwrap("pv_rhino_wasm_process", "number", [
Expand Down Expand Up @@ -89,7 +90,7 @@ let Rhino = (function () {
return initWasm != null;
};

let create = function (context) {
let create = function (context, sensitivity = 0.5) {
/**
* Creates an instance of speech-to-intent engine (aka rhino). Can be called only after .isLoaded()
* returns true.
Expand All @@ -108,7 +109,7 @@ let Rhino = (function () {
);
heapBuffer.set(context);

let handleWasm = initWasm(heapPointer, contextSize);
let handleWasm = initWasm(heapPointer, contextSize, sensitivity);
if (handleWasm === 0) {
throw new Error("failed to initialize rhino");
}
Expand Down
3 changes: 2 additions & 1 deletion binding/nodejs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
lib
resources
resources
package-lock.json
20 changes: 10 additions & 10 deletions binding/nodejs/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ describe("intent detection (coffee maker)", () => {
);

expect(inference["isUnderstood"]).toBe(true);
expect(inference["intent"]).toEqual("orderDrink");
expect(inference["slots"]["coffeeDrink"]).toEqual("americano");
expect(inference["intent"]).toEqual("orderBeverage");
expect(inference["slots"]["beverage"]).toEqual("americano");

rhinoEngine.release();
});
Expand Down Expand Up @@ -122,8 +122,8 @@ describe("manual paths", () => {
);

expect(inference["isUnderstood"]).toBe(true);
expect(inference["intent"]).toEqual("orderDrink");
expect(inference["slots"]["coffeeDrink"]).toEqual("americano");
expect(inference["intent"]).toEqual("orderBeverage");
expect(inference["slots"]["beverage"]).toEqual("americano");

rhinoEngine.release();
});
Expand All @@ -142,8 +142,8 @@ describe("manual paths", () => {
);

expect(inference["isUnderstood"]).toBe(true);
expect(inference["intent"]).toEqual("orderDrink");
expect(inference["slots"]["coffeeDrink"]).toEqual("americano");
expect(inference["intent"]).toEqual("orderBeverage");
expect(inference["slots"]["beverage"]).toEqual("americano");

rhinoEngine.release();
});
Expand Down Expand Up @@ -218,9 +218,9 @@ describe("getContextInfo", () => {
let contextInfo = rhinoEngine.getContextInfo();

expect(contextInfo).toMatch(
/(\[brew, can I get, can I have, I want, get me, give me, I'd like, make me, may I have\])/i
/(\[brew, can I get, can I have, I want, get me, give me, I'd like, make me, may I have)/i
);
expect(contextInfo).toMatch(/(a little bit of sweetener)/i);
expect(contextInfo).toMatch(/(- "triple shot")/i);
expect(contextInfo).not.toMatch(
/(the third one burned down, fell over, and sank into the swamp)/i
);
Expand All @@ -239,8 +239,8 @@ describe("invalid state", () => {
);

expect(inference["isUnderstood"]).toBe(true);
expect(inference["intent"]).toEqual("orderDrink");
expect(inference["slots"]["coffeeDrink"]).toEqual("americano");
expect(inference["intent"]).toEqual("orderBeverage");
expect(inference["slots"]["beverage"]).toEqual("americano");

rhinoEngine.release();

Expand Down
11 changes: 3 additions & 8 deletions binding/python/test_rhino.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,9 @@ def test_within_context(self):

self.assertTrue(inference.is_understood, "Couldn't understand.")

self.assertEqual('orderDrink', inference.intent, "Incorrect intent.")

expected_slot_values = dict(
sugarAmount='some sugar',
milkAmount='lots of milk',
coffeeDrink='americano',
numberOfShots='double shot',
size='medium')
self.assertEqual('orderBeverage', inference.intent, "Incorrect intent.")

expected_slot_values = dict(beverage='americano', numberOfShots='double shot', size='medium')
self.assertEqual(inference.slots, expected_slot_values, "Incorrect slots.")

def test_out_of_context(self):
Expand Down
7 changes: 2 additions & 5 deletions binding/react-native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)

Rhino is Picovoice's Speech-to-Intent engine. It directly infers intent from spoken commands within a given context of
interest, in real-time. For example, given a spoken command *"Can I have a small double-shot espresso with a lot of sugar
and some milk"*, Rhino infers that the user wants to order a drink with these specifications:
interest, in real-time. For example, given a spoken command *"Can I have a small double-shot espresso?"*, Rhino infers that the user wants to order a drink and emits the following inference result:

```json
{
"type": "espresso",
"size": "small",
"numberOfShots": "2",
"sugar": "a lot",
"milk": "some"
"numberOfShots": "2"
}
```

Expand Down
5 changes: 3 additions & 2 deletions binding/react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@picovoice/rhino-react-native",
"version": "1.5.4",
"version": "1.6.0",
"description": "Picovoice Rhino React Native binding",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand All @@ -14,7 +14,8 @@
"copy": "node copy.js",
"prepare": "bob build",
"release": "release-it",
"bootstrap": "yarn && yarn copy"
"bootstrap": "yarn && yarn copy",
"pkg": "cd pkg && npm pack .. && cd .."
},
"keywords": [
"react-native",
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion demo/android/Activity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.android.tools.build:gradle:4.1.1'


// NOTE: Do not place your application dependencies here; they belong
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jun 03 15:54:56 PDT 2020
#Fri Nov 27 07:02:37 PST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
Binary file modified demo/android/Activity/rhino/rhino-release.aar
Binary file not shown.
Loading

0 comments on commit 4a69bd1

Please sign in to comment.