You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/coherence.rst
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ The `coherence` components calculates the coherence of the document, based on
5
5
word embedding cosine similarity between sentences.
6
6
7
7
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>_`:
9
9
* First-order coherence: The cosine similarity between consecutive sentences.
10
10
* Second-order coherence: The cosine similarity between sentences that are two sentences apart.
11
11
@@ -18,17 +18,13 @@ and `overwriting the vector attribute <https://spacy.io/usage/linguistic-feature
18
18
19
19
The following attributes are added to :code:`Doc` objects.:
20
20
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
22
22
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
24
24
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
26
26
second order coherence (keys: "first_order_coherence", "second_order_coherence")
27
27
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
[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
Copy file name to clipboardExpand all lines: docs/information_theory.rst
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,12 @@ Information Theory
4
4
The `information_theory` component calculates information theoretic measures derived
5
5
from the text. These include:
6
6
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
8
9
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
10
11
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.
12
13
13
14
These information theoretic measures are for example often used to describe the complexity of a text.
14
15
The higher the entropy, the more complex the text is.
Copy file name to clipboardExpand all lines: docs/readability.rst
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,49 +9,49 @@ The *readability* component adds the following readabiltiy metrics under the :co
9
9
10
10
11
11
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:
13
13
14
14
*Grade level = 0.4 × (ASL + PHW)*
15
15
16
16
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).
17
17
18
18
Note: requires hyphenation.
19
19
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:
21
21
22
22
*SMOG Index = 1.043 × √(30 × (hard words / n_sentences)) + 3.1291*
23
23
24
24
Note: requires hyphenation.
25
25
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:
Where *ASL* is the average sentence length and *ASW* is the average number of syllables per word.
31
31
32
32
Note: requires hyphenation.
33
33
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:
* **`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:
* **`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:
45
45
46
46
*CLI = 0.0588 × L - 0.296 × S - 15.8*
47
47
48
48
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.
49
49
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:
* **`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:
0 commit comments