Added container Category for conllu generation
This commit is contained in:
		| @ -36,10 +36,16 @@ | ||||
|     "\n", | ||||
|     "# loading actions:\n", | ||||
|     "spec = importlib.util.spec_from_file_location(\n", | ||||
|     "    \"ingredients\", \"../\" + settings.actions_file)\n", | ||||
|     "    \"actions\", \"../\" + settings.actions_file)\n", | ||||
|     "actions = importlib.util.module_from_spec(spec)\n", | ||||
|     "spec.loader.exec_module(actions)\n", | ||||
|     "\n", | ||||
|     "# loading containers\n", | ||||
|     "spec = importlib.util.spec_from_file_location(\n", | ||||
|     "    \"containers\", \"../\" + settings.container_file)\n", | ||||
|     "containers = importlib.util.module_from_spec(spec)\n", | ||||
|     "spec.loader.exec_module(containers)\n", | ||||
|     "\n", | ||||
|     "# skipping recipes:\n", | ||||
|     "n_skipped_recipes = int(sys.argv[1]) if len(sys.argv) > 1 else 0\n", | ||||
|     "print(\"start reading at recipe \" + str(n_skipped_recipes))\n", | ||||
| @ -72,6 +78,7 @@ | ||||
|     "    cg.pos_tagging()\n", | ||||
|     "    cg.add_misc_value_by_list(\"food_type\", \"ingredient\", [w.replace(\" \",\"_\") for w in ingredients.multi_word_ingredients_stemmed] + ingredients.ingredients_stemmed)\n", | ||||
|     "    cg.add_misc_value_by_list(\"food_type\", \"action\", actions.stemmed_cooking_verbs)\n", | ||||
|     "    cg.add_misc_value_by_list(\"food_type\", \"containers\", containers.containers)\n", | ||||
|     "\n", | ||||
|     "    savefile.write(str(cg))" | ||||
|    ] | ||||
|  | ||||
| @ -20,10 +20,16 @@ spec.loader.exec_module(ingredients) | ||||
|  | ||||
| # loading actions: | ||||
| spec = importlib.util.spec_from_file_location( | ||||
|     "ingredients", "../" + settings.actions_file) | ||||
|     "actions", "../" + settings.actions_file) | ||||
| actions = importlib.util.module_from_spec(spec) | ||||
| spec.loader.exec_module(actions) | ||||
|  | ||||
| # loading containers | ||||
| spec = importlib.util.spec_from_file_location( | ||||
|     "containers", "../" + settings.container_file) | ||||
| containers = importlib.util.module_from_spec(spec) | ||||
| spec.loader.exec_module(containers) | ||||
|  | ||||
| # skipping recipes: | ||||
| n_skipped_recipes = int(sys.argv[1]) if len(sys.argv) > 1 else 0 | ||||
| print("start reading at recipe " + str(n_skipped_recipes)) | ||||
| @ -50,6 +56,7 @@ def process_instructions(instructions: list, document_ids=None): | ||||
|     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) | ||||
|     cg.add_misc_value_by_list("food_type", "action", actions.stemmed_cooking_verbs) | ||||
|     cg.add_misc_value_by_list("food_type", "containers", containers.containers) | ||||
|  | ||||
|     savefile.write(str(cg)) | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user