This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/master by this push:
new e23d320 Minecraft example fixes.
e23d320 is described below
commit e23d320d51712e34539dee2c56ec271d4c01d544
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue May 4 13:00:31 2021 +0300
Minecraft example fixes.
---
bin/prepare.sh | 5 +----
.../example/minecraft/NCMinecraftExampleMod.java | 2 +-
.../example/minecraft/utils/NCMinecraftFilesDump.java | 2 +-
nlpcraft-examples/minecraft/pom.xml | 7 ++++++-
...necraftFIllMatchProcessor.kt => MinecraftFillMatchProcessor.kt} | 3 +--
.../kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt | 6 ++----
6 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/bin/prepare.sh b/bin/prepare.sh
index 71e8bfa..026a0d4 100755
--- a/bin/prepare.sh
+++ b/bin/prepare.sh
@@ -16,7 +16,7 @@
# limitations under the License.
#
-# Make sure that maven and gradle installed on your PC.
+# Make sure that maven installed on your PC.
if [[ $1 = "" ]] ; then
echo "Version must be set as input parameter."
@@ -53,7 +53,6 @@ cd ../
mvn clean package -P stanford-corenlp,release,examples
cd nlpcraft-examples/minecraft-mod || exit
-./gradlew clean build
cd ../../
@@ -180,8 +179,6 @@ cpPom ${exampleTime}
cpPom ${exampleWeather}
cp ${exampleMinecraftMod}/build.gradle
${zipDir}/${tmpDir}/${exampleMinecraftMod}
-cp ${exampleMinecraftMod}/gradlew ${zipDir}/${tmpDir}/${exampleMinecraftMod}
-cp ${exampleMinecraftMod}/gradlew.bat
${zipDir}/${tmpDir}/${exampleMinecraftMod}
cp pom.xml ${zipDir}/${tmpDir}
cp LICENSE ${zipDir}/${tmpDir}
diff --git
a/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/NCMinecraftExampleMod.java
b/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nlpcraft/example/minecraft/NCMinecraftExampleMod.java
similarity index 99%
rename from
nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/NCMinecraftExampleMod.java
rename to
nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nlpcraft/example/minecraft/NCMinecraftExampleMod.java
index 1ab1de4..c493959 100644
---
a/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/NCMinecraftExampleMod.java
+++
b/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nlpcraft/example/minecraft/NCMinecraftExampleMod.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.nplcraft.example.minecraft;
+package org.apache.nlpcraft.example.minecraft;
import com.google.gson.Gson;
import net.minecraft.server.MinecraftServer;
diff --git
a/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/utils/NCMinecraftFilesDump.java
b/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nlpcraft/example/minecraft/utils/NCMinecraftFilesDump.java
similarity index 99%
rename from
nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/utils/NCMinecraftFilesDump.java
rename to
nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nlpcraft/example/minecraft/utils/NCMinecraftFilesDump.java
index 4b09cf1..61b58bd 100644
---
a/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/utils/NCMinecraftFilesDump.java
+++
b/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nlpcraft/example/minecraft/utils/NCMinecraftFilesDump.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.nplcraft.example.minecraft.utils;
+package org.apache.nlpcraft.example.minecraft.utils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
diff --git a/nlpcraft-examples/minecraft/pom.xml
b/nlpcraft-examples/minecraft/pom.xml
index f4f7efd..7beff06 100644
--- a/nlpcraft-examples/minecraft/pom.xml
+++ b/nlpcraft-examples/minecraft/pom.xml
@@ -54,6 +54,11 @@
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.ver}</version>
</dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-reflect</artifactId>
+ <version>${kotlin.ver}</version>
+ </dependency>
<!-- Test dependencies. -->
<dependency>
@@ -187,4 +192,4 @@
</plugin>
</plugins>
</build>
-</project>
+</project>
\ No newline at end of file
diff --git
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFIllMatchProcessor.kt
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFillMatchProcessor.kt
similarity index 98%
rename from
nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFIllMatchProcessor.kt
rename to
nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFillMatchProcessor.kt
index c1a4f27..f4dfdbe 100644
---
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFIllMatchProcessor.kt
+++
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFillMatchProcessor.kt
@@ -26,7 +26,7 @@ import java.util.*
* Special processor for support 'fillIntent' intent processing.
* Is is designed as separated class to simplify main model class.
*/
-class MinecraftFIllMatchProcessor {
+class MinecraftFillMatchProcessor {
internal data class Coordinate(val x: Int = 0, val y: Int = 0, val z: Int
= 0) {
override fun toString(): String {
return "$x $y $z"
@@ -43,7 +43,6 @@ class MinecraftFIllMatchProcessor {
companion object {
fun process(
- ctx: NCIntentMatch,
@NCIntentTerm("shape") shape: NCToken,
@NCIntentTerm("block") blockToken: NCToken,
@NCIntentTerm("len") length: Optional<NCToken>,
diff --git
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt
index 6e2ffe9..ca6f2f8 100644
---
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt
+++
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt
@@ -31,9 +31,8 @@ import java.util.*
*/
class MinecraftModel : NCModelFileAdapter("minecraft.yaml") {
private fun checkAmbiguous(ctx: NCIntentMatch) {
- if (ctx.isAmbiguous) {
+ if (ctx.isAmbiguous)
throw NCRejection("Ambiguous request")
- }
}
/**
@@ -131,12 +130,11 @@ class MinecraftModel :
NCModelFileAdapter("minecraft.yaml") {
"make a box of sand with the size of 2 10 meters in front of me"
)
fun onFillMatch(
- ctx: NCIntentMatch,
@NCIntentTerm("shape") shape: NCToken,
@NCIntentTerm("block") block: NCToken,
@NCIntentTerm("len") length: Optional<NCToken>,
@NCIntentTerm("position") position: NCToken,
): NCResult {
- return MinecraftFIllMatchProcessor.process(ctx, shape, block, length,
position)
+ return MinecraftFillMatchProcessor.process(shape, block, length,
position)
}
}