emacs/var/elfeed/db/data/ca/ca24717f06cfde0ab38e048920196e54bbe9500e
2022-01-03 12:49:32 -06:00

1 line
6.1 KiB
Plaintext

<!-- SC_OFF --><div class="md"><p>Dear fellow Orgers...</p> <p>TLDR: how to count tags in a buffer and put them in a matrix where each cell counts the co-occurrences of both tags in a heading?</p> <p>The long story: thematic analysis is a quite common technique used to synthesize meaning in texts (those interested in a brief but good introduction, please peek <a href="https://www.scribbr.com/methodology/thematic-analysis/">https://www.scribbr.com/methodology/thematic-analysis/</a>). In short, once done each idea in a text is marked by a tag, and then you can synthesize a text by it&#39;s tags (of course, we can also group them, but that comes after) and different texts can be compared by it&#39;s found tags.</p> <p>As we all know, emacs is a great operating system and comes not only with org-mode but also with a decent editor ;) so it was a logical idea to use both to do thematic analysis. And in the end, it seems that it may be not only efficient but better than before (and free like in beer, since the tools for this are usually not exactly inexpensive).</p> <p>In this MVE (included after this text) we have one &quot;Question X&quot; and each answer is included in a heading marked by who said it (User 1, User 2, and so on). Each answer can be easily tagged (for example, the response of User 1 has &quot;tagA&quot;, User 2 has both &quot;tagB&quot; and &quot;tagC&quot;).</p> <pre><code>* Questions X and it&#39;s answers ** U1 :tagA: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut sem viverra aliquet eget. Et sollicitudin ac orci phasellus egestas tellus. Gravida cum sociis natoque penatibus et magnis. Mi bibendum neque egestas congue quisque egestas diam. Feugiat scelerisque varius morbi enim nunc faucibus a. Vestibulum mattis ullamcorper velit sed ullamcorper morbi. ** U2 :tagB:tagC: Interdum consectetur libero id faucibus nisl. Velit euismod in pellentesque massa. Id aliquet risus feugiat in ante metus dictum at tempor. Proin sed libero enim sed faucibus turpis in. Dictum varius duis at consectetur lorem donec massa. Quam pellentesque nec nam aliquam sem. Orci dapibus ultrices in iaculis nunc sed augue. Mattis pellentesque id nibh tortor id aliquet lectus. Pharetra convallis posuere morbi leo urna molestie at elementum eu. Sem nulla pharetra diam sit amet nisl. At consectetur lorem donec massa sapien. Aenean euismod elementum nisi quis eleifend quam adipiscing vitae proin. ** U3 :tagA:tagB: Sit amet cursus sit amet dictum sit amet justo donec. Orci sagittis eu volutpat odio. Phasellus egestas tellus rutrum tellus pellentesque eu tincidunt tortor aliquam. Nulla facilisi morbi tempus iaculis. Nisl suscipit adipiscing bibendum est ultricies integer quis auctor. Ligula ullamcorper malesuada proin libero nunc consequat interdum varius sit. Dolor morbi non arcu risus quis varius quam quisque id. ** U4 :tagC: Facilisis mauris sit amet massa vitae tortor condimentum. Tempus quam pellentesque nec nam aliquam sem et. Urna nec tincidunt praesent semper. Quisque non tellus orci ac auctor augue mauris augue neque. Cursus risus at ultrices mi. Enim nec dui nunc mattis enim ut tellus. Dui accumsan sit amet nulla facilisi. Nunc sed id semper risus in hendrerit gravida. Ipsum consequat nisl vel pretium lectus quam. ** U5 :tagB:tagC: Massa eget egestas purus viverra accumsan in nisl nisi scelerisque. Id neque aliquam vestibulum morbi blandit. Ac ut consequat semper viverra. Facilisis sed odio morbi quis. Neque egestas congue quisque egestas diam in arcu cursus euismod. Quis viverra nibh cras pulvinar mattis nunc sed blandit libero. In hendrerit gravida rutrum quisque non tellus orci. Aliquam faucibus purus in massa tempor nec. Nunc lobortis mattis aliquam faucibus purus in massa tempor nec. </code></pre> <p>So, we can count tags in those replies. Happily someone already made that in <a href="https://emacs.stackexchange.com/questions/29127/make-statistics-of-the-tag-use-in-org-mode">https://emacs.stackexchange.com/questions/29127/make-statistics-of-the-tag-use-in-org-mode</a> but this solution only counts tags and what I&#39;d like is similar, but in 2 dimensions. That is, not only how many times does tagA exists, but how many times appears alone (tagA with tagA), how many with tagB, how many with tagC and so on.</p> <pre><code>#+tblname: tag-co-occurrence-count | | tagA | tagB | tagC | | TagA | 1 | 1 | 0 | | TagB | 1 | 0 | 2 | | TagC | 0 | 2 | 1 | </code></pre> <p>Of course, since we count co-occurrences without care for order, such a matrix is mirrored through the diagonal; both SW (bottom left) and NE (top right) halfs are identical (:tagB:tagC: are the same as :tagC:tagB:).</p> <p>Sadly, my areas of expertise are far from lisp coding, so I cannot do much more than include or adapt existing code with minimal change and so, I have to ask for your help. </p> <p>Closing it up: <em>how can we modify the linked code or create another new one, so as to generate a matrix with the list of tags as both dimensions (ordered by decreasing count) with the amount of co-occurrences in each cell</em>, like in the provided MVE?</p> <p>As always, thank you very much to you all for your time and sharing your knowledge... :D</p> <p>PD: I am finishing a block to visualize this data in gnuplot as a heat matrix and I&#39;ll share it promptly.</p> <p>PD2: as explained in <strong>Use org-mode links for absolutely anything</strong> (<a href="https://endlessparentheses.com/use-org-mode-links-for-absolutely-anything.html">https://endlessparentheses.com/use-org-mode-links-for-absolutely-anything.html</a>) I&#39;m sure once we have the matrix working, we can make a link on each tag in the matrix so as to make a sparse-tree search and show only those answers tagged with it.</p> </div><!-- SC_ON --> &#32; submitted by &#32; <a href="https://www.reddit.com/user/edumerco"> /u/edumerco </a> <br/> <span><a href="https://www.reddit.com/r/orgmode/comments/rpu1yy/how_to_count_tags_cooccurrences_in_a_buffer_and/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/orgmode/comments/rpu1yy/how_to_count_tags_cooccurrences_in_a_buffer_and/">[comments]</a></span>