Understanding Cooking Recipes’ Structure Using Grammars

Andreea Ilies, Anca Nicoleta Marginean · 2021

The main objective of this research is to understand the structure of cooking recipes using context free grammars, and to build corresponding parse trees for them, labeled with semantic roles. Grammars are used as to provide a white box alternative in a world dominated by transformers. The data is gathered from two recipe websites, containing 45 000 steps, made of a variable number of sentences. The solution uses the tools Lex and Yacc, in combination with features of AllenNLP. Identification of the symbols of the context free grammars is done with Lex for which the words were extracted and tagged as parts of speech using AllenNLP’s constituency parsing. The context free grammar is processed by Yacc and the idea guiding its description is that a part of speech can only take specific positions in a sentence. Meanwhile, prepositions and keywords help identify the proper semantic role for a group of words. The construction of the tree was developed in a bottom-up approach, employing C functions in the Yacc file. Therefore, the result is a portable JSON file, equivalent to a parse tree for a cooking recipe, where each group of words is labeled with an appropriate semantic role. The trees can be further utilized in the comparison and evaluation of cooking recipes. Additionally, this methodology can be applied in processing several types of instruction manuals

Read the paper · More papers on PaperTik