IBM / watson-discovery-ui

Develop a fully featured Node.js web app built on the Watson Discovery Service
https://developer.ibm.com/patterns/create-an-app-to-perform-intelligent-searches-on-data/
Apache License 2.0
66 stars 128 forks source link

When using Entity and Relation Extraction only, the watson-discovery-ui does not display any results #189

Closed stevops closed 3 years ago

stevops commented 3 years ago

Hello,

we are trying to query Discovery using entity and relation extraction only. When using the AirBnB example and adding enrichments "Entity" and "Realation" only for the 999 sample docs included in watson-discovery-ui/data, then the Discovery UI correctly displays the number of entities / realtions found. For the example that is

Person(625) Facility(388) GeopoliticalEntity(333) EventCommunication(213) Location(183)

image

However, when using the watson-discovery-ui to do a search, no results are displayed at all (without selecting any filter, the query result is empty). Also, when e.g. filtering by EntityType "Person", no results are displayed. Please note in the screenshot below, that the network tab displays the result JSON of the query. The full JSON is attached further below.

image

So, in the Chrome Dev-Tools - if we use no filtering at all or use a simple filter for EntityType "Person" - we can see that Discovery responses with a JSON that includes e.g. Person entites and the text where the person is mentioned. Why are the results returned for Entity/Realtion extraction not displayed by the watson-discovery-ui? I.e. what do we need to do, in order to see Matches for both, an "empty" query and/or a query that filters by EntityType?

Please see the full response JSON for an empty/unfiltered search attached:

test_query_response_json.json.txt

Thank you.

rhagarty commented 3 years ago

hello @stevops - and you are not seeing any errors in your server console?

I know that the discovery API changed the format of the returned data, so you could have an issue if you are using a newer version of the watson SDK than what is pinned in package.json.

Can you provide the output from your console where you ran "npm start"?

stevops commented 3 years ago

Hello @rhagarty ,

Thank you for your help. Indeed, the console logs an error. That is:

image

The error occurs in utils.js, line 133-141. There, it is being checked if the result data items contain a sentiment prop, which they do not, as we removed all enrichments in Discovery, except for Entity and Relation extraction:

// insure this item is valid if (!dataItem.enriched_text || !dataItem.enriched_text.sentiment || !dataItem.enriched_text.sentiment.document) { console.log('Found bad result - no enrichments found: '); console.log(' dataItem.title: ' + dataItem.title); console.log(' dataItem.id: ' + dataItem.id); break; }

Is the UI meant to be only working if sentiment is enabled in the Discovery enrichments? I can change this by removing the check for the sentiment check, however, am not sure if this breaks other parts of the application.

----- Removed the data item JSON -----

The output in the terminal that we used to issue the "npm start" is - direrctly after starting the app - showing similar log messages:

Initial Search Query at start-up Discovery Search Query Params: { environmentId: 'ce1ca3b3-3666-4ca3-b141-ef9a62e5317c', collectionId: 'dd94b8ef-1576-4b4c-96ca-1b9adb473b8d', highlight: true, aggregation: '[term(enriched_text.entities.text).term(enriched_text.sentiment.document.label),term(enriched_text.categories.label).term(enriched_text.sentiment.document.label),term(enriched_text.concepts.text).term(enriched_text.sentiment.document.label),term(enriched_text.keywords.text).term(enriched_text.sentiment.document.label),term(enriched_text.entities.type).term(enriched_text.sentiment.document.label)]', naturalLanguageQuery: '', count: 1000, passages: false } Found bad result - no enrichments found: dataItem.title: ENTIRE FLOOR! Business travel & fun dataItem.id: 26720d7a76bfcb74e878d99a1f367a3b

What is the solution to this? Do we need to include Sentiment enrichment in order for the app to work OOTB, and, will we need to customize the app in case we want to work with entity and relation extraction only?

Thanks

rhagarty commented 3 years ago

@stevops - yes, the app needs sentiments and other enrichments to work correctly. The graph, pie chart, word cloud and ratings require them. The app was never designed to work with limited data, but feel free to fork the code and make the necessary changes. Out of curiosity, why do you want to limit the number of enrichments on the data set? Can't you just ignore that part of the UI?

stevops commented 3 years ago

@rhagarty Thanks for clarification. We will simply add the sentiment enrichments in Discovery in a first step and ignore the portions of the UI, that do relate to sentiment / do not relate to Entity/Relation extraction.

"Out of curiosity, why do you want to limit the number of enrichments on the data set" --> Well, our ratio was, that we should only annotate what is needed. We are not using sentiment in our use case.