foliokestrel's picture
Add a blind transcription worksheet, page-level reader selection, and reproducible comparisons on Finnish newspapers.
1d6baac verified
Raw History Blame Contribute Delete
4.68 kB
<!doctype html>
<html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<title>Transcribe a line sample</title>
<style>
*{box-sizing:border-box}body{max-width:58rem;margin:auto;padding:1.2rem;font:1rem/1.5 system-ui,sans-serif;color:#232722;background:#fbfaf7}
h1{font:2.3rem Georgia,serif;margin-bottom:.2rem}p{max-width:68ch}section{margin:1rem 0 2rem}
label{font-weight:600;overflow-wrap:anywhere}.scan{margin:.35rem 0;background:white;border:1px solid #b7bbb1;overflow-x:auto}
img{display:block;max-width:100%;height:auto;min-height:1.1rem}body.zoom img{max-width:none}
textarea{width:100%;font:1.05rem/1.4 Georgia,serif;min-height:3.2rem;padding:.45rem}
button{font:inherit;padding:.4rem .75rem;color:#173f31;background:white;border:1px solid #6b8272;border-radius:.25rem;margin:.2rem 0}
footer{position:sticky;bottom:0;background:#fbfaf7;border-top:1px solid #aaa;padding:.5rem 0}button:disabled{opacity:.55}
</style>
<h1>Transcribe a line sample</h1>
<p>Read each scan and type what you see. Leave uncertain lines empty to omit them from the comparison. Save a draft beside this worksheet to resume later. Save the exported TSV in the same folder as this worksheet.</p>
<button id="zoom" aria-pressed="false">Original image size</button>
<p>Four cropped line images from the National Library of Finland newspaper ground truth, published by Guenter Muehlberger and Guenter Hackl. Cropping and worksheet by Folio Kestrel. <a href="https://zenodo.org/records/4599472">Source</a> 路 <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></p>
<main><section><label for="r1">1. title 0 路 tl_101</label><div class="scan"><img src="images/72a1d3778b8c662ee46f3a58baaaf59ee673072871b4b671fbe6ac9eaf2c224a.png" alt="Scanned text line 1"></div><textarea id="r1" data-image="images/72a1d3778b8c662ee46f3a58baaaf59ee673072871b4b671fbe6ac9eaf2c224a.png" data-group="title 0" spellcheck="false"></textarea></section>
<section><label for="r2">2. title 2 路 tl_370</label><div class="scan"><img src="images/646293e8b463957bd27b0470008e875ad111c49fef890a8f41bb9cb6fdf635d0.png" alt="Scanned text line 2"></div><textarea id="r2" data-image="images/646293e8b463957bd27b0470008e875ad111c49fef890a8f41bb9cb6fdf635d0.png" data-group="title 2" spellcheck="false"></textarea></section>
<section><label for="r3">3. title 1 路 tl_23</label><div class="scan"><img src="images/fdba33394cac45dea864391fb59754db9b04271becb750465a704c9a2e0346ec.png" alt="Scanned text line 3"></div><textarea id="r3" data-image="images/fdba33394cac45dea864391fb59754db9b04271becb750465a704c9a2e0346ec.png" data-group="title 1" spellcheck="false"></textarea></section>
<section><label for="r4">4. title 0 路 tl_122</label><div class="scan"><img src="images/6ecd1de6bbf95f9e3ac86c066421e76793ff863dbd4965ef906fdc99c8ff4a87.png" alt="Scanned text line 4"></div><textarea id="r4" data-image="images/6ecd1de6bbf95f9e3ac86c066421e76793ff863dbd4965ef906fdc99c8ff4a87.png" data-group="title 0" spellcheck="false"></textarea></section></main>
<footer><output id="count" aria-live="polite"></output><br>
<button id="draft">Save draft</button> <button id="export">Export transcribed lines</button></footer>
<script>
const fields = [...document.querySelectorAll("textarea")];
const byId = id => document.getElementById(id);
for (const field of fields) {
if (field.hasAttribute("data-draft")) field.value=JSON.parse(field.dataset.draft);
}
function refresh(){
const count = fields.filter(f=>f.value.trim()).length;
byId("count").textContent = count+" of "+fields.length+" transcribed";
byId("export").disabled = count===0;
}
function download(name, blob){
const url = URL.createObjectURL(blob), a = document.createElement("a");
a.href=url; a.download=name; a.click(); setTimeout(()=>URL.revokeObjectURL(url),1500);
}
byId("zoom").onclick=()=>byId("zoom").setAttribute("aria-pressed",String(document.body.classList.toggle("zoom")));
document.addEventListener("input",refresh);
byId("draft").onclick=()=>{
const copy=document.documentElement.cloneNode(true);
copy.querySelectorAll("textarea").forEach((f,i)=>f.dataset.draft=JSON.stringify(fields[i].value));
download("worksheet-draft.html",new Blob(["<!doctype html>\n",copy.outerHTML],{type:"text/html;charset=utf-8"}));
};
byId("export").onclick=()=>{
const quote=x=>'"'+x.replaceAll('"','""')+'"';
const rows=[["image","reference","group"],...fields.filter(f=>f.value.trim()).map(f=>[f.dataset.image,f.value,f.dataset.group])];
download("sample.tsv",new Blob([rows.map(r=>r.map(quote).join("\t")).join("\n")+"\n"],{type:"text/tab-separated-values;charset=utf-8"}));
};
refresh();
</script></html>