You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by if...@apache.org on 2021/03/25 03:26:32 UTC

[incubator-nlpcraft] 22/29: NLPCRAFT-91: Small fixes for model

This is an automated email from the ASF dual-hosted git repository.

ifropc pushed a commit to branch NLPCRAFT-91
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git

commit c06d95d56c2eb3908d04aa05e8b8783a23ada8ea
Author: Ifropc <if...@apache.org>
AuthorDate: Thu Feb 18 18:24:31 2021 -0800

    NLPCRAFT-91: Small fixes for model
---
 .../kotlin/org/apache/nlpcraft/example/FIllMatchProcessor.kt  | 11 +++++++----
 .../main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt |  4 ++++
 .../minecraft-model/src/main/resources/minecraft.yaml         |  5 ++++-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/nlpcraft-examples/minecraft-model/src/main/kotlin/org/apache/nlpcraft/example/FIllMatchProcessor.kt b/nlpcraft-examples/minecraft-model/src/main/kotlin/org/apache/nlpcraft/example/FIllMatchProcessor.kt
index b43694b..26d617e 100644
--- a/nlpcraft-examples/minecraft-model/src/main/kotlin/org/apache/nlpcraft/example/FIllMatchProcessor.kt
+++ b/nlpcraft-examples/minecraft-model/src/main/kotlin/org/apache/nlpcraft/example/FIllMatchProcessor.kt
@@ -35,14 +35,17 @@ class FIllMatchProcessor {
 
             // TODO: Use user rotation
             // TODO: handle y coordinate for cube
-            return NCResult.text("execute at @p positioned ~ ~ ~*1 rotated 0 0 run fill ${from.relativeRotated()} ${to.relativeRotated()} $block")
+            return NCResult.text("execute at @p positioned ~ ~ ~ rotated 0 0 run fill ${from.relativeRotated()} ${to.relativeRotated()} $block")
         }
 
         private fun resultCoordinates(length: Int, shape: String): Pair<Coordinate, Coordinate> {
             return when (shape) {
-                "line" -> Coordinate(-length / 2) to Coordinate((length - 1) / 2)
-                "square" -> Coordinate(-length / 2,0, -length / 2) to Coordinate((length - 1) / 2, 0,(length - 1) / 2)
-                "cube" -> Coordinate(-length / 2,-length / 2, -length / 2) to Coordinate((length - 1) / 2, (length - 1) / 2,(length - 1) / 2)
+                "line" -> Coordinate(-length / 2) to
+                        Coordinate((length - 1) / 2)
+                "square" -> Coordinate(-length / 2, 0, -length / 2) to
+                        Coordinate((length - 1) / 2, 0, (length - 1) / 2)
+                "cube" -> Coordinate(-length / 2, -length / 2, -length / 2) to
+                        Coordinate((length - 1) / 2, (length - 1) / 2, (length - 1) / 2)
                 else -> {
                     throw NCRejection("Unsupported shape")
                 }
diff --git a/nlpcraft-examples/minecraft-model/src/main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt b/nlpcraft-examples/minecraft-model/src/main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt
index d4ed279..b92c57c 100644
--- a/nlpcraft-examples/minecraft-model/src/main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt
+++ b/nlpcraft-examples/minecraft-model/src/main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt
@@ -81,4 +81,8 @@ class MinecraftModel : NCModelFileAdapter("minecraft.yaml") {
     ): NCResult {
         return FIllMatchProcessor.process(ctx, shape, block, length, position)
     }
+
+    override fun getAbstractTokens(): MutableSet<String> {
+        return mutableSetOf("mc:player")
+    }
 }
diff --git a/nlpcraft-examples/minecraft-model/src/main/resources/minecraft.yaml b/nlpcraft-examples/minecraft-model/src/main/resources/minecraft.yaml
index 8ff6b5a..31762b1 100644
--- a/nlpcraft-examples/minecraft-model/src/main/resources/minecraft.yaml
+++ b/nlpcraft-examples/minecraft-model/src/main/resources/minecraft.yaml
@@ -99,6 +99,7 @@ elements:
   - id: give:action
     synonyms:
       - "{give ^^[target](id == 'mc:player')^^}"
+    "permutateSynonyms": false
   - id: give:block-word
     synonyms:
       - "{block|blocks}"
@@ -128,12 +129,14 @@ elements:
       - fill:position
     synonyms:
       - "{{at|near} ^^[player](id == 'mc:player')^^ {position|*}|where ^^[player](id == 'mc:player')^^}"
+    "permutateSynonyms": false
 
   - id: position:front
     groups:
       - fill:position
     synonyms:
-      - "{{^^[distance](id == 'nlpcraft:num')^^ m|meter|meters|ft|feet}? {in|*} front {of|*} ^^[player](id == 'mc:player')^^}"
+      - "{{{^^[distance](id == 'nlpcraft:num')^^ m|meter|meters|ft|feet}|*} {in|*} front {of|*} ^^[player](id == 'mc:player')^^}"
+    "permutateSynonyms": false