Skip to content

Commit 5e9c243

Browse files
authored
Updated: README with POSNoise details and examples
Added POSNoise section with images and installation instructions.
1 parent 2e62699 commit 5e9c243

1 file changed

Lines changed: 43 additions & 13 deletions

File tree

README.md

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,31 @@ Consider for example the following scenario: *D1* and *D2* represent two documen
1111

1212
To prevent AA and AV methods from focusing on the topic and instead force them to concentrate on linguistic patterns such as function words or punctuation marks (which are closely related to writing style), topic masking approaches can be used, where POSNoise is one such approach...
1313

14+
## POSNoise in a Nutshell
15+
<div style="text-align: center;">
16+
<img
17+
src="https://github.com/user-attachments/assets/bc1e66e8-96ab-4e06-bf5c-76fd6486e864"
18+
alt="POSNoise in a nutshell..."
19+
style="width: 80%; height: auto;"
20+
/>
21+
</div>
22+
<br><br>
23+
<div style="text-align: center;">
24+
<img
25+
src="https://github.com/user-attachments/assets/4486b8c8-cecc-4dec-ab22-52d4200aafb9"
26+
alt="The L_TA pattern list..."
27+
style="width: 75%; height: auto;"
28+
/>
29+
</div>
30+
<br><br>
31+
<div style="text-align: center;">
32+
<img
33+
src="https://github.com/user-attachments/assets/936d7dcf-85c6-40e0-a307-a2515c496ea5"
34+
alt="The placeholder POStag list..."
35+
style="width: 50%; height: auto;"
36+
/>
37+
</div>
38+
1439

1540
## Installation
1641
The easiest way to install POSNoise is to use pip, where you can choose between (1) the PyPI repository and (2) this repository.
@@ -24,23 +49,27 @@ The latter will pull and install the latest commit from this repository as well
2449

2550
## Quickstart
2651
```python
52+
import posnoise
2753
from posnoise import POSNoise
54+
from posnoise.core import SpacyLanguage, SpacyModelSize
55+
56+
# English
57+
posnoise_en = POSNoise() # Note, by default POSNoise loads the "Large" spaCy model
2858

29-
# By default POSNoise loads the "Large" spaCy model
30-
posnoise_instance = POSNoise()
31-
32-
# In case you want specify another model, just set it accordingly e.g.
33-
# posnoise_instance = POSNoise(spacy_model_size=posnoise.core.SpacyModelSize.Medium)
59+
# In case you want specify another model size, just set it accordingly e.g.
60+
# posnoise_en = POSNoise(spacy_model_size=posnoise.core.SpacyModelSize.Medium)
3461

35-
document = "Fitzgerald made her first tour of Australia in July 1954 for the Australian-based American promoter Lee Gordon."
36-
posnoised_doc = posnoise_instance.pos_noise(document)
62+
# German
63+
posnoise_de = POSNoise(language=SpacyLanguage.German)
3764

38-
print(document)
39-
# Fitzgerald made her first tour of Australia in July 1954 for the Australian-based American promoter Lee Gordon.
65+
text_en = "The original dataset contains two partitions comprising sockpuppets and non-sockpuppets cases."
66+
text_de = "Schöneberg ist ein Ortsteil im Berliner Bezirk Tempelhof-Schöneberg."
4067

41-
print(posnoised_doc)
42-
# § made her first # of § in § µ for the §-Ø @ # § §.
68+
print(posnoise_en.pos_noise(text_en))
69+
# The @ # Ø two # Ø # and @@@ #.
4370

71+
print(posnoise_de.pos_noise(text_de))
72+
# § ist ein # im @ # §.
4473
```
4574

4675
All part-of-speech (POS) placeholders used in POSNoise to replace topic-related words or tokens are listed below:
@@ -61,7 +90,8 @@ _Source_: [POSNoise: An Effective Countermeasure Against Topic Biases in Authors
6190

6291
## Features
6392
- Effective way to mask topic-relatd content with **custom POS placeholders**
64-
- **Automatic NLP pipeline creation** (loads and installs the spaCy models on demand, while providing feedback)
93+
- **Multilingual support** (currently available in English and German)
94+
- **Automatic NLP pipeline creation** (loads and installs the spaCy models on demand, while providing installation feedback)
6595
- **No API dependency** (after downloading the spaCy models, POSNoise can be used completely **offline**)
6696
- **Documented** source code
6797

@@ -89,4 +119,4 @@ The POSNoise package is released under the Apache-2.0 license. See <a href="http
89119

90120

91121
## Last Remarks
92-
As is usual with open source projects, we developers do not earn any money with what we do, but are primarily interested in giving something back to the community with fun, passion and joy. Nevertheless, we would be very happy if you rewarded all the time that has gone into the project with just a small star 🤗
122+
As is usual with open source projects, we developers do not earn any money with what we do, but are primarily interested in giving something back to the community with fun, passion and joy. Nevertheless, we would be very happy if you rewarded all the time that has gone into the project with just a small star 🤗

0 commit comments

Comments
 (0)