Text to structure: a way to standardize outputs

Total newbie here.
My goal is to convert an input text to a standardized structure that would allow me, later on, to process tabulated data in JSON format.

For example,

  • Input: “Give me a list of all clients having purchased milk”

  • Output: {"intention": "retrieve", "object": "client", "conditions":['purchase', 'milk']}

  • Input: “Please, machine, do me a favor and delete users not having logged in after 2022”

  • Output {"intention": "delete", "object": "user", "conditions":['logged-in', '2022-12-31']}

The output JSON structure has fixed keys (intention, object, conditions) and values can be either discrete (for example intention can only be ['retrieve', 'delete', 'modify']) or variable (for example conditions can contain any piece of data.

My approach would be to use named entity recognition (NER) to identify the relevant entities and their properties, and syntactic parsing to determine the structure of the user’s prompt. For example, the “Give me a list” would result in the entity intention to be retrieve.

After reading, watching, and practicing, I think I’m now totally lost and not even sure the NER approach is advisable in this context.

Any help would be much appreciated :hugs: