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: CONTRIBUTING.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,12 @@
4
4
5
5
## Development environment
6
6
7
-
### poetry
7
+
### uv
8
8
9
-
`poetry` is used to manage python dependencies. See the docs on how to install python [https://python-poetry.org/](https://python-poetry.org/). To activate the poetry virtual environment run the following commands:
9
+
`uv` is used to manage python dependencies. Run the following to install `uv`:
10
10
11
11
```bash
12
-
poetry install
13
-
poetry shell
12
+
curl -LsSf https://astral.sh/uv/install.sh | sh
14
13
```
15
14
16
15
### just
@@ -19,24 +18,26 @@ poetry shell
19
18
20
19
## Code formatting
21
20
22
-
Please use the [black](https://black.readthedocs.io/en/stable/) for formatting code before submitting a PR.
23
-
24
21
```bash
25
-
black spacytextblob
22
+
just format
26
23
```
27
24
28
25
## Testing
29
26
30
27
Please validate that all tests pass before submitting a PR by running:
31
28
32
29
```bash
33
-
pytest
30
+
# Test against the latest supported version of Python
31
+
just test
32
+
33
+
# Tet against all supported versions of Python
34
+
just test-matrix
34
35
```
35
36
36
37
## Docs
37
38
38
39
To build the docs and visually inspect the docs please run:
Copy file name to clipboardExpand all lines: docs/api.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,6 @@ When adding *spacytextblob* to your spaCy pipeline you can optionally pass addit
34
34
35
35
| Name | Type | Description |
36
36
|------|------|-------------|
37
-
|`blob_only`|`bool`| If True, *spacytextblob* will only expose `._.blob` and not attempt to expose `._.polarity`, `._.subjectivity`, or `._.assessments`. This should always be set to True when using TextBlob extensions. By default `False`. |
38
37
|`custom_blob`|`Dict[str, str]`| The `"custom_blob"` key should be assigned to a dictionary that tells spaCy what function to replace `textblob.TextBlob` with. In this case, we want to replace it with `TextBlobDE`. The key of the dictionary is `"@misc"`. This tells spaCy to look into the misc section of the spaCy register. The value should be the string name of a function that you have registered with spaCy. See the [TextBlob extensions](tutorial/textblob_extensions.md) section for more details. |
39
38
40
39
@@ -45,7 +44,6 @@ from spacytextblob.spacytextblob import SpacyTextBlob
45
44
nlp = spacy.load("de_core_news_sm")
46
45
47
46
nlp.add_pipe( "spacytextblob", config={
48
-
"blob_only": ..., # bool
49
47
"custom_blob": ...# Dict[str, str]
50
48
})
51
49
```
@@ -61,5 +59,5 @@ Using *spacytextblob* without an extension:
Copy file name to clipboardExpand all lines: docs/changelog.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,17 @@
1
1
# Changelog
2
2
3
+
## 5.0.0 (2024-10-12)
4
+
5
+
**Breaking changes**
6
+
7
+
- Update supported Python versions from 3.9 to 3.12.
8
+
- Removed support for the `textblob-de` extension. See [#25](https://github.com/SamEdwardes/spacytextblob/issues/25) for more details.
9
+
- Removed support for accessing `._.polarity`, `._.sentiment`, `._.subjectivity`, and `._.assessments`. Now, only the `._.blob` attribute is exposed. All other textblob attributes should be access through it. For example: `._.blob.polarity`, `._.blob.sentiment`, `._.blob.subjectivity`, and `._.blob.sentiment_assessments.assessments`. This simplifies the code base and makes it easier to maintain. Lastly, this means that the config option `{"blob_only": bool}` was removed.
10
+
11
+
**Other changes**
12
+
13
+
- Use `uv` instead of `poetry`.
14
+
3
15
## 4.0.0 (2022-02-19)
4
16
5
17
- New custom attribute `doc._.blob`, `span._.blob`, `token._.blob`.
# [Sentence("Heute ist der 3. Mai 2014 und Dr. Meier feiert seinen 43. Geburtstag."), Sentence("Ich muss unbedingt daran denken, Mehl, usw. für einen Kuchen einzukaufen."), Sentence("Aber leider habe ich nur noch EUR 3.50 in meiner Brieftasche.")]
2. For a function to be used inside the NLP pipeline you must register the function with spacy using `@spacy.registry.misc()`. You can name the function what ever you like. For the example I have registered the function with the name `"spacytextblob.de_blob"`.
49
-
3.*spacytextblob* is able to support TextBlob extensions by replacing the default `textblob.TextBlob` with an alternative. In the case of the [textblob-de](https://github.com/markuskiller/textblob-de) extension they provide an alternative blob that you can import (`from textblob_de import TextBlobDE`).
42
+
2. For a function to be used inside the NLP pipeline you must register the function with spacy using `@spacy.registry.misc()`. You can name the function what ever you like. For the example I have registered the function with the name `"spacytextblob.fr_blob"`.
43
+
3.*spacytextblob* is able to support TextBlob extensions by replacing the default `textblob.TextBlob` with an alternative.
50
44
4. Add *spacytextblob* to your spaCy pipeline as you normally would.
51
45
5. The `config` parameter allows you to pass additional configuration options to the *spacytextblob* pipeline.
52
-
6. When using a TextBlob extension you should always set `"blob_only": True`. The extension may modify the textblob.TextBlob object. By setting `"blob_only": True`*spacytextblob* will only expose `._.blob` and not attempt to expose `._.polarity`, `._.subjectivity`, or `._.assessments`.
53
-
7. The `"custom_blob"` key should be assigned to a dictionary that tells spaCy what function to replace `textblob.TextBlob` with. In this case, we want to replace it with `TextBlobDE`. The key of the dictionary is `"@misc"`. This tells spaCy to look into the misc section of the spaCy register. The value should be the string name of the function that we registered above in line 12.
46
+
6. The `"custom_blob"` key should be assigned to a dictionary that tells spaCy what function to replace `textblob.TextBlob` with. In this case, we want to replace it with `TextBlobDE`. The key of the dictionary is `"@misc"`. This tells spaCy to look into the misc section of the spaCy register. The value should be the string name of the function that we registered above in line 12.
54
47
55
48
## Extensions
56
49
57
50
The following extensions have been tested and are supported. Other extensions may work, but have not been tested.
58
51
59
-
### textblob-de
60
-
61
-
textblob-de is a TextBlob extensions that enables German language support for TextBlob by Steven Loria ([https://github.com/markuskiller/textblob-de](https://github.com/markuskiller/textblob-de)).
62
-
63
-
```bash
64
-
pip install textblob-de
65
-
```
66
-
67
-
To use it with *spacytextblob* First install a spaCy model that supports German ([https://spacy.io/models/de](https://spacy.io/models/de)):
68
-
69
-
```bash
70
-
python -m spacy download de_core_news_sm
71
-
```
72
-
73
-
The code below demonstrates how you can then use and access textblob-de within *spacytextblob*.
textblob-fr is a TextBlob extension that enables French language support for TextBlob ([https://github.com/sloria/textblob-fr](https://github.com/sloria/textblob-fr)).
54
+
textblob-fr is a TextBlob extension that enables French language support for TextBlob ([https://github.com/sloria/textblob-fr](https://github.com/sloria/textblob-fr)).
82
55
83
56
```bash
84
57
pip install textblob-fr
@@ -96,9 +69,14 @@ The code below demonstrates how you can then use and access textblob-fr within *
textblob-de is **not** supported. As of spacytextblob 4.1.0. The textblob-de library depends on a Google Translate feature that no longer works. More details can be found in this issue [https://github.com/markuskiller/textblob-de/issues/24](https://github.com/markuskiller/textblob-de/issues/24).
77
+
99
78
### textblob-aptagger
100
79
101
80
!!! warning
102
81
103
82
textblob-aptagger is **not** supported. As of TextBlob 0.11.0, TextBlob uses NLTK's averaged perceptron tagger by default. This package is no longer necessary ([https://github.com/sloria/textblob-aptagger](https://github.com/sloria/textblob-aptagger)).
0 commit comments