DialogFlow - Get original string associated with parameter - dialogflow-es

Suppose I have a query like:
Turn on the lights from 5pm to 11pm.
I have a time-period entity that matches "5pm to 11pm", and the agent correctly parses the entity into two DateTime objects in the response. However, I need to get a mapping of the snippets of original text to the parameter, i.e. Original Text -> Parameter Name, e.g. "5pm to 11pm" maps to the "time-period" entity. Ideally, I would like the original text along with the parsed objects. Is this possible?

If you are using just parameters, then it is not possible to get the original text from the user query. Dialogflow will only give you the parsed date. As you can see in the image below, there is only parsed startTime and endTime.
However, if you set a context in your intent, then you can get the value of both parsed date and the original text that user has entered. As you can see in the image below, there is both original text which is with .original suffix and the converted startDate and endDate.
You can set an output-context in the intent, with life-span of 1, just to get this value.
Hope it helps.

Related

Can someone help me with Exception occurred calling method NotesDatabase.FTSearch(string)

I'm trying to do a database full text search and struggling to get it to work.
Since I'm working with date fields, I deleted my full text index, set all my blank date fields to a fictitious date (3/15/2050), compacted the db and then rebuilt the full text index.
However, I am still getting the error for this query string:
(FIELD Form CONTAINS 'Opp') AND (FIELD Topic CONTAINS 'A') AND (FIELD DateTeam >= 3/1/2019) AND (FIELD DateTeam <= 3/31/2019)
I didn't have the single quotes in there initially, but tried it as a suggestion from another post. I also tried putting # before and after my dates, but no luck there either.
What am I missing? My customer is getting frustrated.
You didn't post the verbiage in the exception, nor say what Domino version you were using, so this is somewhat guesswork.
It could be that the UNK table (Domino's internal field catalog) thinks the field is a string field. The first value stored in a field is the type that the FT index uses to determine the indexed data type. Of course any type can be stored in the NSF data but the FT code tries to limit this type of search to fields it believes will work.
Now if those CONTAINS values are actually = values, then DQL can help you. We'll be putting CONTAINS as a verb into DQL in V11, but it (DQL) can certainly perform your date range term. Just a thought.
-John Curtis
This might help: https://www-10.lotus.com/ldd/dominowiki.nsf/dx/full-text-syntax
As far as I know date values must be in [] to work.
A good start is to test your formula in the client with the FT search function instead of altering your code.
By the way: you can shorten your formula omitting the FIELD keyword and putting the field name also in [].
I tried this in my mail database:
(FIELD Form CONTAINS "Memo") AND (FIELD Subject CONTAINS "the") AND (FIELD PostedDate >= 3/1/2019) AND (FIELD PostedDate <= 30/6/2019)
And it works correctly. So double quotes instead of single, and you might have to check whether your date format corresponds with the server's.
The approach I was taking was correct. The problem, however, was that my update agent to set all the date fields had a typo in it so it wasn't setting the right fieldnames to dates. My oversight. Once I found that and corrected it, I retraced my steps and it all works as intended now. Thank you to all for helping me find the solution.
For anyone else, I took these steps:
Open database properties and delete the full text index
Run this command on the console to compact the db: lo compact folder/db.nsf -c
Run an agent against all the docs to set the date fields to a fictitious date
Open database properties again and create a new full text index
When completed, run this command on the console: load updall -f folder/db.nsf
Run the agent again to reset the fictitious dates to blanks

how to get all values from dropdown from web application in blueprism

I want get all values of dropdown and want to store them somewhere. from follwing NASDAQ site https://www.nasdaq.com/symbol/ge/historical i want get all values of Timeframe and want to somewhere so that i can use those values one b one in loop and get the values of stock for all timeframe. Click below image screenshot
It's not that easy to get each of the values, but it's not impossible. First you can get all the values in a Data Item as text. If you spy the element, you will notice that the attribute Value contains what you want. So you will need to use a read stage and get this specific attribute's value (you can ignore the PDF elements):
Doing so will give you the following:
The problem with this is that you cannot use this in a loop. One way around would be to split on space:
And the resulting collection (I called it Split Values) will look like this:
But it's not quite there yet. You should however be able to use this collection to get the collection you need (or use it directly).
If you use it directly, I would say it should look like this:
Empty? has the expression [Split Values.words]="" (notice the last row is blank)
Value is number has the expression IsNumber([Split Values.words])
Set Current Item as Number has expression [Split Values.words] with store value Current Item.
Append word to Current Item has expression [Current Item]&" "&[Split Values.words] with store value Current Item.

Null values for system entities

I tried an example in api.ai, with reference to the Beginner's Guide, I am attaching error response as a screen-shot. I was expecting to get the values of marked intents.
The problem is that, somehow, you have "tomorrow" associated with a city entity in the first example phrase (the purple color matches the #sys:geo-city-gb entity). Because of this, it is looking for a phrase "Can I know available slots for somewhere" where the somewhere should be a city name. But "tomorrow" is not the name of a city, so it doesn't include that.
Since neither parameter is required, but it has a pretty close match, it is able to match the intent - but none of the parameters fit, so they're all left empty.
You should be able to delete this and re-type "tomorrow" to change it back to a #sys.date entity. Or add additional phrases which match it against a date.

Replace text with variable

I'd like to use the bulk uploader to override text in a document. E.g. I could have JOB_TITLE in the document and this should be replaced with the contents of the CSV file. I can see how I can put the fields in but it doesn't make space for long titles - text goes over the existing text.
How can I replace a tag with a long string and still have everything fit?
Thanks!
You specify an absolute (i.e., specific) width when you place a new field (tab) in a document, and DocuSign reserves exactly that much space for the field value, irrespective of the location of surrounding text in the document. As it sounds like you're experiencing, if the field value you specify exceeds the space that's been reserved for that field in the document, the value will be written in its entirety to the document, overlapping any adjacent text located to the right of the field.
Therefore, if possible, it's best to format/arrange your document contents in such a way that any variable length fields are placed at the end of their own line, rather than 'inline' within a sentence (in close proximity to other text).
For example, instead of contents like this:
We are pleased to offer you the position of [JOB_TITLE] with a salary of [SALARY], beginning on [START_DATE].
You could instead arrange things more like this:
We are pleased to offer you the following position:
Title: [JOB_TITLE]
Salary: [SALARY]
Start Date: [START_DATE]
That way, regardless of the length of JOB_TITLE, SALARY, or START_DATE (within reason, of course), the final document will be formatted nicely.

Attempting to use the docs to understand a node function

I'm attempting to understand the code in conjunction with http://nodejs.org/api/util.html and here's what I understand with regards the code shown below
var util = require('util');
Includes the util module.
Which has some effect in the code shown below,
var financeurl = function(symbols, columns) {
return util.format(
'http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s',
symbols.join('+'),
columns);
};
The second line where it says, and the three lines that follow it
return util.format
The node documentation says,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util.format(format, [...])#
Returns a formatted string using the first argument as a printf-like format.
The first argument is a string that contains zero or more placeholders. Each placeholder is replaced with the converted value from its corresponding argument. Supported placeholders are:
%s - String.
%d - Number (both integer and float).
%j - JSON.
% - single percent sign ('%'). This does not consume an argument.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s',
is the first argument which is to be returned as a formatted string. It contains zero placeholders. Am I correct?
I'm somewhat lost with the next part, do 'symbols' and 'columns' come from node? Should I search elsewhere in the script for them? What I suspect they do is take the symbols of specific stocks and join, concatenate them to different columns.
Is my interpretation of the code with reference to the docs in someway correct?
Node's util.format() is a Variadic function - it takes a variable number of arguments.
The documentation specifies that the first parameter is a string template containing zero or more special placeholders. The remainder of the arguments are treated basically as an array and placeholders in the string template are filled in with these values and the resulting string is returned.
The string in the example - http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s contains two placeholders - both %s near the end of the string. In the code given, the first placeholder is replaced with the value of symbols.join('+') and the second with the value of columns.
(join() is a built in JavaScript method on Array that produces a String consisting of the toString() value of each element of the Array separated by default by a comma, or the provided String argument('+' in this case).)
symbols and columns do not come from Node - they are variables provided elsewhere in the program. You are correct in guessing that symbols contains the stock ticker symbols you're going to query the Yahoo Finance service with, but columns actually specifies the data columns that you want back from the service. (The values you can provide for columns and what they mean are described at the top of the program in a comment. As for how I know this... I'm taking the Startup Engineering course too... :D )
You're basically building up a URL for a request against the Yahoo Finance REST service - you can play around with it yourself and see what the program's getting from it by plugging in values in that string template -
http://finance.yahoo.com/d/quotes.csv?s=GOOG&f=snj1pr - gives you a CSV of containing a bunch of different values for GOOG - Google's stock symbol.
http://finance.yahoo.com/d/quotes.csv?s=GOOG+AAPL+MSFT&f=sp - gives you a CSV of just the stock ticker symbol and the price-per-share of Google, Apple and Microsoft.

Resources