Update README.md
Browse files
README.md
CHANGED
@@ -25,4 +25,23 @@ A reformatting of compatible triplets from https://huggingface.co/datasets/tolle
|
|
25 |
This includes all pairs that contain both a contradiction and an entailment.
|
26 |
In cases where a neutral also exists, this is a duplicated triplet, with the same contr./ent.
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
[More Information needed](https://github.com/huggingface/datasets/blob/main/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
|
|
25 |
This includes all pairs that contain both a contradiction and an entailment.
|
26 |
In cases where a neutral also exists, this is a duplicated triplet, with the same contr./ent.
|
27 |
|
28 |
+
Simple normalization of sentences:
|
29 |
+
```python
|
30 |
+
from neattext.functions import clean_text
|
31 |
+
import re
|
32 |
+
|
33 |
+
def symbol_cleaner(s):
|
34 |
+
s = re.sub(r"^[^\w\d]+", "", s)
|
35 |
+
s = re.sub(r"[^\w\d]+$", "", s)
|
36 |
+
return s
|
37 |
+
|
38 |
+
def filter_sent(sent):
|
39 |
+
sent = clean_text(sent, puncts=False, stopwords=False, non_ascii=False)
|
40 |
+
sent = symbol_cleaner(sent)
|
41 |
+
return sent
|
42 |
+
|
43 |
+
def filter_triplet(triplet):
|
44 |
+
return [filter_sent(sent) for sent in triplet]
|
45 |
+
```
|
46 |
+
|
47 |
[More Information needed](https://github.com/huggingface/datasets/blob/main/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|