This is an automated email from the ASF dual-hosted git repository. sergeykamov pushed a commit to branch NLPCRAFT-305 in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit cce4cb6bd75881bdab72a41ce44726ef5d78ef0e Merge: 63f361a e61da8a Author: Sergey Kamov <[email protected]> AuthorDate: Tue Apr 27 19:32:45 2021 +0300 Merge branch 'master' into NLPCRAFT-305 # Conflicts: # nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/FIllMatchProcessor.kt # nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/FillMatchProcessor.kt # nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFIllMatchProcessor.kt # nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt # nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftUtils.kt # nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftValueLoader.kt README.md | 4 ++-- docker/readme.md | 14 +++++++------- nlpcraft-examples/alarm/pom.xml | 2 +- nlpcraft-examples/echo/pom.xml | 2 +- nlpcraft-examples/helloworld/pom.xml | 2 +- nlpcraft-examples/lightswitch/pom.xml | 2 +- .../example/minecraft/utils/NCMinecraftFilesDump.java | 2 ++ nlpcraft-examples/minecraft/pom.xml | 2 +- ...tchProcessor.kt => MinecraftFIllMatchProcessor.kt} | 4 ++-- .../nlpcraft/example/minecraft/MinecraftModel.kt | 19 +++++++++++++++---- .../{ValueLoaders.kt => MinecraftValueLoader.kt} | 2 +- .../minecraft/src/main/resources/minecraft.yaml | 6 +++--- nlpcraft-examples/phone/pom.xml | 2 +- nlpcraft-examples/sql/pom.xml | 2 +- nlpcraft-examples/time/pom.xml | 2 +- nlpcraft-examples/weather/pom.xml | 2 +- nlpcraft-stanford/pom.xml | 2 +- nlpcraft/pom.xml | 2 +- .../apache/nlpcraft/common/version/NCVersion.scala | 3 ++- openapi/nlpcraft_swagger.yml | 2 +- pom.xml | 4 ++-- 21 files changed, 48 insertions(+), 34 deletions(-) diff --cc nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftFIllMatchProcessor.kt index 7bf20ad,1890fea..c1a4f27 --- 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 @@@ -23,27 -23,11 +23,27 @@@ import org.apache.nlpcraft.model. import java.util.* /** - * Utility fill processor. + * Special processor for support 'fillIntent' intent processing. + * Is is designed as separated class to simplify main model class. */ - class FillMatchProcessor { + 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" + } + + fun relative(): String { + return "~$x ~$y ~$z" + } + + fun relativeRotated(): String { + return "^$x ^$y ^$z" + } + } + companion object { fun process( + ctx: NCIntentMatch, @NCIntentTerm("shape") shape: NCToken, @NCIntentTerm("block") blockToken: NCToken, @NCIntentTerm("len") length: Optional<NCToken>, diff --cc nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftModel.kt index ad793d5,e97496d..745d792 --- 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 @@@ -24,18 -24,13 +24,21 @@@ import org.apache.nlpcraft.model. import java.util.* /** - * Minecraft example model. + * Minecraft example data model. + * TODO: + * <p> + * See 'README.md' file in the same folder for running and testing instructions. */ -@Suppress("unused") class MinecraftModel : NCModelFileAdapter("minecraft.yaml") { + private fun checkAmbiguous(ctx: NCIntentMatch) { + if (ctx.isAmbiguous) { + throw NCRejection("Ambiguous request") + } + } + + /** + * Weather intent callback. + */ @NCIntentRef("weatherIntent") @NCIntentSample( "make it rain", @@@ -114,6 -119,6 +125,6 @@@ @NCIntentTerm("len") length: Optional<NCToken>, @NCIntentTerm("position") position: NCToken, ): NCResult { - return FillMatchProcessor.process(ctx, shape, block, length, position) - return MinecraftFIllMatchProcessor.process(shape, block, length, position) ++ return MinecraftFIllMatchProcessor.process(ctx, shape, block, length, position) } } diff --cc nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftValueLoader.kt index def4d26,4191bfe..665a575 --- a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftValueLoader.kt +++ b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/MinecraftValueLoader.kt @@@ -26,12 -26,7 +26,12 @@@ import org.apache.nlpcraft.model.NCMode import org.apache.nlpcraft.model.NCValue import org.apache.nlpcraft.model.NCValueLoader +/** + * Data loader from JSON data files. + * These files which prepared via 'minectaft-mod' module org.apache.nplcraft.example.minecraft.utils.GameFilesDump + * for this supported `minecraft` server version. + */ - class MinecraftObjectValueLoader : NCValueLoader { + class MinecraftValueLoader : NCValueLoader { private data class Dump(val version: String, val data: Map<String, String>) private class NCMinecraftValue(private var name: String, private var registry: String) : NCValue {
