<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Dear CWB members,</span><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">Maybe someone can help with this. I want to create a workflow to annotate, edit, etc. CWB corpora in R and I have some open issues.</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">What works so far:</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">1) polmineR C.old &lt;- decode([CORPUS], to=“data.table) —&gt; which works fine and creates a datable of the tokenstream with p_attributes as well as s_attributes in columns.&nbsp;</span></div><div><span style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>- The CWB corpus contains the following s_attributes: "”corpus”, "text” , “text_id",”s",”s_id",“s_polarity",”s_subjectivity"</span></div><div><span style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>- the decoded data.table C.old contains columns for all of these, with “corpus”,”text”, and “s” being empty</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">2) using cwbtools I do:</span></div><div><span style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>-&nbsp;C.new&lt;- CorpusData$new()</span></div><div><span style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>- C.new$tokenstream &lt;- C.old</span></div><div><span style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>- cpos_max_min &lt;- function(x) list(cpos_left = min(x[["cpos"]]), cpos_right = max(x[["cpos"]]))</span></div><div><span style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>- C.new$metadata &lt;- C.new$tokenstream[, cpos_max_min(.SD), by = text_id]</span></div><div><div><span style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>- C.new$tokenstream[, text_id := NULL]</span></div></div><div><span style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>- then I use C.new$encode(…)</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">While this works in principle, the resulting registry files for the s_attribute are different&nbsp;</span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-size: 14px;">(see excerpts below)</span><span style="font-size: 14px;">, and I’m not sure yet whether this might create problems. More importantly, I am unclear how I could use this approach while also keeping the structuring of the corpus in sentences, including the annotation s_id, s_polarity, s_subjectivity.</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">Does anyone have any pointers as to how I could reencode a corpus in R that is more similar or even identical to what I decoded?</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">Best,</span></div><div><span style="font-size: 14px;">Thomas</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">The s_attributes part of the original registry file looks like this:</span></div><div><span style="font-size: 14px;"><br></span></div><div><div><span style="font-size: 14px;">##</span></div><div><span style="font-size: 14px;">## s-attributes (structural markup)</span></div><div><span style="font-size: 14px;">##</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;"># &lt;corpus&gt; ... &lt;/corpus&gt;</span></div><div><span style="font-size: 14px;">STRUCTURE corpus</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;"># &lt;text id=".."&gt; ... &lt;/text&gt;</span></div><div><span style="font-size: 14px;"># (no recursive embedding allowed)</span></div><div><span style="font-size: 14px;">STRUCTURE text</span></div><div><span style="font-size: 14px;">STRUCTURE text_id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# [annotations]</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;"># &lt;s id=".." polarity=".." subjectivity=".."&gt; ... &lt;/s&gt;</span></div><div><span style="font-size: 14px;"># (no recursive embedding allowed)</span></div><div><span style="font-size: 14px;">STRUCTURE s</span></div><div><span style="font-size: 14px;">STRUCTURE s_id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # [annotations]</span></div><div><span style="font-size: 14px;">STRUCTURE s_polarity &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # [annotations]</span></div><div><span style="font-size: 14px;">STRUCTURE s_subjectivity &nbsp; &nbsp; &nbsp; # [annotations]</span></div><div><span style="font-size: 14px;"><br></span></div></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">The registry file for C.new is simply:&nbsp;</span></div><div><span style="font-size: 14px;"><br></span></div><div><div><span style="font-size: 14px;">## s-attributes</span></div><div><span style="font-size: 14px;">##</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">STRUCTURE text_id</span></div></div><div><span style="font-size: 14px;"><br></span></div><span style="font-size: 14px;"><br><br></span><div>
<meta charset="UTF-8"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;"><br class="Apple-interchange-newline">-------------------------------------------------------------------------------------</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Dr. Thomas C. Messerli</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Postdoctoral Teaching and Research Fellow (Oberassistent)</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Department of&nbsp;Languages and Literatures, Universität Basel</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Englisches Seminar</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Nadelberg 6</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">CH-4051&nbsp;Basel</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;"><br></span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Office 15&nbsp;</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">+41 61 207 27 82</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;"><br></span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">http://www.thomasmesserli.org<br>thomas.messerli@unibas.ch</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;"><br></span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;"><br></span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;"><br></span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Recent publications:</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Dayter, Daria, Locher, Miriam,&nbsp;A. &amp; Messerli, Thomas C.&nbsp;(2023).&nbsp;<a href="https://www.cambridge.org/core/elements/pragmatics-in-translation/2253C3F6A17EEC4A08297B137450D402">Pragmatics in&nbsp;Translation</a>. Cambridge&nbsp;University Press.</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Landert, Daniela,&nbsp;Dayter, Daria,&nbsp;Messerli, Thomas C., &amp;&nbsp;Locher, Miriam A. (2023).&nbsp;<a href="https://www.cambridge.org/core/elements/corpus-pragmatics/30FE00EAA8BC1F9C3191B390AB4B0040">Corpus Pragmatics</a>.&nbsp;Cambridge University&nbsp;Press.<br>Locher, Miriam. A, Jucker,&nbsp;Andreas H., Landert,&nbsp;Daniela, &amp; Messerli,&nbsp;Thomas C. (2023).&nbsp;<a href="https://www.cambridge.org/core/elements/fiction-and-pragmatics/D198C6EEF1402A67B259E53221B1CD16">Fiction and Pragmatics</a>. Cambridge&nbsp;University Press.</span></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span style="font-size: 14px;">Locher, Miriam A., &amp; Messerli,&nbsp;Thomas C. (2023).&nbsp;<a href="https://www.sciencedirect.com/science/article/pii/S2211695823000193">“This is not&nbsp;the place to bother people about&nbsp;BTS”</a>: Pseudo-synchronicity and&nbsp;interaction in timed comments&nbsp;by Hallyu fans on the video&nbsp;streaming platform Viki&nbsp;Discourse, Context &amp; Media,&nbsp;52.&nbsp;https://doi.org/10.1016/j.dcm.2023.100686</span></div></div></div></div></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"></span></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"></span></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"></span></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"></span></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"></span></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"></span></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"></span></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"></span></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"></span></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"></span></div><span style="font-size: 14px;"><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</span></div>
<br></body></html>