How to use dates and numbers separately with LUIS.ai? - azure-language-understanding

I'm testing LUIS.ai and I'm following the introduction that I saw on Youtube (https://www.youtube.com/watch?v=jWeLajon9M8), but I'm doing it in French because I need it. So I'm writing some utterances for an intent but I have a problem with prebuilt entities "Date" and "Number".
Indeed when I want it to detect a date, I'm using the prebuilt entity "Date" on the suitable pattern, but the problem is that every number and date are automatically detected as dates, and I don't find how to remove the date entity from the pattern it is directly applied to. And if I completely delete the date entity but bring the prebuilt number entity, every number are detected as numbers, but I can't bring back the date entity in the same time because the date entity will remove the number entity and force itself on numbers.
For example : I have the utterance "je voudrais réserver un billet d'avion pour paris pour le 30 mars" which means "I would like to book a flight to Paris on the 30th of March". Here I can select "Paris" and tell that it is associated to a "Destination" entity that i created, but if I select "30 mars" (30h of March) and add the prebuilt entity date, it will detect it as a date (this one is fine), but it will also automaticcaly detect "un" ("1" in French) as a date, and I can't do anything about it, I can't remove it.
Is there a way to solve this problem ? Because of course I don't want numbers to be detected as dates and vice versa.

This is a UI issue more than anything and not likely one to change.
You can't change detection of pre-built entities (like number or dateTimeV2). So, clicking on a detected pre-built entity won't really help.
However, LUIS returns all detected entities.
From the Test panel:
In the JSON:
Assuming you're using this in a bot of some kind, just have your bot detect whether or not an entity is present on a recognized result.

Related

Business Objects User Input with Prompts

I am trying to create the following logic on a Business Intelligence Report (Business Objects):
The requirement is an Initial Prompt in which a user can enter "A" or "M" which "A" stands for Auto and "M" for manual. Based on the user Input,
if "A" is chosen the report will refresh with current year.
If "M" is chosen then the report will provide another Prompt asking the user to select which year he wants.
What i have tried so far is the Cascade Prompt, but in the current situation is not feasible.
Is it posible to implement this kind of logic in SAP BO Report Or create a prompt that is not mapped to a dimension Object?
Just to mention i am using Universe Design Tool version 4.2
Thanks
You can certainly achieve your objective by creating a filter with prompt in the Business Layer of your universe, but it is going to function a little differently that you are describing. The idea is you prompt for the number of years to go back. So "0" would be the current year, "-1" would be the previous year, "1" would be the next year, and so on.
This is SQL Server T-SQL syntax so you would need adjust the code to fit whatever database your universe is based upon if it is not SQL Server. Of course, you would need to replace my table and date column with yours.
CONVERT(DATE, DATEADD(YEAR, #Prompt('Number of
years:','N',,Mono,Free,Not_Persistent,,User:0), GETDATE())) = [Your
table and column goes here]
Does that work for you?

Dynamics 365, Entity View, format date field to "Month Year"

I am working on an entity view that displays billing records with associated date. This date field needs to be displayed as "Month - Year". Unfortunately, I am not able to find a way to format this date field outside of modifying the entity and even then, I only have the option for date only or date and time.
I have noticed that I can select the field and click on Change Properties. There I have "Web Resource" and Function Name. I have tried creating a web resource with a function that returns some data. Set everything up, saved and published. This function is not even found in dev tools. Only examples that I have for it are dealing with using this method for icons:https://www.c-sharpcorner.com/article/view-customization-with-javascript-in-dynamics-365/
In another example the suggestion is to use calculated fields, but this would cause me to lose date sorting and filtering on the form.
That view-based JavaScript seems to be to choose an icon. I'm not sure it would allow you to reformat actual data in the view. And if you're looking for assistance with trying to do that, you'd probably get more help if you posted the code.
Besides the JavaScript approach, you might want to think about creating a separate text field to hold the "Month - Year" value. Then you could use a workflow, plugin, or JavaScript to populate it when the datetime field changes.
One of the free workflow tool packages (Jason Lattimer's, Aiden Kaskela's, or Andrew Butenko's) probably has the ability to parse the date so you can format the month and year, and store the string in the separate field. This would be a no-code option.
Alternatively, you could write a plugin to reformat the datetime values and register it on the RetrieveMultiple message of the entity.
I'd probably go with a separate field and an off-the-shelf workflow utility to populate it.
There are several ways:
1. Setting->Administration->System Setting->Format->Customize,
2. http://prntscr.com/ph42nc,
3. or use on load with js to change date format more on this subject here: How to change date format in JavaScript

Firestore Update document in-place vs remove and insert

I’m trying to determine which of the following has the better performance for updating a document in Firestore/NoSQL in general.
Suppose that there is a sub-collection:
friends:
- doc_id_sjfn
• last_name=Wang
• last_talked=10sec ago
• actual_user_id=wang1997
- doc_id_wokm
• last=Liu
• last_talked=12min ago
• actual_user_id=liu98
and the client attaches a listener to the sub-collection and displays the sub-collection in real-time on a list view.
Suppose that we want to change Wang’s last_talked to 15 sec ago with app engine over google cloud.
When updating the list, is the performance better when
A: delete document doc_id_sjfn and insert document with doc_id_sjfn_v2 as ID
B: update field ‘last_talked’ of document doc_id_sjfn to 15 seconds ago
Since there are warnings against updating a document in-place for more than once per second, would approach A have better performance in terms of how long it takes for the change to be reflected on the list displayed on the client device? Under what condition is this faster? (If fields are indexed vs not indexed) (if the list view contains every element under the collection vs a subset of all elements under the collection using “where”)
Thanks!
(The example was edited; there are definitely better ways of implementing this use case, but the example is here to help me express the idea of using document as a view and needing constant refresh)
The rule of once per second is for specific documents. From the looks of the data it doesn't look like data that will update more than once per... year?
I wouldn't worry about the once per second with the data set presented and just update in place. You'll introduce a headache trying to reconcile old and new documents, e.g. you have v1, how do you know there isn't a v2?

Efficient way to query

My app has a class that saves picture that users upload. Each object in the class has a city property that holds the name of the city that the picture was taken at, and a like property that tracks the number of likes.
I want to be able to send a query that returns one picture per city and each picture should have the highest ranking of likes in the city it belongs to. How can I do that?
One way which I first thought about is doing multiple queries by fetching the most liked picture of a city and save it in an array, and then do the same to other cities.
However, each country has more than one city, thus it's not that efficient.
Parse doesn't support the ordinary operations used in databases. Besides, I tried to use a compound query. Unfortunately, I can't set limit or ordering on the subqueries. Any good solution for this?
It would be easy using group by. Unfortunately, Parse does not support "select distinct" or "group by" features.
As you've suggested you need to fetch for each country all the cities, and for each one get the top most rated photo.
BUT, since Parse has strict restrictions on the duration time execution of a request ( 3 sec for an event listener, 7 sec for a custom function ), I suggest you to do this in a background job, saving in a new table the top rated photo for each city. In this way you can easily query the db from client. The Background jobs can be executed up to 15 minuted before parse drop them, so you could make that kind of queries without timeouts.
Hope it helps

Core Data - Sorting results conditionally on values from a to-many-relationship

Hello I have an app with an Event entity that has a to-many-relationship to a Date entity that contains MULTIPLE startDates and endDates for each event.
In my list view I need to sort the events by the next available startDate (or endDate) from the to-many-relationship.
First I created a transient property in the Date entity that made all the necessary calculations (comparing to present date etc) but then quickly realized that
you cannot sort the fetchedResultsController using a transient property.
I cannot make the calculations at the time the start and end dates are created, because there is more than one startDate and endDate for each event and which ones to use
can only be determined on demand by comparing them to the present date.
Any guidance on which way to go with this would be greatly appreciated.
You might need to go about this backwards.
The simplest solution would be to fetch Date objects that fall into the needed range and then display the Event objects they relate to.
Otherwise, you will have to use a SUBQUERY in your predicate.

Resources