Skip to content

Commit 040bfc2

Browse files
committed
update liwc docs
1 parent 48925b9 commit 040bfc2

File tree

13 files changed

+157
-59
lines changed

13 files changed

+157
-59
lines changed
2.09 KB
Binary file not shown.
4.62 KB
Binary file not shown.
Binary file not shown.
12.9 KB
Binary file not shown.

docs/build/html/feature_builder.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
<li class="toctree-l3"><a class="reference internal" href="#feature_builder.FeatureBuilder.conv_level_features"><code class="docutils literal notranslate"><span class="pre">FeatureBuilder.conv_level_features()</span></code></a></li>
5858
<li class="toctree-l3"><a class="reference internal" href="#feature_builder.FeatureBuilder.featurize"><code class="docutils literal notranslate"><span class="pre">FeatureBuilder.featurize()</span></code></a></li>
5959
<li class="toctree-l3"><a class="reference internal" href="#feature_builder.FeatureBuilder.get_first_pct_of_chat"><code class="docutils literal notranslate"><span class="pre">FeatureBuilder.get_first_pct_of_chat()</span></code></a></li>
60+
<li class="toctree-l3"><a class="reference internal" href="#feature_builder.FeatureBuilder.load_custem_liwc_dict"><code class="docutils literal notranslate"><span class="pre">FeatureBuilder.load_custem_liwc_dict()</span></code></a></li>
6061
<li class="toctree-l3"><a class="reference internal" href="#feature_builder.FeatureBuilder.merge_conv_data_with_original"><code class="docutils literal notranslate"><span class="pre">FeatureBuilder.merge_conv_data_with_original()</span></code></a></li>
6162
<li class="toctree-l3"><a class="reference internal" href="#feature_builder.FeatureBuilder.preprocess_chat_data"><code class="docutils literal notranslate"><span class="pre">FeatureBuilder.preprocess_chat_data()</span></code></a></li>
6263
<li class="toctree-l3"><a class="reference internal" href="#feature_builder.FeatureBuilder.save_features"><code class="docutils literal notranslate"><span class="pre">FeatureBuilder.save_features()</span></code></a></li>
@@ -242,6 +243,24 @@
242243
</dl>
243244
</dd></dl>
244245

246+
<dl class="py method">
247+
<dt class="sig sig-object py" id="feature_builder.FeatureBuilder.load_custem_liwc_dict">
248+
<span class="sig-name descname"><span class="pre">load_custem_liwc_dict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">custom_liwc_dictionary_path</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">dict</span></span></span><a class="headerlink" href="#feature_builder.FeatureBuilder.load_custem_liwc_dict" title="Link to this definition"></a></dt>
249+
<dd><p>Load the custom LIWC dictionary from the provided path.</p>
250+
<p>This function reads the custom LIWC dictionary from the provided path and returns the dictionary.</p>
251+
<dl class="field-list simple">
252+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
253+
<dd class="field-odd"><p><strong>custom_liwc_dictionary_path</strong> (<em>str</em>) – Path to the custom LIWC dictionary file</p>
254+
</dd>
255+
<dt class="field-even">Returns<span class="colon">:</span></dt>
256+
<dd class="field-even"><p>Custom LIWC dictionary</p>
257+
</dd>
258+
<dt class="field-odd">Return type<span class="colon">:</span></dt>
259+
<dd class="field-odd"><p>dict</p>
260+
</dd>
261+
</dl>
262+
</dd></dl>
263+
245264
<dl class="py method">
246265
<dt class="sig sig-object py" id="feature_builder.FeatureBuilder.merge_conv_data_with_original">
247266
<span class="sig-name descname"><span class="pre">merge_conv_data_with_original</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#feature_builder.FeatureBuilder.merge_conv_data_with_original" title="Link to this definition"></a></dt>

docs/build/html/genindex.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,10 +638,12 @@ <h2 id="L">L</h2>
638638
</li>
639639
<li><a href="features/lexical_features_v2.html#features.lexical_features_v2.liwc_features">liwc_features() (in module features.lexical_features_v2)</a>
640640
</li>
641-
<li><a href="utils/check_embeddings.html#utils.check_embeddings.load_liwc_dict">load_liwc_dict() (in module utils.check_embeddings)</a>
641+
<li><a href="feature_builder.html#feature_builder.FeatureBuilder.load_custem_liwc_dict">load_custem_liwc_dict() (feature_builder.FeatureBuilder method)</a>
642642
</li>
643643
</ul></td>
644644
<td style="width: 33%; vertical-align: top;"><ul>
645+
<li><a href="utils/check_embeddings.html#utils.check_embeddings.load_liwc_dict">load_liwc_dict() (in module utils.check_embeddings)</a>
646+
</li>
645647
<li><a href="features/politeness_v2_helper.html#features.politeness_v2_helper.load_saved_data">load_saved_data() (in module features.politeness_v2_helper)</a>
646648
</li>
647649
<li><a href="features/politeness_v2_helper.html#features.politeness_v2_helper.load_to_dict">load_to_dict() (in module features.politeness_v2_helper)</a>
@@ -801,11 +803,13 @@ <h2 id="R">R</h2>
801803
<td style="width: 33%; vertical-align: top;"><ul>
802804
<li><a href="utils/check_embeddings.html#utils.check_embeddings.read_in_lexicons">read_in_lexicons() (in module utils.check_embeddings)</a>
803805
</li>
804-
</ul></td>
805-
<td style="width: 33%; vertical-align: top;"><ul>
806806
<li><a href="utils/assign_chunk_nums.html#utils.assign_chunk_nums.reduce_chunks">reduce_chunks() (in module utils.assign_chunk_nums)</a>
807807
</li>
808+
</ul></td>
809+
<td style="width: 33%; vertical-align: top;"><ul>
808810
<li><a href="features/get_user_network.html#features.get_user_network.remove_active_user">remove_active_user() (in module features.get_user_network)</a>
811+
</li>
812+
<li><a href="utils/preprocess.html#utils.preprocess.remove_unhashable_cols">remove_unhashable_cols() (in module utils.preprocess)</a>
809813
</li>
810814
</ul></td>
811815
</tr></table>
@@ -824,6 +828,8 @@ <h2 id="S">S</h2>
824828
<li><a href="features/politeness_v2_helper.html#features.politeness_v2_helper.sentenciser">sentenciser() (in module features.politeness_v2_helper)</a>
825829
</li>
826830
<li><a href="feature_builder.html#feature_builder.FeatureBuilder.set_self_conv_data">set_self_conv_data() (feature_builder.FeatureBuilder method)</a>
831+
</li>
832+
<li><a href="utils/check_embeddings.html#utils.check_embeddings.sort_words">sort_words() (in module utils.check_embeddings)</a>
827833
</li>
828834
<li><a href="utils/check_embeddings.html#utils.check_embeddings.str_to_vec">str_to_vec() (in module utils.check_embeddings)</a>
829835
</li>

docs/build/html/objects.inv

31 Bytes
Binary file not shown.

docs/build/html/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/build/html/utils/check_embeddings.html

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
<li class="toctree-l4"><a class="reference internal" href="#utils.check_embeddings.is_valid_term"><code class="docutils literal notranslate"><span class="pre">is_valid_term()</span></code></a></li>
7272
<li class="toctree-l4"><a class="reference internal" href="#utils.check_embeddings.load_liwc_dict"><code class="docutils literal notranslate"><span class="pre">load_liwc_dict()</span></code></a></li>
7373
<li class="toctree-l4"><a class="reference internal" href="#utils.check_embeddings.read_in_lexicons"><code class="docutils literal notranslate"><span class="pre">read_in_lexicons()</span></code></a></li>
74+
<li class="toctree-l4"><a class="reference internal" href="#utils.check_embeddings.sort_words"><code class="docutils literal notranslate"><span class="pre">sort_words()</span></code></a></li>
7475
<li class="toctree-l4"><a class="reference internal" href="#utils.check_embeddings.str_to_vec"><code class="docutils literal notranslate"><span class="pre">str_to_vec()</span></code></a></li>
7576
</ul>
7677
</li>
@@ -275,24 +276,24 @@
275276

276277
<dl class="py function">
277278
<dt class="sig sig-object py" id="utils.check_embeddings.is_valid_term">
278-
<span class="sig-prename descclassname"><span class="pre">utils.check_embeddings.</span></span><span class="sig-name descname"><span class="pre">is_valid_term</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dicTerm</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#utils.check_embeddings.is_valid_term" title="Link to this definition"></a></dt>
279+
<span class="sig-prename descclassname"><span class="pre">utils.check_embeddings.</span></span><span class="sig-name descname"><span class="pre">is_valid_term</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dicTerm</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="headerlink" href="#utils.check_embeddings.is_valid_term" title="Link to this definition"></a></dt>
279280
<dd><p>Check if a dictionary term is valid.</p>
280-
<p>This function returns <cite>True</cite> if the term matches the regex pattern and <cite>False</cite> otherwise.
281-
The regex pattern matches:</p>
281+
<p>This function returns True if the term matches the regex pattern and False otherwise.
282+
The pattern matches the following criteria:</p>
282283
<ul class="simple">
283-
<li><p>Alphanumeric characters (a-z, A-Z, 0-9)</p></li>
284-
<li><p>Valid symbols: <cite>-</cite>, <cite></cite>, <cite>*</cite>, <cite>/</cite></p></li>
285-
<li><p>The <cite>*</cite> symbol can appear only once at the end of a word</p></li>
286-
<li><p>Emojis are valid only when they appear alone</p></li>
287-
<li><p>The <cite>/</cite> symbol can appear only once after alphanumeric characters</p></li>
284+
<li><p>Alphanumeric characters (a-zA-Z0-9)</p></li>
285+
<li><p>Valid symbols: -, ‘, *, /</p></li>
286+
<li><p>The * symbol can only appear once at the end of a word</p></li>
287+
<li><p>8 emojis are valid only when they appear alone</p></li>
288+
<li><p>The / symbol can only appear once after alphanumeric characters</p></li>
288289
<li><p>Spaces are allowed between valid words</p></li>
289290
</ul>
290291
<dl class="field-list simple">
291292
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
292-
<dd class="field-odd"><p><strong>dicTerm</strong> (<em>str</em>) – The dictionary term to validate.</p>
293+
<dd class="field-odd"><p><strong>dicTerm</strong> (<em>str</em>) – The dictionary term</p>
293294
</dd>
294295
<dt class="field-even">Returns<span class="colon">:</span></dt>
295-
<dd class="field-even"><p><cite>True</cite> if the term is valid, <cite>False</cite> otherwise.</p>
296+
<dd class="field-even"><p>True if the term is valid, False otherwise</p>
296297
</dd>
297298
<dt class="field-odd">Return type<span class="colon">:</span></dt>
298299
<dd class="field-odd"><p>bool</p>
@@ -308,7 +309,18 @@
308309
<p>This functions reads the content of a LIWC dictionary file in the official format,
309310
and convert it to a dictionary with lexicon: regular expression format.
310311
We assume the dicText has two parts: the header, which maps numbers to “category names,”
311-
and the body, which maps words in the lexicon to different category numbers, separated by a ‘%’ sign.</p>
312+
and the body, which maps words in the lexicon to different category numbers, separated by ‘%’.
313+
Below is an example:
314+
‘’’
315+
%
316+
1 function
317+
2 pronoun
318+
3 ppron
319+
%
320+
again 1 2
321+
against 1 2 3
322+
‘’’
323+
Note that the elements in each line are separated by ‘ ‘.</p>
312324
<dl class="field-list simple">
313325
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
314326
<dd class="field-odd"><p><strong>dicText</strong> (<em>str</em>) – The content of a .dic file</p>
@@ -327,6 +339,25 @@
327339
<span class="sig-prename descclassname"><span class="pre">utils.check_embeddings.</span></span><span class="sig-name descname"><span class="pre">read_in_lexicons</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">directory</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lexicons_dict</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#utils.check_embeddings.read_in_lexicons" title="Link to this definition"></a></dt>
328340
<dd></dd></dl>
329341

342+
<dl class="py function">
343+
<dt class="sig sig-object py" id="utils.check_embeddings.sort_words">
344+
<span class="sig-prename descclassname"><span class="pre">utils.check_embeddings.</span></span><span class="sig-name descname"><span class="pre">sort_words</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lexicons</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#utils.check_embeddings.sort_words" title="Link to this definition"></a></dt>
345+
<dd><p>Sorts the dictionary terms in a list.</p>
346+
<p>This function sorts the dictionary terms in a list by their length in descending order.
347+
The hyphenated words are sorted first, followed by the non-hyphenated words.</p>
348+
<dl class="field-list simple">
349+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
350+
<dd class="field-odd"><p><strong>dicTerms</strong> (<em>list</em>) – List of dictionary terms</p>
351+
</dd>
352+
<dt class="field-even">Returns<span class="colon">:</span></dt>
353+
<dd class="field-even"><p>dicTerms</p>
354+
</dd>
355+
<dt class="field-odd">Return type<span class="colon">:</span></dt>
356+
<dd class="field-odd"><p>str</p>
357+
</dd>
358+
</dl>
359+
</dd></dl>
360+
330361
<dl class="py function">
331362
<dt class="sig sig-object py" id="utils.check_embeddings.str_to_vec">
332363
<span class="sig-prename descclassname"><span class="pre">utils.check_embeddings.</span></span><span class="sig-name descname"><span class="pre">str_to_vec</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">str_vec</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#utils.check_embeddings.str_to_vec" title="Link to this definition"></a></dt>

0 commit comments

Comments
 (0)