How to extract the synonym values from an entity in Watson Conversation - watson-conversation

I need to extract all the synonym values for a particular entity. For example, I have an entity named Vehicle with values Car and Bus. For Car I have three synonyms, Mercedes,Volvo and Audi. Now what I need is when the entity Vehicle is detected in the user input for a value Car, I want to extract all the three synonym values present for Car. I know #Vehicle.literal will return the exact synonym value detected in the user input. But how can I retrieve all the synonyms for a particular entity value?

You can use the Conversation API to get information on an entity and its metadata. That information is not available in a dialog context itself.
IMHO a better way would be to use a database or similar to match up the detected entity with a list of synonyms. Usually, Conversation service is not used on its own, but part of a solution. The app server could perform the lookup if flagged. Take a look at the dialog actions for that. Or this suggestion on using the method of replaced markers in an answer.

Basically you can not extract the synonyms.One thing yiu can do is to create another entity with values as your car names and synonyms as vehicle.So that whenever a vehicle is input it will give you all the entity values.

Related

How to use the result from comparing 2 forms and set fields in 3rd form in BMC Remedy ARSYS?

Please see the below scenario
I have form A,B and C.
I search B using fields from A to get a result list.
result list contains one column with IDs of C form.
Now I want get a field from A, set it in C for only those IDs returned by B.
I know if confusing but I have made it as simple as possible. Please help me accomplish the above operation in BMC Remedy Developer Studio (ARSYS)
Your question isn't very clear, but I think that I understand your need. I think the primary issue is that you are thinking in terms of the GUI (results lists, active links, etc.). Instead you need to think of server-side workflow, filters and escalations. The other key is to use hidden fields to hold your IDs, data to push, flags.
I'm not sure what your trigger will be to make this all happen, so that will change the workflow. You could start with an entry A being created/modified. This will trigger a filter that does a set fields action querying B to pull back the IDs and save them into a hidden field. You then have another filter on A that checks for a value in the hidden ID field. It does a push fields action to save the data from A into the correct entry of C.
That's the basic idea which could be improved with a better understanding of the fields and flow.

Symfony axios pass only id or entire object?

I have a Booking entity which has a ManyToOne relationship with my Car entity. I use axios to post my data for creating a Booking. I'm not sure if it's better practice to pass my whole Car object to my create function inside my Controller or to only pass the Car's id to the route of the function (which then fetches the Car from my database thanks to Symfonys param converter). Or is there another way which is considered "best practice"?
It depends on your scenario and the way you want to use.
Whenever you have to create an object / row inside the database then you will have to pass the whole object. assuming that the cars has already been created inside the database and you only have to link the booking object with the car than i will prefer you to bind it using ids rather than placing the whole object.
If you place the whole car object than it will increase the retrieval performance but if someday the information of car is changed than you will have to change the information on every booking object in which you placed the car object but if you just bind it with the Car Id than it will always give user the latest information even if the info of Car has been changed.
I thought that it will reduce the performance of the application if we used Id but that is not the case the DBMS use indexing to manage the search and search through id takes not time. It performance is not an issue and yes if you pass a whole object than it will also consume more data (since a large amount of data will be uploaded).

How to store only node specific off-ledger custom data in corda?

I created custom table in corda using QueryableState. e.g. IOUStates table.
I can able to see the custom information getting stored in this kind of table.
but i observed that if party A and Party B is doing the transaction then this
custom information gets stored at both the places , e.g. IOUStates
table getting created at nodeA ledger as well as nodeB's ledger.
and custom information is stored in partyA's and PartyB's ledger.
My Question is :-
If some Transaction is getting processed from PartyA's node , then
I want to store part of the transaction's data i.e. custom data ONLY at partyA's Ledger.* level . i.e. off-Ledger of partA only.
It should not be shared with partyB.
In simple case , how to store Only node specific off ledger custom data ?
Awaiting for some reply...
Thanks.
There's a number of ways to achieve this:
Don't use Corda at all! If the data is truly off-ledger then why are you using Corda? Instead, store it in a separate database. Of course you can "JOIN" it with on-ledger data if required, as the on-ledger data is stored in a SQL database.
Similar to point one except you can use the jdbcSession() functionality of the ServiceHub to create a custom table in the node's database. This table can easily be accessed from within your flows.
Create a ContractState object that only has one participant: the node that wants to store the data. I call this a "unilateral" state, i.e. a state that only one party ever stores.
Most importantly, if you don't want to share some data with a counter-party then it should never be disclosed inside a corda state object or attachment that another party might see. Instead:
inside your flows, you can use the data encapsulated within the shared state object (e.g. the IOU) to derive the private data
alternatively if the data is supplied when the flow begins then store the private data locally using one of the methods above

When to go for hashmap and arraylist?

Please explain above question with example scenario I am confusing which is best.
If you to fetch a specific object based on keyword or any identity in list then you have to iterate the list get object and compare with its values
In map you can directly create key value pair..you can pass key and get the value.
ex:
A object user is present which has several properties one of them is user code
Now if you have list of user object then you will fetch one by one user object and compare the code of each user...but in map you can directly store user object with user code as key pass the key and get the desired object
map.get("key");
but if you requirement is not based on key type access better to use list.. example as you to just display list of items or you have to perform sublisting.
Too broad question, but will try to shorten it:
When you have to get the value based on key (key can be anything) then you go for hashmap. Consider a telephone directory where you go to appropriate name and search for person's name to find his number.
While if you have similar object's and want to store them somehow and later on retrieve it say by index or traverse them one by one then you go for list. So if your task is to find employees older than age 50 yrs, you can just return a list of employees who are older than 50.

Symfony2 dynamic relationship with a field

I am building a social website and I am laying out how the feed will work. I want to use the answer here: How to implement the activity stream in a social network and implement the database design mentioned:
id
user_id (int)
activity_type (tinyint)
source_id (int)
parent_id (int)
parent_type (tinyint)
time (datetime but a smaller type like int would be better)
The problem is I don't know how I would map the source_id based off activity_type. If a user registers, I want the source_id to be the user that registered. If someone creates a group the source_id will be the group. I know I can just use simple IDs without keys I just wanted to know if Symfony had some sort of way to do this built in.
If I fetch the feed and the activity_type is user_register I would like to be able to do this to get the source (user) without running an additional query:
$feedEntity->getSource()->getUsername(); //getSource() being the User entity
And if the source_typeis "user_post":
$feedEntity->getSource()->getMessage(); //getSource() being the UserPost entity
I basically just want to find the best way to store this data and make it the fastest.
Not easy to deal with doctrine and i think it cannot achieved 100% automatically
However, the keyword is table inheritance
http://docs.doctrine-project.org/en/2.0.x/reference/inheritance-mapping.html#single-table-inheritance
I think you could achieve your goal by doing something like this :
You create a discriminator map by the type column of the table which tells doctrine to load this entity a UserSource (for example)
This UserSource can be an own entity (can be inherited from a base class if you want) where you can decide to map the source_id column to the real User Entity
You can use instanceof matching against the namespace of the different entities mapped inside your discriminator map to define different behaviours for the different sources

Resources