Skip to content

Commit 3f48688

Browse files
docs: Minor polished to the documentation
1 parent f218684 commit 3f48688

8 files changed

Lines changed: 49 additions & 38 deletions

File tree

docs/dependencydistance.rst

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
Dependency Distance
22
--------------------
33

4-
The *dependency_distance* component adds measures of depedency distance to both :code:`Doc`, :code:`Span`, and :code:`Token` objects under the ._.dependency_distance attribute.
5-
Dependency distance can be used a measure of syntactics complexity, the greater the distance, the more complex (`Liu 2008 <https://pdfs.semanticscholar.org/b6b9/cf00698a76d7a1e5ba58baa92d8799366813.pdf>`__, `Oya 2011 <http://www.paaljapan.org/conference2011/ProcNewest2011/pdf/poster/P-13.pdf>`__).
4+
The *dependency_distance* component adds measures of depedency distance to both :code:`Doc`, :code:`Span`, and :code:`Token` objects
5+
under the :code:`._.dependency_distance` attribute.
6+
Dependency distance can be used a measure of syntactics complexity, the greater the distance, the more complex
7+
(`Liu 2008 <https://pdfs.semanticscholar.org/b6b9/cf00698a76d7a1e5ba58baa92d8799366813.pdf>`__, `Oya 2011 <http://www.paaljapan.org/conference2011/ProcNewest2011/pdf/poster/P-13.pdf>`__).
68

7-
The implementation in textdescriptives follows Oya, 2011. We calculate the distances from each token to their dependent, and take the mean of this for calculating the mean dependency distance for spans. We then calculate the Doc level DD by averaging over the sentence-level mean DDs.
9+
The implementation in textdescriptives follows Oya, 2011. We calculate the distances
10+
from each token to their dependent, and take the mean of this for calculating the mean
11+
dependency distance for spans. We then calculate the Doc level dependency distance by
12+
averaging over the sentence-level mean dependency distances.
813

9-
Please see `this issue <https://github.com/HLasse/TextDescriptives/issues/77>`__ for how to calculate the DD metric proposed by Liu, 2008 with TextDescriptives.
14+
Please see `this issue <https://github.com/HLasse/TextDescriptives/issues/77>`__ for
15+
how to calculate the dependency distance metric proposed by Liu, 2008 with TextDescriptives.
1016

1117

12-
For :code:`Doc` objects, the mean and standard deviation of dependency distance on the sentence level is returned along with the mean and standard deviation of the proportion adjacent dependency relations on sentence level.
18+
For :code:`Doc` objects, the mean and standard deviation of dependency distance on the
19+
sentence level is returned along with the mean and standard deviation of the proportion
20+
adjacent dependency relations on sentence level.
1321

14-
For :code:`Span` objects, the mean dependency distance and the mean proportion adjacent dependency relations in the span are returned.
22+
For :code:`Span` objects, the mean dependency distance and the mean proportion adjacent
23+
dependency relations in the span are returned.
1524

16-
For :code:`Token` objects, the dependency distance and whether the dependency relation is an adjacent token is returned.
25+
For :code:`Token` objects, the dependency distance and whether the dependency relation
26+
is an adjacent token is returned.
1727

1828
Usage
1929
~~~~~~

docs/descriptivestats.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@ Descriptive Statistics
44
The *descriptive_stats* component extracts a number of descriptive statistics.
55
The following attributes are added:
66

7-
* ._.counts (:code:`Doc` & :code:`Span`)
8-
7+
* :code:`{Doc/Span}._.counts`
8+
99
* Number of tokens.
1010
* Number of unique tokens.
1111
* Proportion unique tokens.
1212
* Number of characters.
13-
* ._.sentence_length(:code:`Doc`)
13+
14+
* :code:`{Doc/Span}._.sentence_length`
1415

1516
* Mean sentence length.
1617
* Median sentence length.
1718
* Std of sentence length.
18-
* ._.syllables(:code:`Doc`)
19+
20+
* :code:`{Doc/Span}._.syllables`
1921

2022
* Mean number of syllables per token.
2123
* Median number of syllables per token.
2224
* Std of number of syllables per token.
23-
* ._.token_length(:code:`Doc` & :code:`Span`)
25+
26+
* :code:`{Doc/Span}._.token_length`
2427

2528
* Mean token length.
2629
* Median token length.

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ please use the discussion Forums.
5050

5151
.. toctree::
5252
:maxdepth: 2
53-
:caption: Package References
53+
:caption: Compoents
5454
:hidden:
5555

5656
descriptivestats

docs/installation.rst

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,15 @@ To get started using TextDescriptives you can install it using pip by running th
55
.. code-block::
66
77
pip install textdescriptives
8-
pip install "textdescriptives[style,tests,docs,tutorials]"
98
10-
Installing from source
9+
Development Installation
1110
^^^^^^^^^^^^^^^^^^^^^^^^^
1211

13-
You can also install TextDescriptives directly from source using:
12+
To install TextDescriptives for development, clone the repository and install the
13+
package using the following commands:
1414

1515
.. code-block::
1616
17-
git clone https://github.com/hlasse/textdescriptives.git
18-
cd TextDescriptives
19-
pip install .
17+
git clone https://github.com/hlasse/TextDescriptives
2018
21-
or
22-
23-
.. code-block::
24-
25-
pip install git+https://github.com/hlasse/textdescriptives
19+
pip install -e ".[style,tests,docs,tutorials]"

docs/news.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
News and Changelog
22
---------------------------------
33

4-
**v2.0.0 - X 2022**
5-
- All components have been renamed to have the :code:`textdescriptives/` prefix. I.e. components should now be loaded with e.g. :code:`nlp.add_pipe("textdescriptives/descriptive_stats)`.
6-
:code:`textdescriptives/all` can be used to load all components at once.
4+
**v2.0.0 - 1st of January 2023**
5+
6+
- All components have been renamed to have the :code:`textdescriptives/` prefix. I.e. components should now be loaded with e.g. :code:`nlp.add_pipe("textdescriptives/descriptive_stats)`. :code:`textdescriptives/all` can be used to load all components at once.
77
- :code:`pos_stats` has been renamed to :code:`pos_proportions` for consistency.
88

99
**v1.1.0 - 21st of September, 2022**
10+
1011
- Added the new pipe; "quality". This pipe implements a series of metrics related to text quality, some of which were used by Rae et al. (2021) and Raffel et al. (2020) to filter large text corpora. See the documentation for examples.
1112

1213
**v1.0.7 - 4th May, 2022**
14+
1315
- Some minor fixes and bells and whistles.
1416

1517
**v1.0.5 - 4th October, 2021**
16-
- POS proportions now use :code:`pos_` instead of :code:`tag_` by default. This behavior can be changed by setting `use_tag` to `False` when initialising the `pos_stats` module.
18+
19+
- POS proportions now use :code:`pos_` instead of :code:`tag_` by default. This behavior can be changed by setting `use_tag` to `False` when initialising the `pos_stats` module.

docs/posstats.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ Part-of-Speech Proportions
33

44
The *pos_stats* component adds one attribute to a Doc or Span:
55

6-
* ._.proportions (:code:`Doc`)
6+
* :code:`Doc._.pos_proportions`
77
* Dict of :code:`{pos_prop_POSTAG: proportion of all tokens tagged with POSTAG}`. Does not create a key if no tokens in the document fit the POSTAG.
88

9-
* ._.proportions (:code:`Span`)
9+
* :code:`Span._.pos_proportions`
10+
*
1011
* Dict of :code:`{pos_prop_POSTAG: proportion of all tokens tagged with POSTAG}`. Does not create a key if no tokens in the document fit the POSTAG.
1112

1213

docs/readability.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Readability
22
--------------------
33

4-
The *readability* component adds the following readabiltiy metrics under the ._.readability attribute to :code:`Doc` objects.
4+
The *readability* component adds the following readabiltiy metrics under the :code:`._.readability` attribute to :code:`Doc` objects.
55

66
* Gunning-Fog
77
* SMOG
@@ -12,7 +12,7 @@ The *readability* component adds the following readabiltiy metrics under the ._.
1212
* Lix
1313
* Rix
1414

15-
For specifics of the implementation, refer to the source. The equations are largely derived from the `textstat <https://github.com/shivam5992/textstat>`_ library.
15+
For specifics of the implementation, refer to the source.±
1616

1717
Usage
1818
~~~~~~

src/textdescriptives/components/quality.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -673,12 +673,12 @@ def create_quality_component(
673673
out low quality text from large text corpora.
674674
675675
References:
676-
[1] Rae, J. W., Borgeaud, S., Cai, T., Millican, K., Hoffmann, J., Song, F., ... &
677-
Irving, G. (2021). Scaling language models: Methods, analysis & insights from
678-
training gopher. arXiv preprint arXiv:2112.11446.
679-
[2] Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., ... &
680-
Liu, P. J. (2020). Exploring the limits of transfer learning with a unified
681-
text-to-text transformer. J. Mach. Learn. Res., 21(140), 1-67.
676+
- [1] Rae, J. W., Borgeaud, S., Cai, T., Millican, K., Hoffmann, J., Song, F., ... &
677+
Irving, G. (2021). Scaling language models: Methods, analysis & insights from
678+
training gopher. arXiv preprint arXiv:2112.11446.
679+
- [2] Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., ... &
680+
Liu, P. J. (2020). Exploring the limits of transfer learning with a unified
681+
text-to-text transformer. J. Mach. Learn. Res., 21(140), 1-67.
682682
683683
Args:
684684
nlp (Language): spaCy language object, does not need to be specified in the

0 commit comments

Comments
 (0)