diff --git a/Tagging/ConlluGeneratorTest.ipynb b/Tagging/ConlluGeneratorTest.ipynb new file mode 100644 index 0000000..573eeb6 --- /dev/null +++ b/Tagging/ConlluGeneratorTest.ipynb @@ -0,0 +1,1027 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from conllu_generator import ConlluElement, ConlluDocument, ConlluGenerator" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "sys.path.insert(0,'..')\n", + "import settings" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "# loading ingredients:\n", + "import importlib.util\n", + "spec = importlib.util.spec_from_file_location(\"ingredients\", \"../\" + settings.ingredients_file)\n", + "ingredients = importlib.util.module_from_spec(spec)\n", + "spec.loader.exec_module(ingredients)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "# load json reader\n", + "from json_buffered_reader import JSON_buffered_reader as JSON_br" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* just for testing: read first 1000 recipes and convert them into conll-u format" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "n = 10\n", + "\n", + "buffered_reader_1M = JSON_br(\"../\" + settings.one_million_recipes_file)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "i = 0\n", + "\n", + "instructions = []\n", + "\n", + "for recipe in buffered_reader_1M:\n", + " \n", + " instruction = \"\"\n", + " for item in recipe['instructions']:\n", + " instruction += item['text'] + '\\n' \n", + " \n", + " instructions.append(instruction)\n", + " i += 1\n", + " if i >= n:\n", + " break" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Cook macaroni according to package directions; drain well. Cold. Combine macaroni, cheese cubes, celery, green pepper and pimento. Blend together mayonnaise or possibly salad dressing, vinegar, salt and dill weed; add in to macaroni mix. Toss lightly. Cover and refrigeratewell. Serve salad in lettuce lined bowl if you like. Makes 6 servings.'" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "instructions[1].replace(\"\\n\",\" \")[:-1]" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "conllu_input_docs = [doc.replace(\"\\n\", \" \")[:-1] for doc in instructions]" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Cook macaroni according to package directions; drain well. Cold. Combine macaroni, cheese cubes, celery, green pepper and pimento. Blend together mayonnaise or possibly salad dressing, vinegar, salt and dill weed; add in to macaroni mix. Toss lightly. Cover and refrigeratewell. Serve salad in lettuce lined bowl if you like. Makes 6 servings.'" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "conllu_input_docs[1]" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "cg = ConlluGenerator(conllu_input_docs, ingredients.multi_word_ingredients_stemmed)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "cg.tokenize_and_stem()" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "cg.pos_tagging()" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "cg.add_misc_value_by_list(\"food_type\", \"ingredient\", [w.replace(\" \",\"_\") for w in ingredients.multi_word_ingredients_stemmed] + ingredients.ingredients_stemmed)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0 Preheat preheat VERB VB _ _ _ _ _ \n", + "1 the the DET DT _ _ _ _ _ \n", + "2 oven oven NOUN NN _ _ _ _ _ \n", + "3 to to PRT TO _ _ _ _ _ \n", + "4 350 350 NUM CD _ _ _ _ _ \n", + "5 F. F. NOUN NNP _ _ _ _ _ \n", + "6 Butter butter NOUN NNP _ _ _ _ food_type=ingredient \n", + "7 or or CONJ CC _ _ _ _ _ \n", + "8 oil oil NOUN NN _ _ _ _ food_type=ingredient \n", + "9 an an DET DT _ _ _ _ _ \n", + "10 8-inch 8-inch ADJ JJ _ _ _ _ _ \n", + "11 baking bake NOUN NN _ _ _ _ _ \n", + "12 dish dish NOUN NN _ _ _ _ _ \n", + "13 . . . . _ _ _ _ _ \n", + "14 Cook cook VERB VB _ _ _ _ _ \n", + "15 the the DET DT _ _ _ _ _ \n", + "16 penne penn NOUN NN _ _ _ _ food_type=ingredient \n", + "17 2 2 NUM CD _ _ _ _ _ \n", + "18 minutes minut NOUN NNS _ _ _ _ _ \n", + "19 less less ADV RBR _ _ _ _ _ \n", + "20 than than ADP IN _ _ _ _ _ \n", + "21 package packag NOUN NN _ _ _ _ _ \n", + "22 directions direct NOUN NNS _ _ _ _ _ \n", + "23 . . . . _ _ _ _ _ \n", + "24 ( ( . ( _ _ _ _ _ \n", + "25 It It PRON PRP _ _ _ _ _ \n", + "26 will will VERB MD _ _ _ _ _ \n", + "27 finish finish VERB VB _ _ _ _ _ \n", + "28 cooking cook NOUN NN _ _ _ _ _ \n", + "29 in in ADP IN _ _ _ _ _ \n", + "30 the the DET DT _ _ _ _ _ \n", + "31 oven oven NOUN NN _ _ _ _ _ \n", + "32 . . . . _ _ _ _ _ \n", + "33 ) ) . ) _ _ _ _ _ \n", + "34 Rinse rins VERB VBD _ _ _ _ _ \n", + "35 the the DET DT _ _ _ _ _ \n", + "36 pasta pasta NOUN NN _ _ _ _ food_type=ingredient \n", + "37 in in ADP IN _ _ _ _ _ \n", + "38 cold_water cold_water NOUN NN _ _ _ _ food_type=ingredient \n", + "39 and and CONJ CC _ _ _ _ _ \n", + "40 set set VERB VB _ _ _ _ _ \n", + "41 aside asid ADV RB _ _ _ _ _ \n", + "42 . . . . _ _ _ _ _ \n", + "43 Combine combin VERB VB _ _ _ _ _ \n", + "44 the the DET DT _ _ _ _ _ \n", + "45 cooked cook ADJ JJ _ _ _ _ _ \n", + "46 pasta pasta NOUN NN _ _ _ _ food_type=ingredient \n", + "47 and and CONJ CC _ _ _ _ _ \n", + "48 the the DET DT _ _ _ _ _ \n", + "49 sauce sauc NOUN NN _ _ _ _ food_type=ingredient \n", + "50 in in ADP IN _ _ _ _ _ \n", + "51 a a DET DT _ _ _ _ _ \n", + "52 medium medium NOUN NN _ _ _ _ _ \n", + "53 bowl bowl NOUN NN _ _ _ _ _ \n", + "54 and and CONJ CC _ _ _ _ _ \n", + "55 mix mix VERB VB _ _ _ _ _ \n", + "56 carefully care ADV RB _ _ _ _ _ \n", + "57 but but CONJ CC _ _ _ _ _ \n", + "58 thoroughly thoroughli ADV RB _ _ _ _ _ \n", + "59 . . . . _ _ _ _ _ \n", + "60 Scrape scrape VERB VB _ _ _ _ _ \n", + "61 the the DET DT _ _ _ _ _ \n", + "62 pasta pasta NOUN NN _ _ _ _ food_type=ingredient \n", + "63 into into ADP IN _ _ _ _ _ \n", + "64 the the DET DT _ _ _ _ _ \n", + "65 prepared prepar ADJ JJ _ _ _ _ _ \n", + "66 baking bake NOUN NN _ _ _ _ _ \n", + "67 dish dish NOUN NN _ _ _ _ _ \n", + "68 . . . . _ _ _ _ _ \n", + "69 Sprinkle sprinkl VERB VB _ _ _ _ food_type=ingredient \n", + "70 the the DET DT _ _ _ _ _ \n", + "71 top top ADJ JJ _ _ _ _ food_type=ingredient \n", + "72 with with ADP IN _ _ _ _ _ \n", + "73 the the DET DT _ _ _ _ _ \n", + "74 cheeses chees NOUN NNS _ _ _ _ food_type=ingredient \n", + "75 and and CONJ CC _ _ _ _ _ \n", + "76 then then ADV RB _ _ _ _ _ \n", + "77 the the DET DT _ _ _ _ _ \n", + "78 chili_powder chili_powder NOUN NN _ _ _ _ food_type=ingredient \n", + "79 . . . . _ _ _ _ _ \n", + "80 Bake bake NOUN NNP _ _ _ _ _ \n", + "81 , , . , _ _ _ _ _ \n", + "82 uncovered uncov VERB VBD _ _ _ _ _ \n", + "83 , , . , _ _ _ _ _ \n", + "84 for for ADP IN _ _ _ _ _ \n", + "85 20 20 NUM CD _ _ _ _ _ \n", + "86 minutes minut NOUN NNS _ _ _ _ _ \n", + "87 . . . . _ _ _ _ _ \n", + "88 Let let VERB VB _ _ _ _ _ \n", + "89 the the DET DT _ _ _ _ _ \n", + "90 mac mac NOUN NN _ _ _ _ _ \n", + "91 and and CONJ CC _ _ _ _ _ \n", + "92 cheese chees ADJ JJ _ _ _ _ food_type=ingredient \n", + "93 sit sit NOUN NN _ _ _ _ _ \n", + "94 for for ADP IN _ _ _ _ _ \n", + "95 5 5 NUM CD _ _ _ _ _ \n", + "96 minutes minut NOUN NNS _ _ _ _ _ \n", + "97 before befor ADP IN _ _ _ _ _ \n", + "98 serving serv VERB VBG _ _ _ _ _ \n", + "99 . . . . _ _ _ _ _ \n", + "100 Melt melt NOUN NNP _ _ _ _ _ \n", + "101 the the DET DT _ _ _ _ _ \n", + "102 butter butter NOUN NN _ _ _ _ food_type=ingredient \n", + "103 in in ADP IN _ _ _ _ _ \n", + "104 a a DET DT _ _ _ _ _ \n", + "105 heavy-bottomed heavy-bottom ADJ JJ _ _ _ _ _ \n", + "106 saucepan saucepan NOUN NN _ _ _ _ _ \n", + "107 over over ADP IN _ _ _ _ _ \n", + "108 medium medium NOUN NN _ _ _ _ _ \n", + "109 heat heat NOUN NN _ _ _ _ _ \n", + "110 and and CONJ CC _ _ _ _ _ \n", + "111 whisk whisk NOUN NN _ _ _ _ _ \n", + "112 in in ADP IN _ _ _ _ _ \n", + "113 the the DET DT _ _ _ _ _ \n", + "114 flour flour NOUN NN _ _ _ _ food_type=ingredient \n", + "115 . . . . _ _ _ _ _ \n", + "116 Continue continu NOUN NNP _ _ _ _ _ \n", + "117 whisking whisk VERB VBG _ _ _ _ _ \n", + "118 and and CONJ CC _ _ _ _ _ \n", + "119 cooking cook VERB VBG _ _ _ _ _ \n", + "120 for for ADP IN _ _ _ _ _ \n", + "121 2 2 NUM CD _ _ _ _ _ \n", + "122 minutes minut NOUN NNS _ _ _ _ _ \n", + "123 . . . . _ _ _ _ _ \n", + "124 Slowly slowli ADV RB _ _ _ _ _ \n", + "125 add add ADP IN _ _ _ _ _ \n", + "126 the the DET DT _ _ _ _ _ \n", + "127 milk milk NOUN NN _ _ _ _ food_type=ingredient \n", + "128 , , . , _ _ _ _ _ \n", + "129 whisking whisk VERB VBG _ _ _ _ _ \n", + "130 constantly constantli ADV RB _ _ _ _ _ \n", + "131 . . . . _ _ _ _ _ \n", + "132 Cook cook NOUN NNP _ _ _ _ _ \n", + "133 until until ADP IN _ _ _ _ _ \n", + "134 the the DET DT _ _ _ _ _ \n", + "135 sauce sauc NOUN NN _ _ _ _ food_type=ingredient \n", + "136 thickens thicken NOUN NNS _ _ _ _ food_type=ingredient \n", + "137 , , . , _ _ _ _ _ \n", + "138 about about ADP IN _ _ _ _ _ \n", + "139 10 10 NUM CD _ _ _ _ _ \n", + "140 minutes minut NOUN NNS _ _ _ _ _ \n", + "141 , , . , _ _ _ _ _ \n", + "142 stirring stir VERB VBG _ _ _ _ _ \n", + "143 frequently frequent ADV RB _ _ _ _ _ \n", + "144 . . . . _ _ _ _ _ \n", + "145 Remove remov VERB VB _ _ _ _ _ \n", + "146 from from ADP IN _ _ _ _ _ \n", + "147 the the DET DT _ _ _ _ _ \n", + "148 heat heat NOUN NN _ _ _ _ _ \n", + "149 . . . . _ _ _ _ _ \n", + "150 Add add VERB VB _ _ _ _ _ \n", + "151 the the DET DT _ _ _ _ _ \n", + "152 cheeses chees NOUN NNS _ _ _ _ food_type=ingredient \n", + "153 , , . , _ _ _ _ _ \n", + "154 salt salt NOUN NN _ _ _ _ food_type=ingredient \n", + "155 , , . , _ _ _ _ _ \n", + "156 chili_powder chili_powder NOUN NN _ _ _ _ food_type=ingredient \n", + "157 , , . , _ _ _ _ _ \n", + "158 and and CONJ CC _ _ _ _ _ \n", + "159 garlic_powder garlic_powder NOUN NN _ _ _ _ food_type=ingredient \n", + "160 . . . . _ _ _ _ _ \n", + "161 Stir stir NOUN NNP _ _ _ _ _ \n", + "162 until until ADP IN _ _ _ _ _ \n", + "163 the the DET DT _ _ _ _ _ \n", + "164 cheese chees NOUN NN _ _ _ _ food_type=ingredient \n", + "165 is is VERB VBZ _ _ _ _ _ \n", + "166 melted melt VERB VBN _ _ _ _ _ \n", + "167 and and CONJ CC _ _ _ _ _ \n", + "168 all all DET DT _ _ _ _ _ \n", + "169 ingredients ingredi NOUN NNS _ _ _ _ _ \n", + "170 are are VERB VBP _ _ _ _ _ \n", + "171 incorporated incorpor VERB VBN _ _ _ _ _ \n", + "172 , , . , _ _ _ _ _ \n", + "173 about about ADP IN _ _ _ _ _ \n", + "174 3 3 NUM CD _ _ _ _ _ \n", + "175 minutes minut NOUN NNS _ _ _ _ _ \n", + "176 . . . . _ _ _ _ _ \n", + "177 Use use NOUN NNP _ _ _ _ _ \n", + "178 immediately immedi ADV RB _ _ _ _ _ \n", + "179 , , . , _ _ _ _ _ \n", + "180 or or CONJ CC _ _ _ _ _ \n", + "181 refrigerate refriger NOUN NN _ _ _ _ _ \n", + "182 for for ADP IN _ _ _ _ _ \n", + "183 up up ADP IN _ _ _ _ _ \n", + "184 to to PRT TO _ _ _ _ _ \n", + "185 3 3 NUM CD _ _ _ _ _ \n", + "186 days day NOUN NNS _ _ _ _ _ \n", + "187 . . . . _ _ _ _ _ \n", + "188 This thi DET DT _ _ _ _ _ \n", + "189 sauce sauc NOUN NN _ _ _ _ food_type=ingredient \n", + "190 reheats reheat VERB VBZ _ _ _ _ _ \n", + "191 nicely nice ADV RB _ _ _ _ _ \n", + "192 on on ADP IN _ _ _ _ _ \n", + "193 the the DET DT _ _ _ _ _ \n", + "194 stove stove NOUN NN _ _ _ _ _ \n", + "195 in in ADP IN _ _ _ _ _ \n", + "196 a a DET DT _ _ _ _ _ \n", + "197 saucepan saucepan NOUN NN _ _ _ _ _ \n", + "198 over over ADP IN _ _ _ _ _ \n", + "199 low low ADJ JJ _ _ _ _ _ \n", + "200 heat heat NOUN NN _ _ _ _ _ \n", + "201 . . . . _ _ _ _ _ \n", + "202 Stir stir NOUN NNP _ _ _ _ _ \n", + "203 frequently frequent ADV RB _ _ _ _ _ \n", + "204 so so ADP IN _ _ _ _ _ \n", + "205 the the DET DT _ _ _ _ _ \n", + "206 sauce sauc NOUN NN _ _ _ _ food_type=ingredient \n", + "207 doesnt doesnt NOUN NN _ _ _ _ _ \n", + "208 scorch scorch NOUN NN _ _ _ _ _ \n", + "209 . . . . _ _ _ _ _ \n", + "210 This thi DET DT _ _ _ _ _ \n", + "211 recipe recip NOUN NN _ _ _ _ _ \n", + "212 can can VERB MD _ _ _ _ _ \n", + "213 be be VERB VB _ _ _ _ _ \n", + "214 assembled assembl VERB VBN _ _ _ _ _ \n", + "215 before befor ADP IN _ _ _ _ _ \n", + "216 baking bake NOUN NN _ _ _ _ _ \n", + "217 and and CONJ CC _ _ _ _ _ \n", + "218 frozen frozen NOUN NN _ _ _ _ _ \n", + "219 for for ADP IN _ _ _ _ _ \n", + "220 up up ADP IN _ _ _ _ _ \n", + "221 to to PRT TO _ _ _ _ _ \n", + "222 3 3 NUM CD _ _ _ _ _ \n", + "223 monthsjust monthsjust NOUN NN _ _ _ _ _ \n", + "224 be be VERB VB _ _ _ _ _ \n", + "225 sure sure ADJ JJ _ _ _ _ _ \n", + "226 to to PRT TO _ _ _ _ _ \n", + "227 use use VERB VB _ _ _ _ _ \n", + "228 a a DET DT _ _ _ _ _ \n", + "229 freezer-to-oven freezer-to-oven ADJ JJ _ _ _ _ _ \n", + "230 pan pan NOUN NN _ _ _ _ _ \n", + "231 and and CONJ CC _ _ _ _ _ \n", + "232 increase increas VERB VB _ _ _ _ _ \n", + "233 the the DET DT _ _ _ _ _ \n", + "234 baking bake ADJ JJ _ _ _ _ _ \n", + "235 time time NOUN NN _ _ _ _ _ \n", + "236 to to PRT TO _ _ _ _ _ \n", + "237 50 50 NUM CD _ _ _ _ _ \n", + "238 minutes minut NOUN NNS _ _ _ _ _ \n", + "239 . . . . _ _ _ _ _ \n", + "240 One-half one-half ADJ JJ _ _ _ _ _ \n", + "241 teaspoon teaspoon NOUN NN _ _ _ _ _ \n", + "242 of of ADP IN _ _ _ _ _ \n", + "243 chipotle chipotl ADJ JJ _ _ _ _ food_type=ingredient \n", + "244 chili_powder chili_powder NOUN NN _ _ _ _ food_type=ingredient \n", + "245 makes make VERB VBZ _ _ _ _ _ \n", + "246 a a DET DT _ _ _ _ _ \n", + "247 spicy spici NOUN NN _ _ _ _ _ \n", + "248 mac mac NOUN NN _ _ _ _ _ \n", + "249 , , . , _ _ _ _ _ \n", + "250 so so ADV RB _ _ _ _ _ \n", + "251 make make ADJ JJ _ _ _ _ _ \n", + "252 sure sure ADJ JJ _ _ _ _ _ \n", + "253 your your PRON PRP$ _ _ _ _ _ \n", + "254 family famili NOUN NN _ _ _ _ _ \n", + "255 and and CONJ CC _ _ _ _ _ \n", + "256 friends friend NOUN NNS _ _ _ _ _ \n", + "257 can can VERB MD _ _ _ _ _ \n", + "258 handle handl VERB VB _ _ _ _ _ \n", + "259 it it PRON PRP _ _ _ _ _ \n", + "260 ! ! . . _ _ _ _ _ \n", + "261 The the DET DT _ _ _ _ _ \n", + "262 proportion proport NOUN NN _ _ _ _ _ \n", + "263 of of ADP IN _ _ _ _ _ \n", + "264 pasta pasta NOUN NN _ _ _ _ food_type=ingredient \n", + "265 to to PRT TO _ _ _ _ _ \n", + "266 cheese_sauce chees_sauc VERB VB _ _ _ _ food_type=ingredient \n", + "267 is is VERB VBZ _ _ _ _ _ \n", + "268 crucial crucial ADJ JJ _ _ _ _ _ \n", + "269 to to PRT TO _ _ _ _ _ \n", + "270 the the DET DT _ _ _ _ _ \n", + "271 success success NOUN NN _ _ _ _ _ \n", + "272 of of ADP IN _ _ _ _ _ \n", + "273 the the DET DT _ _ _ _ _ \n", + "274 dish dish NOUN NN _ _ _ _ _ \n", + "275 . . . . _ _ _ _ _ \n", + "276 It It PRON PRP _ _ _ _ _ \n", + "277 will will VERB MD _ _ _ _ _ \n", + "278 look look VERB VB _ _ _ _ _ \n", + "279 like like ADP IN _ _ _ _ _ \n", + "280 a a DET DT _ _ _ _ _ \n", + "281 lot lot NOUN NN _ _ _ _ _ \n", + "282 of of ADP IN _ _ _ _ _ \n", + "283 sauce sauc NOUN NN _ _ _ _ food_type=ingredient \n", + "284 for for ADP IN _ _ _ _ _ \n", + "285 the the DET DT _ _ _ _ _ \n", + "286 pasta pasta NOUN NN _ _ _ _ food_type=ingredient \n", + "287 , , . , _ _ _ _ _ \n", + "288 but but CONJ CC _ _ _ _ _ \n", + "289 some some DET DT _ _ _ _ _ \n", + "290 of of ADP IN _ _ _ _ _ \n", + "291 the the DET DT _ _ _ _ _ \n", + "292 liquid liquid NOUN NN _ _ _ _ food_type=ingredient \n", + "293 will will VERB MD _ _ _ _ _ \n", + "294 be be VERB VB _ _ _ _ _ \n", + "295 absorbed absorb VERB VBN _ _ _ _ _ \n", + "296 . . . . _ _ _ _ _ \n", + "\n", + "\n", + "0 Cook cook NOUN NNP _ _ _ _ _ \n", + "1 macaroni macaroni NOUN NN _ _ _ _ food_type=ingredient \n", + "2 according accord VERB VBG _ _ _ _ _ \n", + "3 to to PRT TO _ _ _ _ _ \n", + "4 package packag NOUN NN _ _ _ _ _ \n", + "5 directions direct NOUN NNS _ _ _ _ _ \n", + "6 ; ; . : _ _ _ _ _ \n", + "7 drain drain ADV RB _ _ _ _ _ \n", + "8 well well ADV RB _ _ _ _ _ \n", + "9 . . . . _ _ _ _ _ \n", + "10 Cold cold NOUN NNP _ _ _ _ _ \n", + "11 . . . . _ _ _ _ _ \n", + "12 Combine combin NOUN NNP _ _ _ _ _ \n", + "13 macaroni macaroni NOUN NN _ _ _ _ food_type=ingredient \n", + "14 , , . , _ _ _ _ _ \n", + "15 cheese_cubes chees_cube NOUN NNS _ _ _ _ food_type=ingredient \n", + "16 , , . , _ _ _ _ _ \n", + "17 celery celeri NOUN NN _ _ _ _ food_type=ingredient \n", + "18 , , . , _ _ _ _ _ \n", + "19 green_pepper green_pepper NOUN NN _ _ _ _ food_type=ingredient \n", + "20 and and CONJ CC _ _ _ _ _ \n", + "21 pimento pimento NOUN NN _ _ _ _ food_type=ingredient \n", + "22 . . . . _ _ _ _ _ \n", + "23 Blend blend VERB VB _ _ _ _ _ \n", + "24 together togeth ADV RB _ _ _ _ _ \n", + "25 mayonnaise mayonnais NOUN NN _ _ _ _ _ \n", + "26 or or CONJ CC _ _ _ _ _ \n", + "27 possibly possibl ADV RB _ _ _ _ _ \n", + "28 salad_dressing salad_dress VERB VBG _ _ _ _ food_type=ingredient \n", + "29 , , . , _ _ _ _ _ \n", + "30 vinegar vinegar NOUN NN _ _ _ _ food_type=ingredient \n", + "31 , , . , _ _ _ _ _ \n", + "32 salt salt NOUN NN _ _ _ _ food_type=ingredient \n", + "33 and and CONJ CC _ _ _ _ _ \n", + "34 dill_weed dill_weed NOUN NN _ _ _ _ food_type=ingredient \n", + "35 ; ; . : _ _ _ _ _ \n", + "36 add add VERB VB _ _ _ _ _ \n", + "37 in in ADP IN _ _ _ _ _ \n", + "38 to to PRT TO _ _ _ _ _ \n", + "39 macaroni macaroni VERB VB _ _ _ _ food_type=ingredient \n", + "40 mix mix NOUN NN _ _ _ _ _ \n", + "41 . . . . _ _ _ _ _ \n", + "42 Toss toss NOUN NNP _ _ _ _ _ \n", + "43 lightly lightli ADV RB _ _ _ _ _ \n", + "44 . . . . _ _ _ _ _ \n", + "45 Cover cover NOUN NNP _ _ _ _ _ \n", + "46 and and CONJ CC _ _ _ _ _ \n", + "47 refrigeratewell refrigeratewel VERB VB _ _ _ _ _ \n", + "48 . . . . _ _ _ _ _ \n", + "49 Serve serv NOUN NNP _ _ _ _ _ \n", + "50 salad salad NOUN NN _ _ _ _ food_type=ingredient \n", + "51 in in ADP IN _ _ _ _ _ \n", + "52 lettuce lettuc NOUN NN _ _ _ _ food_type=ingredient \n", + "53 lined line VERB VBN _ _ _ _ _ \n", + "54 bowl bowl ADP IN _ _ _ _ _ \n", + "55 if if ADP IN _ _ _ _ _ \n", + "56 you you PRON PRP _ _ _ _ _ \n", + "57 like like VERB VBP _ _ _ _ _ \n", + "58 . . . . _ _ _ _ _ \n", + "59 Makes make NOUN NNP _ _ _ _ _ \n", + "60 6 6 NUM CD _ _ _ _ _ \n", + "61 servings serv NOUN NNS _ _ _ _ _ \n", + "62 . . . . _ _ _ _ _ \n", + "\n", + "\n", + "0 Add add ADP IN _ _ _ _ _ \n", + "1 the the DET DT _ _ _ _ _ \n", + "2 tomatoes tomato NOUN NNS _ _ _ _ food_type=ingredient \n", + "3 to to PRT TO _ _ _ _ _ \n", + "4 a a DET DT _ _ _ _ _ \n", + "5 food food NOUN NN _ _ _ _ _ \n", + "6 processor processor NOUN NN _ _ _ _ _ \n", + "7 with with ADP IN _ _ _ _ _ \n", + "8 a a DET DT _ _ _ _ _ \n", + "9 pinch pinch NOUN NN _ _ _ _ _ \n", + "10 of of ADP IN _ _ _ _ _ \n", + "11 salt salt NOUN NN _ _ _ _ food_type=ingredient \n", + "12 and and CONJ CC _ _ _ _ _ \n", + "13 puree pure NOUN NN _ _ _ _ _ \n", + "14 until until ADP IN _ _ _ _ _ \n", + "15 smooth smooth ADJ JJ _ _ _ _ _ \n", + "16 . . . . _ _ _ _ _ \n", + "17 Combine combin VERB VB _ _ _ _ _ \n", + "18 the the DET DT _ _ _ _ _ \n", + "19 onions onion NOUN NNS _ _ _ _ food_type=ingredient \n", + "20 , , . , _ _ _ _ _ \n", + "21 bell_peppers bell_pepper NOUN NNS _ _ _ _ food_type=ingredient \n", + "22 and and CONJ CC _ _ _ _ _ \n", + "23 cucumbers cucumb NOUN NNS _ _ _ _ food_type=ingredient \n", + "24 with with ADP IN _ _ _ _ _ \n", + "25 the the DET DT _ _ _ _ _ \n", + "26 tomato tomato NOUN NN _ _ _ _ food_type=ingredient \n", + "27 puree pure NOUN NN _ _ _ _ _ \n", + "28 in in ADP IN _ _ _ _ _ \n", + "29 a a DET DT _ _ _ _ _ \n", + "30 large larg ADJ JJ _ _ _ _ _ \n", + "31 bowl bowl NOUN NN _ _ _ _ _ \n", + "32 . . . . _ _ _ _ _ \n", + "33 Chill chill NOUN NNP _ _ _ _ _ \n", + "34 at at ADP IN _ _ _ _ _ \n", + "35 least least ADJ JJS _ _ _ _ _ \n", + "36 1 1 NUM CD _ _ _ _ _ \n", + "37 hour hour NOUN NN _ _ _ _ _ \n", + "38 . . . . _ _ _ _ _ \n", + "39 Drizzle drizzl NOUN NNP _ _ _ _ _ \n", + "40 with with ADP IN _ _ _ _ _ \n", + "41 olive_oil oliv_oil NOUN NN _ _ _ _ food_type=ingredient \n", + "42 , , . , _ _ _ _ _ \n", + "43 garnish garnish ADJ JJ _ _ _ _ food_type=ingredient \n", + "44 with with ADP IN _ _ _ _ _ \n", + "45 chopped chop ADJ JJ _ _ _ _ _ \n", + "46 basil basil NOUN NN _ _ _ _ food_type=ingredient \n", + "47 and and CONJ CC _ _ _ _ _ \n", + "48 serve serv NOUN NN _ _ _ _ _ \n", + "49 . . . . _ _ _ _ _ \n", + "\n", + "\n", + "0 Preheat preheat NOUN NNP _ _ _ _ _ \n", + "1 oven oven PRON PRP _ _ _ _ _ \n", + "2 to to PRT TO _ _ _ _ _ \n", + "3 350 350 NUM CD _ _ _ _ _ \n", + "4 degrees degre NOUN NNS _ _ _ _ _ \n", + "5 Fahrenheit fahrenheit NOUN NNP _ _ _ _ _ \n", + "6 . . . . _ _ _ _ _ \n", + "7 Spray spray NOUN NNP _ _ _ _ _ \n", + "8 pan pan NOUN NN _ _ _ _ _ \n", + "9 with with ADP IN _ _ _ _ _ \n", + "10 non non ADJ JJ _ _ _ _ _ \n", + "11 stick stick ADJ JJ _ _ _ _ _ \n", + "12 cooking_spray cook_spray NOUN NN _ _ _ _ food_type=ingredient \n", + "13 . . . . _ _ _ _ _ \n", + "14 Heat heat NOUN NNP _ _ _ _ _ \n", + "15 milk milk NOUN NN _ _ _ _ food_type=ingredient \n", + "16 , , . , _ _ _ _ _ \n", + "17 water water NOUN NN _ _ _ _ food_type=ingredient \n", + "18 and and CONJ CC _ _ _ _ _ \n", + "19 butter butter NOUN NN _ _ _ _ food_type=ingredient \n", + "20 to to PRT TO _ _ _ _ _ \n", + "21 boiling boil NOUN NN _ _ _ _ _ \n", + "22 ; ; . : _ _ _ _ _ \n", + "23 stir stir NOUN NN _ _ _ _ _ \n", + "24 in in ADP IN _ _ _ _ _ \n", + "25 contents content NOUN NNS _ _ _ _ _ \n", + "26 of of ADP IN _ _ _ _ _ \n", + "27 both both DET DT _ _ _ _ _ \n", + "28 pouches pouch NOUN NNS _ _ _ _ _ \n", + "29 of of ADP IN _ _ _ _ _ \n", + "30 potatoes potato NOUN NNS _ _ _ _ food_type=ingredient \n", + "31 ; ; . : _ _ _ _ _ \n", + "32 let let CONJ CC _ _ _ _ _ \n", + "33 stand stand VERB VB _ _ _ _ _ \n", + "34 one one NUM CD _ _ _ _ _ \n", + "35 minute minut NOUN NN _ _ _ _ _ \n", + "36 . . . . _ _ _ _ _ \n", + "37 Stir stir NOUN NNP _ _ _ _ _ \n", + "38 in in ADP IN _ _ _ _ _ \n", + "39 corn corn NOUN NN _ _ _ _ food_type=ingredient \n", + "40 . . . . _ _ _ _ _ \n", + "41 Spoon spoon NOUN NNP _ _ _ _ _ \n", + "42 half half DET PDT _ _ _ _ _ \n", + "43 the the DET DT _ _ _ _ _ \n", + "44 potato potato NOUN NN _ _ _ _ food_type=ingredient \n", + "45 mixture mixtur NOUN NN _ _ _ _ _ \n", + "46 in in ADP IN _ _ _ _ _ \n", + "47 pan pan NOUN NN _ _ _ _ _ \n", + "48 . . . . _ _ _ _ _ \n", + "49 Sprinkle sprinkl NOUN NNP _ _ _ _ food_type=ingredient \n", + "50 half half ADJ JJ _ _ _ _ _ \n", + "51 each each DET DT _ _ _ _ _ \n", + "52 of of ADP IN _ _ _ _ _ \n", + "53 cheese chees NOUN NN _ _ _ _ food_type=ingredient \n", + "54 and and CONJ CC _ _ _ _ _ \n", + "55 onions onion NOUN NNS _ _ _ _ food_type=ingredient \n", + "56 ; ; . : _ _ _ _ _ \n", + "57 top top ADJ JJ _ _ _ _ food_type=ingredient \n", + "58 with with ADP IN _ _ _ _ _ \n", + "59 remaining remain VERB VBG _ _ _ _ _ \n", + "60 potatoes potato NOUN NNS _ _ _ _ food_type=ingredient \n", + "61 . . . . _ _ _ _ _ \n", + "62 Sprinkle sprinkl NOUN NNP _ _ _ _ food_type=ingredient \n", + "63 with with ADP IN _ _ _ _ _ \n", + "64 remaining remain VERB VBG _ _ _ _ _ \n", + "65 cheese chees ADJ JJ _ _ _ _ food_type=ingredient \n", + "66 and and CONJ CC _ _ _ _ _ \n", + "67 onions onion NOUN NNS _ _ _ _ food_type=ingredient \n", + "68 . . . . _ _ _ _ _ \n", + "69 Bake bake VERB VB _ _ _ _ _ \n", + "70 10 10 NUM CD _ _ _ _ _ \n", + "71 to to PRT TO _ _ _ _ _ \n", + "72 15 15 NUM CD _ _ _ _ _ \n", + "73 minutes minut NOUN NNS _ _ _ _ _ \n", + "74 until until ADP IN _ _ _ _ _ \n", + "75 cheese chees NOUN NN _ _ _ _ food_type=ingredient \n", + "76 is is VERB VBZ _ _ _ _ _ \n", + "77 melted melt VERB VBN _ _ _ _ _ \n", + "78 . . . . _ _ _ _ _ \n", + "79 Enjoy enjoy NOUN NN _ _ _ _ _ \n", + "80 ! ! . . _ _ _ _ _ \n", + "\n", + "\n", + "0 Dissolve dissolv NOUN NNP _ _ _ _ _ \n", + "1 Jello jello NOUN NNP _ _ _ _ food_type=ingredient \n", + "2 in in ADP IN _ _ _ _ _ \n", + "3 boiling_water boil_water NOUN NN _ _ _ _ food_type=ingredient \n", + "4 . . . . _ _ _ _ _ \n", + "5 Allow allow VERB VB _ _ _ _ _ \n", + "6 to to PRT TO _ _ _ _ _ \n", + "7 cool cool VERB VB _ _ _ _ _ \n", + "8 to to PRT TO _ _ _ _ _ \n", + "9 room room NOUN NN _ _ _ _ _ \n", + "10 temp temp NOUN NN _ _ _ _ _ \n", + "11 . . . . _ _ _ _ _ \n", + "12 Whisk whisk NOUN NNP _ _ _ _ _ \n", + "13 in in ADP IN _ _ _ _ _ \n", + "14 Cool_Whip cool_whip NOUN NNP _ _ _ _ food_type=ingredient \n", + "15 . . . . _ _ _ _ _ \n", + "16 Fold fold NOUN NNP _ _ _ _ _ \n", + "17 in in ADP IN _ _ _ _ _ \n", + "18 watermelon watermelon NOUN NN _ _ _ _ food_type=ingredient \n", + "19 . . . . _ _ _ _ _ \n", + "20 Spoon spoon NOUN NNP _ _ _ _ _ \n", + "21 into into ADP IN _ _ _ _ _ \n", + "22 crust crust NOUN NN _ _ _ _ food_type=ingredient \n", + "23 . . . . _ _ _ _ _ \n", + "24 Chill chill NOUN NNP _ _ _ _ _ \n", + "25 for for ADP IN _ _ _ _ _ \n", + "26 2-3 2-3 ADJ JJ _ _ _ _ _ \n", + "27 hours hour NOUN NNS _ _ _ _ _ \n", + "28 or or CONJ CC _ _ _ _ _ \n", + "29 overnight overnight ADJ JJ _ _ _ _ _ \n", + "30 . . . . _ _ _ _ _ \n", + "31 Yum yum NOUN NN _ _ _ _ _ \n", + "32 ! ! . . _ _ _ _ _ \n", + "\n", + "\n", + "0 In In ADP IN _ _ _ _ _ \n", + "1 a a DET DT _ _ _ _ _ \n", + "2 large larg ADJ JJ _ _ _ _ _ \n", + "3 skillet skillet NOUN NN _ _ _ _ _ \n", + "4 , , . , _ _ _ _ _ \n", + "5 toast toast ADP IN _ _ _ _ food_type=ingredient \n", + "6 the the DET DT _ _ _ _ _ \n", + "7 coconut coconut NOUN NN _ _ _ _ food_type=ingredient \n", + "8 over over ADP IN _ _ _ _ _ \n", + "9 medium medium NOUN NN _ _ _ _ _ \n", + "10 heat heat NOUN NN _ _ _ _ _ \n", + "11 , , . , _ _ _ _ _ \n", + "12 until until ADP IN _ _ _ _ _ \n", + "13 golden golden ADJ JJ _ _ _ _ _ \n", + "14 and and CONJ CC _ _ _ _ _ \n", + "15 crisp crisp NOUN NN _ _ _ _ food_type=ingredient \n", + "16 ; ; . : _ _ _ _ _ \n", + "17 set set VERB VBN _ _ _ _ _ \n", + "18 aside asid ADV RB _ _ _ _ _ \n", + "19 . . . . _ _ _ _ _ \n", + "20 Brown brown NOUN NNP _ _ _ _ food_type=ingredient \n", + "21 ground_beef ground_beef NOUN NN _ _ _ _ food_type=ingredient \n", + "22 and and CONJ CC _ _ _ _ _ \n", + "23 garlic garlic NOUN NN _ _ _ _ food_type=ingredient \n", + "24 in in ADP IN _ _ _ _ _ \n", + "25 the the DET DT _ _ _ _ _ \n", + "26 same same ADJ JJ _ _ _ _ _ \n", + "27 skillet skillet NOUN NN _ _ _ _ _ \n", + "28 ; ; . : _ _ _ _ _ \n", + "29 drain drain NOUN NN _ _ _ _ _ \n", + "30 well well ADV RB _ _ _ _ _ \n", + "31 . . . . _ _ _ _ _ \n", + "32 Add add NOUN NNP _ _ _ _ _ \n", + "33 salt salt NOUN NN _ _ _ _ food_type=ingredient \n", + "34 , , . , _ _ _ _ _ \n", + "35 pepper pepper ADJ JJ _ _ _ _ food_type=ingredient \n", + "36 lemon_juice lemon_juic NOUN NN _ _ _ _ food_type=ingredient \n", + "37 and and CONJ CC _ _ _ _ _ \n", + "38 soy_sauce soy_sauc NOUN NN _ _ _ _ food_type=ingredient \n", + "39 . . . . _ _ _ _ _ \n", + "40 In In ADP IN _ _ _ _ _ \n", + "41 a a DET DT _ _ _ _ _ \n", + "42 small small ADJ JJ _ _ _ _ _ \n", + "43 bowl bowl NOUN NN _ _ _ _ _ \n", + "44 combine combin VERB VBP _ _ _ _ _ \n", + "45 the the DET DT _ _ _ _ _ \n", + "46 cornstarch cornstarch NOUN NN _ _ _ _ _ \n", + "47 with with ADP IN _ _ _ _ _ \n", + "48 reserved reserv ADJ JJ _ _ _ _ _ \n", + "49 pineapple pineappl NOUN NN _ _ _ _ food_type=ingredient \n", + "50 and and CONJ CC _ _ _ _ _ \n", + "51 mandarin_orange mandarin_orang NOUN NN _ _ _ _ food_type=ingredient \n", + "52 liquids liquid NOUN NNS _ _ _ _ food_type=ingredient \n", + "53 ; ; . : _ _ _ _ _ \n", + "54 stir stir ADV RB _ _ _ _ _ \n", + "55 well well ADV RB _ _ _ _ _ \n", + "56 until until ADP IN _ _ _ _ _ \n", + "57 smooth smooth ADJ JJ _ _ _ _ _ \n", + "58 then then ADV RB _ _ _ _ _ \n", + "59 add add VERB VB _ _ _ _ _ \n", + "60 to to PRT TO _ _ _ _ _ \n", + "61 ground_beef ground_beef VERB VB _ _ _ _ food_type=ingredient \n", + "62 and and CONJ CC _ _ _ _ _ \n", + "63 cook cook VERB VB _ _ _ _ _ \n", + "64 over over PRT RP _ _ _ _ _ \n", + "65 medium medium NOUN NN _ _ _ _ _ \n", + "66 heat heat NOUN NN _ _ _ _ _ \n", + "67 for for ADP IN _ _ _ _ _ \n", + "68 5 5 NUM CD _ _ _ _ _ \n", + "69 mins min NOUN NNS _ _ _ _ food_type=ingredient \n", + "70 , , . , _ _ _ _ _ \n", + "71 stirring stir VERB VBG _ _ _ _ _ \n", + "72 constantly constantli ADV RB _ _ _ _ _ \n", + "73 , , . , _ _ _ _ _ \n", + "74 until until ADP IN _ _ _ _ _ \n", + "75 mixture mixtur NOUN NN _ _ _ _ _ \n", + "76 is is VERB VBZ _ _ _ _ _ \n", + "77 thickened thicken VERB VBN _ _ _ _ food_type=ingredient \n", + "78 . . . . _ _ _ _ _ \n", + "79 Stir stir NOUN NNP _ _ _ _ _ \n", + "80 in in ADP IN _ _ _ _ _ \n", + "81 the the DET DT _ _ _ _ _ \n", + "82 pineapple pineappl NOUN NN _ _ _ _ food_type=ingredient \n", + "83 and and CONJ CC _ _ _ _ _ \n", + "84 mandarin_oranges mandarin_orang NOUN NNS _ _ _ _ food_type=ingredient \n", + "85 ; ; . : _ _ _ _ _ \n", + "86 cook cook VERB VB _ _ _ _ _ \n", + "87 2-3 2-3 ADJ JJ _ _ _ _ _ \n", + "88 mins min NOUN NNS _ _ _ _ food_type=ingredient \n", + "89 , , . , _ _ _ _ _ \n", + "90 or or CONJ CC _ _ _ _ _ \n", + "91 until until ADP IN _ _ _ _ _ \n", + "92 thoroughly thoroughli ADV RB _ _ _ _ _ \n", + "93 heated heat VERB VBN _ _ _ _ _ \n", + "94 . . . . _ _ _ _ _ \n", + "95 Serve serv NOUN NNP _ _ _ _ _ \n", + "96 over over ADP IN _ _ _ _ _ \n", + "97 noodles noodl NOUN NNS _ _ _ _ food_type=ingredient \n", + "98 or or CONJ CC _ _ _ _ _ \n", + "99 rice rice NOUN NN _ _ _ _ food_type=ingredient \n", + "100 , , . , _ _ _ _ _ \n", + "101 and and CONJ CC _ _ _ _ _ \n", + "102 sprinkle sprinkl NOUN NN _ _ _ _ food_type=ingredient \n", + "103 with with ADP IN _ _ _ _ _ \n", + "104 more more ADJ JJR _ _ _ _ _ \n", + "105 toasted_coconut toast_coconut NOUN NN _ _ _ _ food_type=ingredient \n", + "106 and and CONJ CC _ _ _ _ _ \n", + "107 cashew_nuts cashew_nut NOUN NNS _ _ _ _ food_type=ingredient \n", + "108 . . . . _ _ _ _ _ \n", + "\n", + "\n", + "0 Pierce pierc VERB VB _ _ _ _ _ \n", + "1 the the DET DT _ _ _ _ _ \n", + "2 skin skin NOUN NN _ _ _ _ _ \n", + "3 of of ADP IN _ _ _ _ _ \n", + "4 the the DET DT _ _ _ _ _ \n", + "5 chicken chicken NOUN NN _ _ _ _ food_type=ingredient \n", + "6 with with ADP IN _ _ _ _ _ \n", + "7 a a DET DT _ _ _ _ _ \n", + "8 fork fork NOUN NN _ _ _ _ _ \n", + "9 or or CONJ CC _ _ _ _ _ \n", + "10 knife knife NOUN NN _ _ _ _ _ \n", + "11 . . . . _ _ _ _ _ \n", + "12 Sprinkle sprinkl NOUN NNP _ _ _ _ food_type=ingredient \n", + "13 with with ADP IN _ _ _ _ _ \n", + "14 kombu kombu NOUN NNP _ _ _ _ _ \n", + "15 tea tea NOUN NN _ _ _ _ food_type=ingredient \n", + "16 evenly evenli ADV RB _ _ _ _ _ \n", + "17 on on ADP IN _ _ _ _ _ \n", + "18 both both DET DT _ _ _ _ _ \n", + "19 sides side NOUN NNS _ _ _ _ _ \n", + "20 of of ADP IN _ _ _ _ _ \n", + "21 the the DET DT _ _ _ _ _ \n", + "22 chicken chicken NOUN NN _ _ _ _ food_type=ingredient \n", + "23 , , . , _ _ _ _ _ \n", + "24 about about ADV RB _ _ _ _ _ \n", + "25 1 1 NUM CD _ _ _ _ _ \n", + "26 teaspoon teaspoon NOUN NN _ _ _ _ _ \n", + "27 per per ADP IN _ _ _ _ _ \n", + "28 chicken_thigh chicken_thigh NOUN NN _ _ _ _ food_type=ingredient \n", + "29 . . . . _ _ _ _ _ \n", + "30 Brown brown NOUN NNP _ _ _ _ food_type=ingredient \n", + "31 the the DET DT _ _ _ _ _ \n", + "32 skin skin ADJ JJ _ _ _ _ _ \n", + "33 side side NOUN NN _ _ _ _ _ \n", + "34 of of ADP IN _ _ _ _ _ \n", + "35 the the DET DT _ _ _ _ _ \n", + "36 chicken chicken NOUN NN _ _ _ _ food_type=ingredient \n", + "37 first first ADV RB _ _ _ _ _ \n", + "38 over over ADV RB _ _ _ _ _ \n", + "39 high high ADJ JJ _ _ _ _ _ \n", + "40 heat heat NOUN NN _ _ _ _ _ \n", + "41 until until ADP IN _ _ _ _ _ \n", + "42 golden golden ADJ JJ _ _ _ _ _ \n", + "43 brown brown NOUN NN _ _ _ _ food_type=ingredient \n", + "44 . . . . _ _ _ _ _ \n", + "45 Sprinkle sprinkl CONJ CC _ _ _ _ food_type=ingredient \n", + "46 some some DET DT _ _ _ _ _ \n", + "47 pepper pepper NOUN NN _ _ _ _ food_type=ingredient \n", + "48 on on ADP IN _ _ _ _ _ \n", + "49 the the DET DT _ _ _ _ _ \n", + "50 meat meat NOUN NN _ _ _ _ food_type=ingredient \n", + "51 just just ADV RB _ _ _ _ _ \n", + "52 before befor ADV RB _ _ _ _ _ \n", + "53 flipping flip VERB VBG _ _ _ _ _ \n", + "54 over over PRT RP _ _ _ _ _ \n", + "55 . . . . _ _ _ _ _ \n", + "56 Then then ADV RB _ _ _ _ _ \n", + "57 brown brown ADP IN _ _ _ _ food_type=ingredient \n", + "58 the the DET DT _ _ _ _ _ \n", + "59 other other ADJ JJ _ _ _ _ food_type=ingredient \n", + "60 side side NOUN NN _ _ _ _ _ \n", + "61 until until ADP IN _ _ _ _ _ \n", + "62 golden golden ADJ JJ _ _ _ _ _ \n", + "63 brown brown NOUN NN _ _ _ _ food_type=ingredient \n", + "64 . . . . _ _ _ _ _ \n", + "\n", + "\n", + "0 Put put NOUN NN _ _ _ _ _ \n", + "1 ingredients ingredi NOUN NNS _ _ _ _ _ \n", + "2 in in ADP IN _ _ _ _ _ \n", + "3 a a DET DT _ _ _ _ _ \n", + "4 buttered butter ADJ JJ _ _ _ _ food_type=ingredient \n", + "5 9 9 NUM CD _ _ _ _ _ \n", + "6 x x ADJ JJ _ _ _ _ _ \n", + "7 12 12 NUM CD _ _ _ _ _ \n", + "8 x x ADJ JJ _ _ _ _ _ \n", + "9 2-inch 2-inch ADJ JJ _ _ _ _ _ \n", + "10 pan pan NOUN NN _ _ _ _ _ \n", + "11 in in ADP IN _ _ _ _ _ \n", + "12 even even ADJ JJ _ _ _ _ _ \n", + "13 layers layer NOUN NNS _ _ _ _ _ \n", + "14 in in ADP IN _ _ _ _ _ \n", + "15 the the DET DT _ _ _ _ _ \n", + "16 order order NOUN NN _ _ _ _ _ \n", + "17 that that ADP IN _ _ _ _ _ \n", + "18 they they PRON PRP _ _ _ _ _ \n", + "19 are are VERB VBP _ _ _ _ _ \n", + "20 given given VERB VBN _ _ _ _ _ \n", + "21 - - . : _ _ _ _ _ \n", + "22 DO DO NOUN NNP _ _ _ _ _ \n", + "23 NOT not NOUN NNP _ _ _ _ _ \n", + "24 MIX mix NOUN NNP _ _ _ _ _ \n", + "25 . . . . _ _ _ _ _ \n", + "26 Bake bake NOUN NNP _ _ _ _ _ \n", + "27 in in ADP IN _ _ _ _ _ \n", + "28 a a DET DT _ _ _ _ _ \n", + "29 350 350 NUM CD _ _ _ _ _ \n", + "30 oven oven NOUN NN _ _ _ _ _ \n", + "31 for for ADP IN _ _ _ _ _ \n", + "32 1 1 NUM CD _ _ _ _ _ \n", + "33 hour hour NOUN NN _ _ _ _ _ \n", + "34 . . . . _ _ _ _ _ \n", + "\n", + "\n", + "0 Layer layer NOUN NNP _ _ _ _ _ \n", + "1 all all DET DT _ _ _ _ _ \n", + "2 ingredients ingredi NOUN NNS _ _ _ _ _ \n", + "3 in in ADP IN _ _ _ _ _ \n", + "4 a a DET DT _ _ _ _ _ \n", + "5 serving serv ADJ JJ _ _ _ _ _ \n", + "6 dish dish NOUN NN _ _ _ _ _ \n", + "7 . . . . _ _ _ _ _ \n", + "\n", + "\n", + "0 Sift sift NOUN NNP _ _ _ _ _ \n", + "1 dry dri ADJ JJ _ _ _ _ _ \n", + "2 ingredients ingredi NOUN NNS _ _ _ _ _ \n", + "3 . . . . _ _ _ _ _ \n", + "4 beat beat NOUN NN _ _ _ _ _ \n", + "5 eggs egg NOUN NNS _ _ _ _ food_type=ingredient \n", + "6 untill until ADJ JJ _ _ _ _ _ \n", + "7 frothy frothi ADJ JJ _ _ _ _ _ \n", + "8 , , . , _ _ _ _ _ \n", + "9 add add ADJ JJ _ _ _ _ _ \n", + "10 sugar sugar NOUN NN _ _ _ _ food_type=ingredient \n", + "11 , , . , _ _ _ _ _ \n", + "12 oil oil NOUN NN _ _ _ _ food_type=ingredient \n", + "13 and and CONJ CC _ _ _ _ _ \n", + "14 vanilla vanilla NOUN NN _ _ _ _ food_type=ingredient \n", + "15 . . . . _ _ _ _ _ \n", + "16 Beat beat NOUN NNP _ _ _ _ _ \n", + "17 untillthick untillthick ADJ JJ _ _ _ _ _ \n", + "18 . . . . _ _ _ _ _ \n", + "19 Stir stir NOUN NNP _ _ _ _ _ \n", + "20 in in ADP IN _ _ _ _ _ \n", + "21 zucchini zucchini NOUN NNP _ _ _ _ food_type=ingredient \n", + "22 . . . . _ _ _ _ _ \n", + "23 blend blend NOUN NN _ _ _ _ _ \n", + "24 in in ADP IN _ _ _ _ _ \n", + "25 sifted sift ADJ JJ _ _ _ _ _ \n", + "26 dry dri ADJ JJ _ _ _ _ _ \n", + "27 ingredients ingredi NOUN NNS _ _ _ _ _ \n", + "28 . . . . _ _ _ _ _ \n", + "29 Fold fold NOUN NNP _ _ _ _ _ \n", + "30 in in ADP IN _ _ _ _ _ \n", + "31 nuts nut NOUN NNS _ _ _ _ food_type=ingredient \n", + "32 . . . . _ _ _ _ _ \n", + "33 pour pour NOUN NN _ _ _ _ _ \n", + "34 in in ADP IN _ _ _ _ _ \n", + "35 greased greas ADJ JJ _ _ _ _ _ \n", + "36 loaf loaf NOUN NN _ _ _ _ _ \n", + "37 pan pan NOUN NN _ _ _ _ _ \n", + "38 and and CONJ CC _ _ _ _ _ \n", + "39 bake bake NOUN NN _ _ _ _ _ \n", + "40 at at ADP IN _ _ _ _ _ \n", + "41 350 350 NUM CD _ _ _ _ _ \n", + "42 degrees degre NOUN NNS _ _ _ _ _ \n", + "43 for for ADP IN _ _ _ _ _ \n", + "44 1 1 NUM CD _ _ _ _ _ \n", + "45 1/2 1/2 NUM CD _ _ _ _ _ \n", + "46 hours hour NOUN NNS _ _ _ _ _ \n", + "47 . . . . _ _ _ _ _ \n", + "\n" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cg" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/Tagging/conllu_generator.py b/Tagging/conllu_generator.py new file mode 100644 index 0000000..8898f0a --- /dev/null +++ b/Tagging/conllu_generator.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python3 + +import nltk +from nltk.tag import pos_tag, map_tag +from nltk.stem import PorterStemmer +from nltk.corpus import stopwords as nltk_stopwords +from stemmed_mwe_tokenizer import StemmedMWETokenizer + + +CONLLU_ATTRIBUTES = [ + "id", + "form", + "lemma", + "upos", + "xpos", + "feats", + "head", + "deprel", + "deps", + "misc" +] + +# took from: https://stackoverflow.com/a/16053211 + + +def replace_tab(s, tabstop=4): + result = str() + for c in s: + if c == '\t': + while (len(result) % tabstop != 0): + result += ' ' + else: + result += c + return result + + +class ConlluDict(dict): + + def from_str(self, s: str): + entries = s.split("|") + for entry in entries: + key, val = entry.split("=") + self[key.strip()] = val.strip() + + def __repr__(self): + if len(self) == 0: + return "_" + + result = "" + for key, value in self.items(): + result += key + "=" + value + "|" + + return result[:-1] + + def __str__(self): + return self.__repr__() + + +class ConlluElement(object): + # class uses format described here: https://universaldependencies.org/format.html + def __init__( + self, + id: int, + form: str, + lemma: str, + upos: str = "_", + xpos: str = "_", + feats: str = "_", + head: str = "_", + deprel: str = "_", + deps: str = "_", + misc: str = "_"): + self.id = id + self.form = form + self.lemma = lemma + self.upos = upos + self.xpos = xpos + + self.feats = ConlluDict() + if feats != "_": + self.feats.from_str(feats) + + self.head = head + self.deprel = deprel + self.deps = deps + + self.misc = ConlluDict() + if misc != "_": + self.misc.from_str(misc) + + def add_feature(self, key: str, value: str): + self.feats[key] = value + + def add_misc(self, key: str, value: str): + self.misc[key] = value + + def __repr__(self): + result = "" + for attr in CONLLU_ATTRIBUTES: + result += str(self.__getattribute__(attr)) + " \t" + return replace_tab(result, 16) + + +class ConlluDocument(object): + def __init__(self): + self.conllu_elements = [] + + def add(self, conllu_element: ConlluElement): + self.conllu_elements.append(conllu_element) + + def __repr__(self): + result = "" + for elem in self.conllu_elements: + result += elem.__repr__() + "\n" + + return result + "\n" + + def __str__(self): + return self.__repr__() + + +class ConlluGenerator(object): + def __init__(self, documents: list, stemmed_multi_word_tokens, stemmer=PorterStemmer()): + self.documents = documents + self.stemmed_multi_word_tokens = stemmed_multi_word_tokens + self.mwe_tokenizer = StemmedMWETokenizer( + [w.split() for w in stemmed_multi_word_tokens]) + self.stemmer = stemmer + + self.id_counter = 0 + + self.conllu_documents = [] + + def tokenize_and_stem(self): + tokenized_documents = [] + + for doc in self.documents: + simple_tokenized = nltk.tokenize.word_tokenize(doc) + tokenized_documents.append( + self.mwe_tokenizer.tokenize(simple_tokenized)) + + # now create initial colln-u elemnts + for doc in tokenized_documents: + self.id_counter = 0 + collnu_doc = ConlluDocument() + for token in doc: + stemmed_token = None + if "_" in token: + stemmed_token = "_".join( + [self.stemmer.stem(part) for part in token.split("_")]) + else: + stemmed_token = self.stemmer.stem(token) + collnu_doc.add(ConlluElement( + id=self.id_counter, + form=token, + lemma=stemmed_token + )) + self.id_counter += 1 + self.conllu_documents.append(collnu_doc) + + def pos_tagging(self): + for conllu_document in self.conllu_documents: + tokens = [x.form for x in conllu_document.conllu_elements] + pos_tags = pos_tag(tokens) + simplified_tags = [map_tag('en-ptb', 'universal', tag) + for word, tag in pos_tags] + + for i in range(len(tokens)): + conllu_elem = conllu_document.conllu_elements[i] + conllu_elem.upos = simplified_tags[i] + conllu_elem.xpos = pos_tags[i][1] + + def add_misc_value_by_list(self, key, value, stemmed_keyword_list): + for conllu_document in self.conllu_documents: + for elem in conllu_document.conllu_elements: + if elem.lemma in stemmed_keyword_list: + elem.add_misc(key, value) + + def __repr__(self): + result = "" + for document in self.conllu_documents: + result += document.__repr__() + "\n" + return result + + def __str__(self): + return self.__repr__() diff --git a/Tagging/recipe_collnu_generator.py b/Tagging/recipe_collnu_generator.py new file mode 100755 index 0000000..df78455 --- /dev/null +++ b/Tagging/recipe_collnu_generator.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 + +import sys +sys.path.insert(0, '..') + +from conllu_generator import ConlluDict, ConlluElement, ConlluDocument, ConlluGenerator +import settings +import importlib.util +from json_buffered_reader import JSON_buffered_reader as JSON_br + + + +# loading ingredients: +spec = importlib.util.spec_from_file_location( + "ingredients", "../" + settings.ingredients_file) +ingredients = importlib.util.module_from_spec(spec) +spec.loader.exec_module(ingredients) + +# load json reader + + +# settings: +recipe_buffer_size = 1000 +recipe_buffers_per_file = 5 + + +# create reader +buffered_reader_1M = JSON_br("../" + settings.one_million_recipes_file) + +# open savefile: + + + +def process_instructions(instructions: list): + + if len(instructions) == 0: + return + + conllu_input_docs = [doc.replace("\n", " ")[:-1] for doc in instructions] + + cg = ConlluGenerator( + conllu_input_docs, ingredients.multi_word_ingredients_stemmed) + cg.tokenize_and_stem() + cg.pos_tagging() + cg.add_misc_value_by_list("food_type", "ingredient", [w.replace(" ","_") for w in ingredients.multi_word_ingredients_stemmed] + ingredients.ingredients_stemmed) + + savefile.write(str(cg)) + +i = 0 +buffer_count = 0 +file_count = 0 + +savefile = open(f"recipes{file_count}.conllu", 'w') +instructions = [] + +for raw_recipe in buffered_reader_1M: + instruction = "" + for item in raw_recipe['instructions']: + instruction += item['text'] + '\n' + + instructions.append(instruction) + i += 1 + if i % recipe_buffer_size == 0: + process_instructions(instructions) + print(f"processed {i} recipes") + instructions = [] + buffer_count += 1 + if buffer_count % recipe_buffers_per_file == 0: + savefile.close() + savefile = open(f"recipes{file_count}.conllu", 'w') + file_count += 1 + +process_instructions(instructions) +print(f"processed {i} recipes") + +savefile.close() diff --git a/Tagging/stemmed_mwe_tokenizer.py b/Tagging/stemmed_mwe_tokenizer.py new file mode 100644 index 0000000..2e3b370 --- /dev/null +++ b/Tagging/stemmed_mwe_tokenizer.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 + +import nltk +from nltk import PorterStemmer + +from nltk.util import Trie + +# modified MWE Tokenizer which stems multi word expressions before the merge check + + +class StemmedMWETokenizer(nltk.tokenize.api.TokenizerI): + def __init__(self, stemmed_tokens, stemmer=PorterStemmer(), separator="_"): + self.stemmer = stemmer + self.stemmed_tokens = stemmed_tokens + self.mwes = Trie(stemmed_tokens) + self.separator = separator + + def tokenize(self, text): + """ + + :param text: A list containing tokenized text + :type text: list(str) + :return: A list of the tokenized text with multi-words merged together + :rtype: list(str) + + :Example: + + >>> tokenizer = MWETokenizer([('hors', "d'oeuvre")], separator='+') + >>> tokenizer.tokenize("An hors d'oeuvre tonight, sir?".split()) + ['An', "hors+d'oeuvre", 'tonight,', 'sir?'] + + """ + i = 0 + n = len(text) + result = [] + + while i < n: + if self.stemmer.stem(text[i]) in self.mwes: + # possible MWE match + j = i + trie = self.mwes + while j < n and self.stemmer.stem(text[j]) in trie: + trie = trie[self.stemmer.stem(text[j])] + j = j + 1 + else: + if Trie.LEAF in trie: + # success! + result.append(self.separator.join(text[i:j])) + i = j + else: + # no match, so backtrack + result.append(text[i]) + i += 1 + else: + result.append(text[i]) + i += 1 + + return result