From 6936e07efc001765da9399e08ddd3fa78906cbb2 Mon Sep 17 00:00:00 2001 From: David Fifield Date: Mon, 30 Oct 2023 07:18:49 +0000 Subject: [PATCH] Lowercase the "word" variable before looking up in EXPECTANCY. The tei2csv "word" column is always lowercased as a side effect of the hexameter module's analysis. The "word" lookup in tei2html did not similarly lowercase the text of the word, so clicking on a word that was not already all lowercase produced to result. It may be possible to instead have tei2csv retain letter case in the "word" column, but that will require an audit of source texts to see that the same word is not used with different cases in different places. Closes #84. --- src/tei2html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tei2html b/src/tei2html index ef1726d..05a7e1e 100755 --- a/src/tei2html +++ b/src/tei2html @@ -928,7 +928,11 @@ function info(target) { ["book_n", bookno], ["line_n", lineno], ["word_n", wordno], - ["word", target.textContent], + // Lowercase the literal word from the text, to match what + // hexameter.analyze_line_metrical does internally and what is stored in + // tei2csv output. + // https://github.com/sasansom/sedes/blob/526941f65bf88efb82db7d3bfbfe632e4f0d40ff/src/hexameter/scan.py#L378 + ["word", target.textContent.toLowerCase()], ["lemma", target.getAttribute("data-lemma")], ["sedes", target.getAttribute("data-sedes")], ["metrical_shape", target.getAttribute("data-shape")],