<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: yosleycarrero2025</title>
    <description>The latest articles on DEV Community by yosleycarrero2025 (@yosleycarrero2025).</description>
    <link>https://dev.to/yosleycarrero2025</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4098009%2Fa6ff816b-2201-43bb-9ede-426f6642786f.png</url>
      <title>DEV Community: yosleycarrero2025</title>
      <link>https://dev.to/yosleycarrero2025</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yosleycarrero2025"/>
    <language>en</language>
    <item>
      <title>Detecting Word Attraction and Repulsion in Text with wordorientation</title>
      <dc:creator>yosleycarrero2025</dc:creator>
      <pubDate>Thu, 27 Aug 2026 20:04:13 +0000</pubDate>
      <link>https://dev.to/yosleycarrero2025/detecting-word-attraction-and-repulsion-in-text-with-wordorientation-55ok</link>
      <guid>https://dev.to/yosleycarrero2025/detecting-word-attraction-and-repulsion-in-text-with-wordorientation-55ok</guid>
      <description>&lt;p&gt;&lt;code&gt;wordorientation&lt;/code&gt; is an R package that measures how strongly pairs of words attract or repel each other in a text corpus.&lt;/p&gt;

&lt;p&gt;For every pair of words, it computes the phi coefficient (a correlation measure for co-occurrence data), tests it for statistical significance, and classifies the pair as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;attraction&lt;/strong&gt; — the words co-occur more often than chance would predict&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;repulsion&lt;/strong&gt; — the words co-occur less often than chance would predict&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;neutral&lt;/strong&gt; — no significant relationship&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Unlike general-purpose correlation tools, it's built specifically for text: it handles tokenization and stopword removal automatically, applies proper significance testing rather than just reporting a raw correlation, and produces a ready-to-plot attraction/repulsion network.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="n"&gt;install.packages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"wordorientation"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Basic usage
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight r"&gt;&lt;code&gt;&lt;span class="n"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wordorientation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;analyze_word_orientation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;my_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;text_col&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;doc_col&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;min_count&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;scored&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;plot_orientation_network&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;scored&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each row of your data is treated as one "document" — the unit within which two words are said to co-occur.&lt;/p&gt;

&lt;p&gt;One thing worth knowing: the package needs a large corpus (survey responses, social media posts, reviews, or similar) to have enough statistical power to find real patterns. On a single short text, it will correctly report few or no significant pairs rather than manufacturing noise into a misleading result.&lt;/p&gt;

&lt;p&gt;Full source and documentation: &lt;a href="https://github.com/yosleycarrero2025/wordorientation" rel="noopener noreferrer"&gt;https://github.com/yosleycarrero2025/wordorientation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feedback and issues welcome!&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>nlp</category>
      <category>software</category>
    </item>
  </channel>
</rss>
