Lookup table not working after training the model in rasa - rasa-nlu

I am new to rasa. I am training a model to recognize certain entities using lookup tables. I have multiple entities in the single sentence and I am trying to extract them.
nlu.yml
version: "2.0"
nlu:
- intent: intent_1
examples : |
- how many deaths were there last year in [Ohio](Filter-State)?
- death count of [Florida](Filter-State) this year
- death count of [Texas](Filter-State) this year
- what's the death count for this quarter in [CA](Filter-State)?
- lookup: Filter-State
examples: |
- Alabama
- AL
- Alaska
- AK
- Arizona
- AZ
- Arkansas
- AR
- California
- CA
- Colorado
- CO
- Connecticut
- CT
- Delaware
- DE
- District of Columbia
- DC
- Florida
- FL
- Georgia
- GA
config.yml
language: en
pipeline:
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: "char_wb"
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 150
random_seed: 1
- name: FallbackClassifier
threshold: 0.7
- name: DucklingEntityExtractor
url: http://duckling.rasa.com:8000
dimensions:
- email
- time
- name: EntitySynonymMapper
policies:
- name: AugmentedMemoizationPolicy
max_history: 4
- name: TEDPolicy
max_history: 4
epochs: 100
- name: RulePolicy
core_fallback_threshold: 0.4
core_fallback_action_name: "action_default_fallback"
enable_fallback_prediction: True
When I train the model and try using the api, It doesn't recognize cases from the states in the lookup table and as a result can't assign it to slot filter_state.
Can anyone advise me as to what am I doing wrong here for making the lookup table work!

I'm new to Rasa and searching for another issue, but I just ran into and solved this issue last night.
For lookup tables to work, you need to add "RegexEntityExtractor" to your pipeline and possibly remove RegexFeaturizer. You also need to enable lookup tables in the RegexEntityExtractor config.
config.yml
pipeline:
- name: WhitespaceTokenizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: RegexEntityExtractor
case_sensitive: False
use_lookup_tables: True
use_regexes: True
...

Could you, please, post on the Rasa forum and include more details of your setup? In particular, what version of Rasa Open Source are you using? Is the above your complete NLU data? (I think that you need at least 2 intents for an intent classifier to train.) I also recommend that you test the system using rasa interactive --debug and share e.g. a screenshot, this will help everyone see the exact input message and how it gets processed by Rasa. I'm sure we'll trace the issue down to its roots :-)

Related

Rasa how to get a value (slot) from a user

I want rasa to respond to a user when they ask for a forecast for a part number.
From what I have read, I understand I need to use a slot, but I can't find a clear example that I can understand on how to get the part number from the user.
It would give me a head start if I could see an example nlu, story and domain where
the user is asked for a part number
The user enters the part number
Rasa responds with the part number.
here is what I have so far.
domain.yml
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- get_supplier_forecast
entities:
- partnumber
slots:
partnumber:
type: text
templates:
utter_greet:
- text: Hey! How are you?
utter_cheer_up:
- text: 'Here is something to cheer you up:'
image: https://i.imgur.com/nGF1K8f.jpg
utter_did_that_help:
- text: Did that help you?
utter_happy:
- text: Great, carry on!
utter_goodbye:
- text: Bye
utter_iamabot:
- text: I am a bot, powered by Rasa.
utter_get_part_number:
- text: can you give me the part number please
utter_give_me_a_minute_while_i_check:
- text: Give me a minute while I see if I can find a forecast for {partnumber}
utter_confirm_part_number:
- text: Thanks you asked for forecast for {partnumber} did this help?
actions:
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye
- utter_iamabot
- utter_get_part_number
- utter_give_me_a_minute_while_i_check
- utter_confirm_part_number
nlu.md
## intent:greet
- hey
- hello
- hi
- good morning
- good evening
- hey there
## intent:goodbye
- bye
- goodbye
- see you around
- see you later
## intent:affirm
- yes
- indeed
- of course
- that sounds good
- correct
## intent:deny
- no
- never
- I don't think so
- don't like that
- no way
- not really
## intent:mood_great
- perfect
- very good
- great
- amazing
- wonderful
- I am feeling very good
- I am great
- I'm good
## intent:mood_unhappy
- sad
- very sad
- unhappy
- bad
- very bad
- awful
- terrible
- not very good
- extremely sad
- so sad
## intent:bot_challenge
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?
## intent:get_supplier_forecast
- Give me a forecast
- Give me a part number forecast
- I want a forecast
- I want a part number forecast
- I want a forecast for a part
- I want a supplier forecast
- Forecast delivery date
- I need a part number delivery date
- I need an item delivery date
- When will i get a part delivered
stories.md
## happy path
* greet
- utter_greet
* mood_great
- utter_happy
## sad path 1
* greet
- utter_greet
* mood_unhappy
- utter_cheer_up
- utter_did_that_help
* affirm
- utter_happy
## sad path 2
* greet
- utter_greet
* mood_unhappy
- utter_cheer_up
- utter_did_that_help
* deny
- utter_goodbye
## say goodbye
* goodbye
- utter_goodbye
## bot challenge
* bot_challenge
- utter_iamabot
## give me a forecast
* get_supplier_forecast{"partnumber":"J12345-001"}
- slot {"partnumber":"J12345-001"}
- utter_get_part_number
- utter_confirm_part_number
Domain file remain as the same. Try below things.
Story file:
## give me a forecast path1
* get_supplier_forecast{"partnumber":null}
- slot {"partnumber":null}
- utter_get_part_number
## give me a forecast path2
* get_supplier_forecast{"partnumber":"J12345-001"}
- slot {"partnumber":"J12345-001"}
- utter_confirm_part_number
Include this NLU file:
## intent:get_supplier_forecast
#this is how to mention slots in nlu file
- ['J12345-001'](partnumber)
Note: I don't know what is "partnumber" in your case. If there is so many of them you might wanna use "lookup tables".
From above changes first if the slot is null utter_get_part_number will trigger and if the slot is filled with a value utter_confirm_part_number will trigger
If this doesn't fulfill your need or doesn't work as expected, you can try rasa interactive training. Just run rasa interactive on CMD or try rasa x interactive talk. From this you can choose what you expect from the bot

Curator Allocation action does not change ES index box_type setting from "hot" to "warm"

I'm using Elasticsearch Hot Warm Architecture for large time data analytics.
My curator job will set box_type of indices older than 2 days from "hot" to "warm" nodes. But when I run it at 18pm, 30th september, the 28th september indices' box_type is still "hot".
My curator action setting:
actions:
1:
action: open
description: Open indices younger than warm days (based on index name), for logstash-
prefixed indices.
options:
ignore_empty_list: true
disable_action: false
filters:
- filtertype: age
source: name
direction: younger
timestring: '%Y.%m.%d'
unit: days
unit_count: 30
- filtertype: pattern
kind: prefix
value: logstash-
exclude:
2:
action: allocation
description: Apply shard allocation to hot nodes
options:
key: box_type
value: hot
allocation_type: require
wait_for_completion: true
timeout_override:
continue_if_exception: false
ignore_empty_list: true
disable_action: false
filters:
- filtertype: age
source: name
direction: younger
timestring: '%Y.%m.%d'
unit: days
unit_count: 2
- filtertype: pattern
kind: prefix
value: logstash-
3:
action: allocation
description: Apply shard allocation to warm nodes
options:
key: box_type
value: warm
allocation_type: require
wait_for_completion: true
timeout_override:
continue_if_exception: false
ignore_empty_list: true
disable_action: false
filters:
- filtertype: age
source: name
direction: younger
timestring: '%Y.%m.%d'
unit: days
unit_count: 30
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 2
- filtertype: pattern
kind: prefix
value: logstash-
Logs:
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Action ID: 1, "open" completed.
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Preparing Action ID: 2, "allocation"
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Trying Action ID: 2, "allocation": Apply shard allocation to hot nodes
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Updating index setting {'index.routing.allocation.require.box_type': 'hot'}
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Health Check for all provided keys passed.
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Action ID: 2, "allocation" completed.
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Preparing Action ID: 3, "allocation"
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Trying Action ID: 3, "allocation": Apply shard allocation to warm nodes
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Updating index setting {'index.routing.allocation.require.box_type': 'warm'}
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Health Check for all provided keys passed.
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Health Check for all provided keys passed.
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Health Check for all provided keys passed.
2018-09-30 18:38:26,053 - curator.py:55 - INFO - Action ID: 3, "allocation" completed.
The logs say the action is completed. Shouldn't 28th of sept indices box_type be "warm"?
filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 2
Does this filter change all the 28th sept indices box_type to warm when I run it at 18PM, 30th of sept?
Time is measured from UTC 00:00 of the current day, not from the time of execution, so older than 2 days would depend on when UTC 00:00 is in your time zone. You can see how the time is calculated and measured in the curator log files if you enable DEBUG logging.

YAML parsing - c++

I'm very new to YAML and what to parse a file I have made and verified is of correct structure. Here is the YAML:
---
DocType: DAQ Configuration File
# Creation Date: Wed Sep 21 10:34:06 2016
File Settings:
- Configuration Path: /mnt/sigma/daqengine/config/
- Configuration Name: daqengine.yaml
- Build File Path: ./bld
- Log File Path: ./log
- Record H5 Files: true
Engine Data:
- Make: EOS
- Model: M280
- Number of DAQs: 1
DAQ01 Settings:
- IP Address: 192.168.116.223
- Log DAQ Internal Temps: true
- T0 Temp. Limit: 55
- T0 Clear OTC Level Temp.: 50
- T0 Sample Averaging: 5
- T1 Temp. Limit: 60
- T1 Clear OTC Level Temp.: 55
- T1 Sample Averaging: 2
- No. Layers Used: 1
DAQ01 Layer 0 Settings:
- Model: AI-218
- Sample Rate: 50000
- Channels Used: 8
- Channel01: HF Temp
- Channel02: On-Axis PD
- Channel03: Off-Axis PD
- Channel04: X-Position
- Channel05: Y-Position
- Channel06: LDS
- Channel07: Laser Power
- Channel08: Unused
...
I need to extract the sequenced values to each key it is tagged to in C++.

Ruby's YAML only loads first Records from a large File, why?

Okay, I have the following YAML file that was generated by using yaml_db for Rails. So this is basically an autogenerated export of my Rails database:
---
admins:
columns:
- id
- username
- email
- encrypted_password
- password_salt
- sign_in_count
- current_sign_in_at
- last_sign_in_at
- current_sign_in_ip
- last_sign_in_ip
- failed_attempts
- unlock_token
- locked_at
- created_at
- updated_at
records:
- - 1
-
- lalala#lalala.at
- $2a$10$dZU50HD6paWS7EjKuWAruOFdwt9eqxiNTRh/D4sj8cqSzy5gjYd2i
- $2a$10$dZU50HD6paWS7EjKuWAruO
- 86
- 2011-01-27 07:37:45 Z
- 2011-01-26 13:27:13 Z
- 12.34.56.78
- 12.34.56.78
- 0
-
-
- 2010-12-23 09:20:46 Z
- 2011-01-27 07:37:45 Z
- - 2
- admin
- lalalalala#lalalala.com
- $2a$10$3DML64hdCCvG90bnhIpN/unEEm6C.a9FqGrAFlFHU0.2D54DSQ1Ni
- $2a$10$3DML64hdCCvG90bnhIpN/u
- 1
- 2011-01-21 09:52:14 Z
- 2011-01-21 09:52:14 Z
- 12.34.56.78
- 12.34.56.78
- 0
-
-
- 2011-01-05 14:29:49 Z
- 2011-01-21 09:52:14 Z
---
experiments:
columns:
- id
- description
- startdate
- enddate
- maps_base_URI
- maps_count
- queries_count
- proposals_count
- created_at
- updated_at
.......
Now when I try to load this YAML file in Ruby with:
file = YAML.load(File.open("data-2011-01-27.yml"))
It doesn't load more than the first admin, not even the experiments:
ruby-1.9.2-p0 > file.keys
=> ["admins"]
ruby-1.9.2-p0 > file["admins"]["records"].count
=> 1
Why is that? I would assume that the autogenerated .yml file is syntactically correct? When I run rake:db:dump and rake:db:load it works just fine.
Three hyphens (---) separate multiple documents. See YAML.load_stream to load them all:
documents = YAML.load_stream(open("data-2011-01-27.yml")).documents
documents.map(&:keys)
#=> [["admins"], ["experiments"]]

YAML Ruby 1.9.2: Stop adding Syck::MergeKey objects into my hashes

I am using Ruby 1.9.2 and Rails 3.0.1 and I am getting a weird issues with YAML. Here is my YAML file:
#config/tags_constants.yml
:main_ingredients: &ingredients
- Beans
- Beef
- Cheese
- Chocolate
- Dairy
- Eggs
- Fish
- Fruits
- Game
- Lamb
- Nuts
- Pasta
- Pork
- Poultry
- Rice/Grains
- Shellfish
- Tofu/Soy
- Vegetables
:excluded_ingredients:
<<: *ingredients
Here is what I am seeing in the console:
> hash = YAML.load(File.open("config/tags_constants.yml"))
> hash["excluded_ingredients"]
=> {#<Syck::MergeKey:0x00000101b379d0>=>["Beans", "Beef", "Cheese", "Chocolate", "Dairy", "Eggs", "Fish", "Fruits", "Game", "Lamb", "Nuts", "Pasta", "Pork", "Poultry", "Rice/Grains", "Shellfish", "Tofu/Soy"]}
How do I get YAML to merge the values without adding these weird Syck::MergeKey objects?
Try the following:
client: &client
- Brad
- Angelina
:development:
:requests: 1
:client:
:session: "something"
:paths:
*client

Resources