diff --git a/english/format.ipynb b/english/format.ipynb index 0aeaba2..2dcc167 100644 --- a/english/format.ipynb +++ b/english/format.ipynb @@ -205,7 +205,7 @@ " def _replace(e):\n", " if word not in e:\n", " return e \n", - " if not re.match(f\"^{word}.*?$\", e):\n", + " if not re.match(f\"^{word}.*?$\", e, re.IGNORECASE):\n", " return e\n", " return e.replace(word, '_')\n", " example_split_replaced = list(map(lambda e: _replace(e), example_split))\n", @@ -228,7 +228,7 @@ "html = style.to_html()\n", "filename = DATASET + '_alphabetical'\n", "with open(f'output/{filename}.html', 'w') as f:\n", - " f.write(html)\n", + " f.write(''+html)\n", "\n", "cmd = f'pandoc -f html -t pdf output/{filename}.html -t html5 -o output/{filename}.pdf --metadata pagetitle=\"{filename}\" -V margin-top=2 -V margin-bottom=2 -V margin-left=2 -V margin-right=2 -c format/table.css --pdf-engine-opt=--enable-local-file-access'\n", "os.system(cmd)" @@ -281,7 +281,7 @@ "html = style.to_html()\n", "filename = DATASET + '_underscore_alphabetical'\n", "with open(f'output/{filename}.html', 'w') as f:\n", - " f.write(html)\n", + " f.write(''+html)\n", "\n", "cmd = f'pandoc -f html -t pdf output/{filename}.html -t html5 -o output/{filename}.pdf --metadata pagetitle=\"{filename}\" -V margin-top=2 -V margin-bottom=2 -V margin-left=2 -V margin-right=2 -c format/table.css --pdf-engine-opt=--enable-local-file-access'\n", "os.system(cmd)" @@ -10492,7 +10492,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/english/format.py b/english/format.py index f2ce015..9a83783 100644 --- a/english/format.py +++ b/english/format.py @@ -32,7 +32,7 @@ def replace_word_in_example_with_underscore(word, example): def _replace(e): if word not in e: return e - if not re.match(f"^{word}.*?$", e): + if not re.match(f"^{word}.*?$", e, re.IGNORECASE): return e return e.replace(word, '_') example_split_replaced = list(map(lambda e: _replace(e), example_split)) @@ -343,4 +343,4 @@ def fix_latex_line(line): # ## Run terminal cd format latexmk oxford*.tex to finish build pdfs #cmd_build = f"latexmk -pdf -cd format/{DATASET}*.tex -outdir=../output" -#os.system(cmd_build) \ No newline at end of file +#os.system(cmd_build) diff --git a/spanish/format.ipynb b/spanish/format.ipynb index b3f8a14..3a2e687 100644 --- a/spanish/format.ipynb +++ b/spanish/format.ipynb @@ -265,7 +265,7 @@ " def _replace(e):\n", " if word not in e:\n", " return e\n", - " if not re.match(f\"^{word}.*?$\", e):\n", + " if not re.match(f\"^{word}.*?$\", e, re.IGNORECASE):\n", " return e\n", " return e.replace(word, '_')\n", " field_split_replaced = list(map(lambda e: _replace(e), field_split))\n", diff --git a/spanish/format.py b/spanish/format.py index b9d8b85..487beab 100644 --- a/spanish/format.py +++ b/spanish/format.py @@ -29,7 +29,7 @@ def replace_word_in_field_with_underscore(word, field): def _replace(e): if word not in e: return e - if not re.match(f"^{word}.*?$", e): + if not re.match(f"^{word}.*?$", e, re.IGNORECASE): return e return e.replace(word, '_') field_split_replaced = list(map(lambda e: _replace(e), field_split))