openculinary / knowledge-graph

The RecipeRadar knowledge graph stores and provides access to recipe and ingredient relationship information.
GNU Affero General Public License v3.0
10 stars 0 forks source link

Add ingredient markup to ingredient parsing responses #27

Closed jayaddison closed 4 years ago

jayaddison commented 4 years ago

Describe the reason for these changes and the problem that they solve

It would be a significant user experience improvement if the application is able to render complete ingredient description strings, instead of simply rendering the ingredient name.

User feedback has highlighted this as an issue, as recorded in https://github.com/openculinary/frontend/issues/103.

Multiple steps are required before we can reach a situation where the original wording can be displayed in full, with ingredient names interpolated into the display. XML tends to be a useful format when interpolating of machine-readable and human-readable text data.

This changeset implements the first step, adding a markup field to knowledge-graph responses for ingredient parsing requests.

Since the input and output relate purely to ingredients, and should not contain quantities or other metadata, each match is enclosed within a pair of mark XML tags. Other upstream services may transform this into other representations.

Briefly summarize the changes

  1. During response generation, scan the input description for the best-matching ingredient's search terms
  2. Markup the relevant text and include it in the query response

How have the changes been tested?

  1. Unit tests are added

List any issues that this change relates to Relates to https://github.com/openculinary/frontend/issues/103