WIP.
diff --git a/nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl b/nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl
index 00baf99..bf82b2c 100644
--- a/nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl
+++ b/nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl
@@ -29,6 +29,6 @@
fragment(hey)
term={tok_id() == "x:cancel"}
-intent=int:navigate fragment(hey) term={tok_id() == "x:navigate"}
+intent=int:navigate fragment(hey) term={tok_id() == "x:navigate"} term={tok_id() == "x:addr"}
intent=int:add:waypoint fragment(hey) term={tok_id() == "x:add-waypoint"}
intent=int:remove:waypoint fragment(hey) term={tok_id() == "x:remove-waypoint"}
\ No newline at end of file
diff --git a/nlpcraft-examples/cargps/src/main/resources/cargps_model.yaml b/nlpcraft-examples/cargps/src/main/resources/cargps_model.yaml
index 357fcf7..4ba30c2 100644
--- a/nlpcraft-examples/cargps/src/main/resources/cargps_model.yaml
+++ b/nlpcraft-examples/cargps/src/main/resources/cargps_model.yaml
@@ -19,7 +19,11 @@
name: "Car GPS Example Model"
version: "1.0"
description: "NLI-powered car GPS-based navigation example model."
-enabledBuiltInTokens: [] # This example doesn't use any built-in tokens.
+enabledBuiltInTokens:
+ - "nlpcraft:num"
+ - "nlpcraft:city"
+ - "nlpcraft:country"
+ - "nlpcraft:region"
macros:
- name: "<HEY>"
@@ -31,16 +35,26 @@
- name: "<WAYPOINT>"
macro: "{waypoint|location|point|stopover|stop over|way station|stop|checkpoint|stop point} {point|station|_}"
-#
-# Allows for multi-word synonyms in this entire model
-# to be sparse and permutate them for better detection.
-# These two properties generally enable a free-form
-# natural language comprehension.
-#
-permutateSynonyms: true
-sparse: true
-
elements:
+ - id: "x:addr:kind"
+ # Short list from https://pe.usps.com/text/pub28/28apc_002.htm
+ synonyms:
+ # street[0,2] => {_|street|street street}
+ - "{street|drive|court|plaza|avenue|alley|anex|beach|bend|boulevard|bridge|canyon|causeway|way|circle|corner|creek|fork|harbor|highway|expressway|island|lane|lake|loop|motorway|park|path|point|ramp|route|rue|row|skyway|square|station|summit|trail|tunnel|walk|road}"
+ - "{st|str|dr|crt|plz|ave|blvd|hwy|rd}"
+
+ - id: "x:addr:num"
+ synonyms:
+ - "^^{tok_id() == 'nlpcraft:num' && meta_tok('nlpcraft:num:unit') == null && meta_tok('nlpcraft:num:isequalcondition')}^^"
+
+ - id: "x:addr:st"
+ synonyms:
+ - "{//[a-zA-Z0-9]+//}[1,3]"
+
+ - id: "x:addr"
+ synonyms:
+ - "^^[num]{tok_id() == 'x:addr:num'}^^ ^^[name]{tok_id() == 'x:addr:st'}^^ ^^[kind]{tok_id() == 'x:addr:kind'}^^"
+
- id: "x:hey"
description: "NLI prompt"
synonyms:
diff --git a/nlpcraft-examples/cargps/src/main/resources/samples/cargps_navigate_samples.txt b/nlpcraft-examples/cargps/src/main/resources/samples/cargps_navigate_samples.txt
index 329393e..03472b0 100644
--- a/nlpcraft-examples/cargps/src/main/resources/samples/cargps_navigate_samples.txt
+++ b/nlpcraft-examples/cargps/src/main/resources/samples/cargps_navigate_samples.txt
@@ -18,3 +18,4 @@
#
# Set of samples (corpus) for automatic unit and regression testing.
#
+hey car, drive to 21 table rock drive