Skip to content

Commit 08392f5

Browse files
docs: fix tutorials in documentation to ensure that the site can build
Also remove umaintained docs (faq, news) and fix formatting in diverse sites
1 parent 8c36cd6 commit 08392f5

10 files changed

Lines changed: 276 additions & 202 deletions

File tree

docs/coherence.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The `coherence` components calculates the coherence of the document, based on
55
word embedding cosine similarity between sentences.
66

77
textdescriptives currently implements first-order and second-order coherence. The
8-
implementation follows e.g. [1] and [2]:
8+
implementation follows e.g. `[1] <https://doi.org/10.1038/npjschz.2015.30>_` and `[2] <https://doi.org/10.1016/j.schres.2022.07.002>_`:
99
* First-order coherence: The cosine similarity between consecutive sentences.
1010
* Second-order coherence: The cosine similarity between sentences that are two sentences apart.
1111

@@ -18,17 +18,13 @@ and `overwriting the vector attribute <https://spacy.io/usage/linguistic-feature
1818

1919
The following attributes are added to :code:`Doc` objects.:
2020

21-
* ._.first_order_coherence_values: A list of floats, where each float is the
21+
* :code:`._.first_order_coherence_values`: A list of floats, where each float is the
2222
cosine similarity between consecutive sentences.
23-
* ._.second_order_coherence_values: A list of floats, where each float is the
23+
* :code:`._.second_order_coherence_values`: A list of floats, where each float is the
2424
cosine similarity between sentences that are two sentences apart.
25-
* ._.cohererence: a dict containing the mean coherence values for first and
25+
* :code:`._.coherence`: a dict containing the mean coherence values for first and
2626
second order coherence (keys: "first_order_coherence", "second_order_coherence")
2727

28-
[1] Bedi, G., Carrillo, F., Cecchi, G. A., Slezak, D. F., Sigman, M., Mota, N. B., Ribeiro, S., Javitt, D. C., Copelli, M., & Corcoran, C. M. (2015). Automated analysis of free speech predicts psychosis onset in high-risk youths. Npj Schizophrenia, 1(1), Article 1. https://doi.org/10.1038/npjschz.2015.30
29-
30-
[2] Parola, A., Lin, J. M., Simonsen, A., Bliksted, V., Zhou, Y., Wang, H., Inoue, L., Koelkebeck, K., & Fusaroli, R. (2022). Speech disturbances in schizophrenia: Assessing cross-linguistic generalizability of NLP automated measures of coherence. Schizophrenia Research. https://doi.org/10.1016/j.schres.2022.07.002
31-
3228

3329
Usage
3430
~~~~~~
@@ -66,3 +62,8 @@ Component
6662
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6763

6864
.. autofunction:: textdescriptives.components.coherence.create_coherence_component
65+
66+
67+
[1] Bedi, G., Carrillo, F., Cecchi, G. A., Slezak, D. F., Sigman, M., Mota, N. B., Ribeiro, S., Javitt, D. C., Copelli, M., & Corcoran, C. M. (2015). Automated analysis of free speech predicts psychosis onset in high-risk youths. Npj Schizophrenia, 1(1), Article 1. https://doi.org/10.1038/npjschz.2015.30
68+
69+
[2] Parola, A., Lin, J. M., Simonsen, A., Bliksted, V., Zhou, Y., Wang, H., Inoue, L., Koelkebeck, K., & Fusaroli, R. (2022). Speech disturbances in schizophrenia: Assessing cross-linguistic generalizability of NLP automated measures of coherence. Schizophrenia Research. https://doi.org/10.1016/j.schres.2022.07.002

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@
5959
# -- Options for myst-nb -----------------------------------------------------
6060

6161
# set the timeout for executing notebooks
62-
# nb_execution_timeout = 600 # in seconds, default 30 seconds
63-
nb_execution_timeout = 600 # in seconds, default 30 seconds. 600 seconds = 10 minutes
62+
# nb_execution_timeout = 600 # in seconds, default 30 seconds. 600 seconds = 10 minutes
6463

6564
# always fail CI pipeline when nb cannot be executed
66-
nb_execution_raise_on_error = True
65+
# nb_execution_raise_on_error = True
66+
nb_execution_mode = "off" # for now we will not execute the notebooks during doc build
6767

6868

6969
# -- Options for HTML output -------------------------------------------------

docs/faq.rst

Lines changed: 0 additions & 61 deletions
This file was deleted.

docs/information_theory.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ Information Theory
44
The `information_theory` component calculates information theoretic measures derived
55
from the text. These include:
66

7-
- `{doc/span}._.entropy`: the Shannon entropy of the text using the `token.prob` as the probability
7+
8+
- :code:`{doc/span}._.entropy`: the Shannon entropy of the text using the `token.prob` as the probability
89
of each token. Entropy is defined as :math:`H(X) = -\sum_{i=1}^n p(x_i) \log_e p(x_i)`. Where :math:`p(x_i)` is the probability of the token :math:`x_i`.
9-
- `{doc/span}._.perplexity`: the perplexity of the text. Perplexity is a measurement of how well a
10+
- :code:`{doc/span}._.perplexity`: the perplexity of the text. Perplexity is a measurement of how well a
1011
probability distribution or probability model predicts a sample. Perplexity is defined as :math:`PPL(X) = e^{-H(X)}`, where :math:`H(X)` is the entropy of the text.
11-
- `{doc/span}._.per_word_perplexity`: The perplexity of the text, divided by the number of words. Can be considered the length-normalized perplexity.
12+
- :code:`{doc/span}._.per_word_perplexity`: The perplexity of the text, divided by the number of words. Can be considered the length-normalized perplexity.
1213

1314
These information theoretic measures are for example often used to describe the complexity of a text.
1415
The higher the entropy, the more complex the text is.

docs/news.rst

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/readability.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,49 @@ The *readability* component adds the following readabiltiy metrics under the :co
99

1010

1111

12-
* **`Gunning-Fog <https://en.wikipedia.org/wiki/Gunning_fog_index>`__**, is a readability index originally developed for English writing, but works for any language. The index estimates the years of formal education needed to understand the text on a first reading. A Gunning-Fog index of 12 requires the reading level of a U.S. high school senior (around 18 years old). The formula for calculating the index is:
12+
* `Gunning-Fog <https://en.wikipedia.org/wiki/Gunning_fog_index>`__, is a readability index originally developed for English writing, but works for any language. The index estimates the years of formal education needed to understand the text on a first reading. A Gunning-Fog index of 12 requires the reading level of a U.S. high school senior (around 18 years old). The formula for calculating the index is:
1313

1414
*Grade level = 0.4 × (ASL + PHW)*
1515

1616
Where *ASL* is the average sentence length (total words / total sentences), and *PHW* is the percentage of hard words (words with three or more syllables).
1717

1818
Note: requires hyphenation.
1919

20-
* **`SMOG <https://en.wikipedia.org/wiki/SMOG>`__**, or Simple Measure of Gobbledygook, is a readability formula that estimates the years of education required to understand a piece of writing. It primarily focuses on the complexity of words, using the number of polysyllabic words in the text. The formula is:
20+
* `SMOG <https://en.wikipedia.org/wiki/SMOG>`__, or Simple Measure of Gobbledygook, is a readability formula that estimates the years of education required to understand a piece of writing. It primarily focuses on the complexity of words, using the number of polysyllabic words in the text. The formula is:
2121

2222
*SMOG Index = 1.043 × √(30 × (hard words / n_sentences)) + 3.1291*
2323

2424
Note: requires hyphenation.
2525

26-
* **`Flesch reading ease <https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests#Flesch_reading_ease>`__**, is a readability score that indicates how easy a text is to read. Higher scores indicate easier reading, while lower scores indicate more difficult reading. The score is calculated using the following formula:
26+
* `Flesch reading ease <https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests#Flesch_reading_ease>`__, is a readability score that indicates how easy a text is to read. Higher scores indicate easier reading, while lower scores indicate more difficult reading. The score is calculated using the following formula:
2727

2828
*Flesch Reading Ease = 206.835 - (1.015 × ASL) - (84.6 × ASW)*
2929

3030
Where *ASL* is the average sentence length and *ASW* is the average number of syllables per word.
3131

3232
Note: requires hyphenation.
3333

34-
* **`Flesch-Kincaid grade <https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests#Flesch%E2%80%93Kincaid_grade_level>`__**, is a readability metric that estimates the grade level needed to comprehend a text. It is based on the average sentence length and average number of syllables per word. The formula is:
34+
* `Flesch-Kincaid grade <https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests#Flesch%E2%80%93Kincaid_grade_level>`__, is a readability metric that estimates the grade level needed to comprehend a text. It is based on the average sentence length and average number of syllables per word. The formula is:
3535

3636
*Flesch-Kincaid Grade = 0.39 × (ASL) + 11.8 × (ASW) - 15.59*
3737

3838
Note: requires hyphenation.
3939

40-
* **`Automated readability index <https://en.wikipedia.org/wiki/Automated_readability_index>`__**, is a readability test that calculates an approximate U.S. grade level needed to understand a text. It is based on the average number of characters per word and the average sentence length. The formula is:
40+
* `Automated readability index <https://en.wikipedia.org/wiki/Automated_readability_index>`__, is a readability test that calculates an approximate U.S. grade level needed to understand a text. It is based on the average number of characters per word and the average sentence length. The formula is:
4141

4242
*ARI = 4.71 × (n_chars / n_words) + 0.5 × (n_words / n_sentences) - 21.43*
4343

44-
* **`Coleman-Liau index <https://en.wikipedia.org/wiki/Coleman%E2%80%93Liau_index>`___**, is a readability test that estimates the U.S. grade level needed to understand a text. It is based on the average number of letters per 100 words and the average number of sentences per 100 words. The original formula is:
44+
* `Coleman-Liau index <https://en.wikipedia.org/wiki/Coleman%E2%80%93Liau_index>`___, is a readability test that estimates the U.S. grade level needed to understand a text. It is based on the average number of letters per 100 words and the average number of sentences per 100 words. The original formula is:
4545

4646
*CLI = 0.0588 × L - 0.296 × S - 15.8*
4747

4848
Where *L* is the average number of characters per 100 words and *S* is the average number of sentences per 100 words. In our implementation we average over the entire text instead of just 100 words.
4949

50-
* **`Lix <https://en.wikipedia.org/wiki/Lix_(readability_test)>`__**, or Lesbarhetsindex, is a readability measure that calculates a readability score based on the average sentence length and the percentage of long words (more than six characters) in the text. The formula is:
50+
* `Lix <https://en.wikipedia.org/wiki/Lix_(readability_test)>`__, or Lesbarhetsindex, is a readability measure that calculates a readability score based on the average sentence length and the percentage of long words (more than six characters) in the text. The formula is:
5151

5252
*Lix = (n_words / n_sentences) + (n_long_words * 100) / n_words*
5353

54-
* **`Rix <https://www.jstor.org/stable/40031755>`__**, is a readability measure that estimates the difficulty of a text based on the proportion of long words (more than six characters) in the text. The formula is:
54+
* `Rix <https://www.jstor.org/stable/40031755>`__, is a readability measure that estimates the difficulty of a text based on the proportion of long words (more than six characters) in the text. The formula is:
5555

5656
*Rix = (n_long_words / n_sentences)*
5757

0 commit comments

Comments
 (0)