I have used lookup table and synonyms, but the entities mentioned in the lookup are not detected by RASA, neither synonyms worked.
nlu:
- intent: place_order
examples: |
- wanna [large](size) shoes for husky
- need a [small](size) size [green](color) boots for pupps
- have [blue](color) socks
- would like to place an order
- lookup: size
examples: |
- small
-medium
-large
- synonym: small
examples: |
- small
- s
- tiny
- synonym: large
examples: |
- large
- l
- big
- synonym: medium
examples: |
- medium
- m
- average
- normal
- lookup: color
examples: |
- black
- blue
- white
- red
- green
- orange
- yellow
- purple
It works correctly for "I would like to place an order for large blue shoes" , but if the input is "medium"(which is the lookup table) instead , it wont recognize
it wont work if synonyms of "large" like "big" is used.
After doing some research I found out using RegexEntityExtractor in pipeline will resolve the issue of lookup table
name: RegexEntityExtractor
But still it didn't resolved the problem of synonyms, and by default it was using DIETClassifier (which i think is pretty good intent and entity extractor) and the output of RegexEnityExtractor collided when I used it along with it.
Can someone suggest an Extractor or combination of extractor (intent and entity) such that it works well with lookup and synonyms without any conflicts?
Related
I recently started working with Packetbeat.
For my use-case, I only need some specific fields (to the point where if I could I would completely rewrite the mapping, but am leaving that as a last resort).
I tried removing some of the fields from the "dns.answers" array of objects, but what I did doesn't seem to have any effect:
- include_fields:
fields:
- dns.question.name
- dns.question.type
- dns.answers
- dns.answers_count
- dns.resolved_ip
- drop_fields:
fields:
- dns.answers.name
In addition, I also tried including only the fields I want but that didn't seem to work either, e.g:
- include_fields:
fields:
- dns.question.name
- dns.question.type
- dns.answers.data
- dns.answers_count
- dns.resolved_ip
Any ideas? If rewriting the template/mapping of the index is the best choice, or perhaps using the Ingest Node Pipelines is a better approach, I'd love to hear it.
Thanks
I need some help understanding why, when I create a YAML file for an Ansible playbook that exactly mirrors what is specified in the module documentation, lists and list_items aren't being parsed correctly when the YAML is read by Python.
My understanding is that when reading through documentation about Ansible modules on Github, items are displayed within columns to denote their relationship relative to items above-and-below them. Further, if an item is defined as "list / elements=dictionary" then that means the following:
Typing of the item must be finished by adding a colon-and-space (this
defines "dictionary" items)
The next/subsequent line must begin at
the same indentation level (or greater) and start with a
hyphen-and-space (this denotes a "list" item)
The order of items in a list must be followed exactly.
Subsequent list items must be at the same level of indentation as the first item in the list
If any given sub-item in the list is ITSELF another "list / elements=dictionary" item repeat
step-2 again.
(EXAMPLE: Taken from the cisco.ios.ios_ospfv2 module)
So if the main item of "processes" is a "list / elements=dictionary" composed of the following:
areas (also a "list / elements=dictionary")
network (also a "list /
elements=dictionary")
process_id (integer)
Then the correct YAML syntax for the above would be:
processes:
- areas:
- area_id: 0 ##dictionary_item
- authentication: ##dictionary_item
message_digest: true ##boolean
- network:
- address: '10.1.1.0' ##string
- area: '0' ##string
- wildcard_bits: 0.0.0.255. ##integer
- process_id: 1
However, even though I don't get any YAML errors when I start my Playbook, I do get a bunch of obscure Python tracebacks. But if I change my code to THIS (see below) it works!
processes:
- process_id: 1
areas:
- area_id: '0'
authentication:
message_digest: true
network:
address: 0.0.0.0
area: 0
wildcard_bits: 255.255.255.255
My questions:
If the order of list_items is important, why did my file NOT work when I followed the order specified in the module documentation...but it DOES work when that order is ignored ("process_id" should NOT be first according to the docs for this module)?
I understand that not EVERY list_item needs to be preceded with a hyphen-space. But I DID think that the FIRST list_item required this. So why (in my first example) does my playbook fail when I denote the sub-items under "network" with hyphens...but when I remove ALL of the hyphens from this list, it DOES work? However it DOES require a hyphen for the first list_item under "areas"??
Python Errors
(sorry for the long post...I didn't know to condense it any further than this)
Here is for a general explanation of this YAML:
processes:
- process_id: 1
areas:
- area_id: '0'
authentication:
message_digest: true
network:
address: 0.0.0.0
area: 0
wildcard_bits: 255.255.255.255
processes: you may have 1 to N process, so it is a list, and in this case, a list of dictionary.
You should expect something like:
processes:
- foo: bar
baz: qux
- foo: some
baz: thing
process_id: is an int, you should expect:
processes:
- foo: bar
baz: qux
# since you are in a dictionary,
# process_id can be anywhere in the dictionary,
# as the first, last, or anywhere in between key
process_id: 1
- foo: some
baz: thing
# since you are in a dictionary,
# process_id can be anywhere in the dictionary,
# as the first, last, or anywhere in between key
process_id: 2
So this is the exact same YAML
processes:
- process_id: 1
# since you are in a dictionary,
# process_id can be anywhere in the dictionary,
# as the first, last, or anywhere in between key
foo: bar
baz: qux
- process_id: 2
# since you are in a dictionary,
# process_id can be anywhere in the dictionary,
# as the first, last, or anywhere in between key
foo: some
baz: thing
areas: is a list of 1 to N area, under the key areas of a dictionary, nested in a list, of key processes
processes:
- process_id: 1
areas:
- area_id: '0'
authentication:
message_digest: true
- area_id: '1'
authentication:
message_digest: true
- process_id: 2
areas:
- area_id: '0'
authentication:
message_digest: true
network: is a dictionary in a dictionary
processes:
- process_id: 1
areas:
- area_id: '0'
authentication:
message_digest: true
- area_id: '1'
authentication:
message_digest: true
- process_id: 2
areas:
- area_id: '0'
authentication:
message_digest: true
network:
address: 0.0.0.0
area: 0
wildcard_bits: 255.255.255.255
So in general, pay attention to how Ansible is also giving you hints here: areas is pluralised for a good reason: because it is a list of area. Same goes for processes. While network is a singular, so, as expected it will be a dictionary and not a list.
list / elements=dictionary
Means that processes must be a list where each element is a dictionary.
In YAML this is a dictionary:
foo:
some: bar
property: bar
of: bar
the: bar
dictionary: bar
of: bar
key: bar
foo: bar
And this is a list:
fruits:
- banana
- apple
- pear
- peach
Then a list of dictionary would be:
- the:
red: fox
jump: over
- the:
lazy: dog
Mind that, because this is a list, then the same key can be reproduced in the different elements of the list but cannot be seen twice in the same dictionary.
So to answer your second question, you are correct that in a dictionary the order of keys do not matter:
the:
red: fox
jump: over
Is indeed the exact same dictionary as
the:
jump: over
red: fox
But since here you are making a list of what should be a dictionary, that's where your issue reside.
A little note on the hyphen (-), too, because this seems to bug you:
If you prefer it, write your lists like this:
-
foo: bar
bar: foo
-
baz: qux
qux: baz
This is stricly equivalent to:
- foo: bar
bar: foo
- baz: qux
qux: baz
This would help you see that the hyphen just does delimit the fact that a new element of the list begins there, now you can "condense" it and have a key of your dictionary on the same line as the "new item of list" delimiter (-), but you are not forced to.
Maybe for an object oriented programming language parallel, if that could be of any help for you, you should think
a dictionary is like an object, it has multiple properties, but all the properties are actually defining the same object
a list is a collection of things, it can be a list of object, of integer, or even of object.
So when the documentation says list / elements=dictionary they actually want you do construct a list (or collection) where all the elements would be dictionaries (or objects).
Maybe the layout on the documentation page itself is easier to read than the table on GitHub.
But there, you can clearly see that the config dictionary holds a processes list that, itself contains a lot of different dictionaries, among which address_family, adjacency, ..., areas, network, ...
Thank you everyone for your insights. I've conferred with others and I think this is an issue of a documentation error for this module. The item of "network" is documented as being "list / elements=dictionary".
In reality the underlying Python code expects to see it as a dictionary (not a list). When added as a dictionary it works fine. Please see my link in which I provide a screenshot of the (incorrect) documentation as well as the Python error that results when "network" is configured as a "list / elements=dictionary".
enter image description here
Update: I was previously using the Ansible cisco.ios collection version 1.1.0 (which requires that the "network" parameter be entered as a dictionary in the python code for the module, "ios_ospfv2").
Upon upgrading to version 1.2.0 of the cisco.ios collection the "network" parameter no longer worked as a dictionary and needed to be changed back to a list (which matches the documentation for this module).
So apparently the version of the Ansible Collection one uses may change how parameters are defined within modules. Moral of the story? Ensure you're using the latest version of whatever Collection you need.
Determining Most Recent Collection Version
I have a google spreadsheet which I'm building as a template. Copies of the template will be made for multiple groups, so any formula/formatting needs to carry over. I have an issue which I thought was simple enough but after scouring for days I haven't come across a solution that's worked for this scenario. I want to take the relevant text and have the format repeat every time there's a value in a corresponding column.
I have a growing list of Test Words in Column A. I have managed to make each individual Test Word repeat three times vertically into Column B. There's also a set of three Values per Test Word in Column C. So columns A and B currently look like this (Please ignore the "- - -" I don't know how else to format it so it looks like two separate columns):
Test Word1 - - - Value 1
Test Word1 - - - Value 2
Test Word1 - - - Value 3
I need this to auto-populate every time a new Test Word is added:
+Test +Word1 - - - Value1
Test Word1 - - - - - Value2
Test Word1 - - - - - Value3
+Test +Word2 - - - Value1
Test Word2 - - - - - Value2
Test Word2 - - - - - Value3
+Test +Word3 - - - Value1
Test Word3 - - - - - Value2
Test Word3 - - - - - Value3
I've tried different variations of arrayformula, transpose/split/rept. That's not to say those types of formula won't work, just that they haven't with the particular ways I've tried. If it helps, I've laid it out in a viewable sheet here.
Any help is SUPER appreciated!
I'm new at this, but I may have part of the answer. If you use this formula in column D on row 3 (and fill down), it will create the output you seem to want, as shown in column E:
=IF(MOD(ROW(),3)=0,
"+" & SUBSTITUTE(INDEX(A$3:A,QUOTIENT(ROW(C3),3),1)," "," +"),
INDEX(A$3:A,QUOTIENT(ROW(C3),3),1))
I've added this in a new tab, Sheet1-GK in your spreadsheet.
This handles your test words. I'm not sure where you are getting the three value words that have to be matched with each test word. If they are kept somewhere else, they could be found using a VLOOKUP. Let me know if you need more help.
Are the three values the same for each different test word?
You show "Value1", "Value2", and "Value3" beside all of the test words. I assume that those could really be different, like "Value9", or "Value97" or whatever?
These formulas do need to be copied down the whole column. It is likely that this could be done with an ARRAYFORMULA using VLOOKUP. I could try to get that working, if that is important to you.
Is there a way to make the following YAML shorter so that the same resources aren't repeated?
---
classes:
- roles::storage::nfs
samba::config::includeconf:
- alpha
- beta
- charlie
- delta
- echo
- foxtrot
smb_shares:
alpha:
name: alpha
beta:
name: beta
charlie:
name: charlie
delta:
name: delta
echo:
name: echo
path: /path/to/file
foxtrot:
name: foxtrot
If there's a way to reduce any of the repetition, that would be great. Ideally, each resource name would only appear once.
Yes you can vastly reduce this with two optimisations, one of which nullifies most of the effect of the other. You will however have to change your program from reading in simple sequences and mappings to create smarter objects ( which I called ShareInclude, Shares and Share):
---
classes:
- roles::storage::nfs
samba::config::includeconf: !ShareInclude
- alpha
- beta
- charlie
- delta
- echo
- foxtrot
smb_shares: !Shares
echo: !Share
path: /path/to/file
When creating ShareInclude, you should create a Share for each sequence element with an initial name being the same as the scalar value and insert this in some global list.
The above takes care of most of the Share object, execept info. When
echo: !Share
path: /path/to/file
is processed a temporary anonymous Share should be created with path set as an attribute or other retrievable value (if the name would be different that could be stored as well). Then once Shares is created it will know the name of the share to look up (echo from the key of the mapping) and take one of two actions:
If the name can be looked up, update the Share object with the information from the anonymous Share
If the name cannot be found, promote the anonymous share by providing the key value as its name, and store it.
This way you have to specify echo twice, otherwise there is no way to associate the explicit path with the specific Share object created when processing ShareInclude. If that is still too much you can approach it from the other way and leave ShareInclude empty and implicitly make those entries when dealing with Shares:
---
classes:
- roles::storage::nfs
samba::config::includeconf: !ShareInclude
smb_shares: !Shares
alpha:
beta:
charlie:
delta:
echo:
path: /path/to/file
foxtrot:
Although this is somewhat shorter, depending on your YAML parser, you might no longer have a guaranteed ordering in the creation of the Share object. And if you have to make Shares into a sequence of key-value pairs the shortening advantage is gone.
Need to get difference between 2 dateTime payload objects as duration format for using on HT expiration value. (i.e. returned as PT2055M or P1DT10H15M)
Actually checked functions on that link: http://docs.oracle.com/cd/E23943_01/dev.1111/e10224/bp_appx_functs.htm#autoId13
And i tried to solve the issue by creating duration such as
concat("P", xp20:year-from-dateTime(string(bpmn:getDataObject('myPayloadDate'))) - xp20:year-from-dateTime(xp20:current-dateTime()) ,"Y", xp20:month-from-dateTime(string(bpmn:getDataObject('myPayloadDate'))) - xp20:month-from-dateTime(xp20:current-dateTime()),"M", xp20:day-from-dateTime(string(bpmn:getDataObject('myPayloadDate'))) - xp20:day-from-dateTime(xp20:current-dateTime()),"DT", xp20:hour-from-dateTime(string(bpmn:getDataObject('myPayloadDate'))) - xp20:hour-from-dateTime(xp20:current-dateTime()),"H",xp20:minute-from-dateTime(string(bpmn:getDataObject('myPayloadDate'))) - xp20:minute-from-dateTime(xp20:current-dateTime()),"M")
But realized that this approach interests with just only seperate values not whole values as expected.
I could not find the right composition of functions to solve.
Could you plz guide?
Assuming you have an XPath 2.0 processor, just use the subtraction operator. For example
current-date() - xs:date('2001-03-04')
gives
P4744D
(You said "dates" but your examples look more like dateTime's. The subtraction operator will work with either.)