use pie-modules instead of pytorch-ie
Browse filessee https://github.com/ArneBinder/pie-datasets/pull/204 for further information
- README.md +5 -5
- argmicro.py +7 -7
- requirements.txt +2 -1
README.md
CHANGED
|
@@ -7,7 +7,7 @@ This is a [PyTorch-IE](https://github.com/ChristophAlt/pytorch-ie) wrapper for t
|
|
| 7 |
|
| 8 |
```python
|
| 9 |
from pie_datasets import load_dataset
|
| 10 |
-
from
|
| 11 |
|
| 12 |
# load English variant
|
| 13 |
dataset = load_dataset("pie/argmicro", name="en")
|
|
@@ -57,13 +57,13 @@ and the following annotation layers:
|
|
| 57 |
- `tail` (tuple, annotation type: `LabeledAnnotationCollection`, target: `adus`)
|
| 58 |
- `label` (str, optional), values: `sup`, `exa`, `reb`, `und` (see [here](https://huggingface.co/datasets/DFKI-SLT/argmicro/blob/main/argmicro.py#L37) for reference, but note that helper relations `seg` and `add` are not there anymore, see above).
|
| 59 |
|
| 60 |
-
See [here](https://github.com/
|
| 61 |
|
| 62 |
## Document Converters
|
| 63 |
|
| 64 |
The dataset provides document converters for the following target document types:
|
| 65 |
|
| 66 |
-
- `
|
| 67 |
- `LabeledSpans`, converted from `ArgMicroDocument`'s `adus`
|
| 68 |
- labels: `opp`, `pro`
|
| 69 |
- if an ADU contains multiple spans (i.e. EDUs), we take the start of the first EDU and the end of the last EDU as the boundaries of the new `LabeledSpan`. We also raise exceptions if any newly created `LabeledSpan`s overlap.
|
|
@@ -72,7 +72,7 @@ The dataset provides document converters for the following target document types
|
|
| 72 |
- if the `head` or `tail` consists of multiple `adus`, then we build `BinaryRelation`s with all `head`-`tail` combinations and take the label from the original relation. Then, we build `BinaryRelations`' with label `joint` between each component that previously belongs to the same `head` or `tail`, respectively.
|
| 73 |
- `metadata`, we keep the `ArgMicroDocument`'s `metadata`, but `stance` and `topic_id`.
|
| 74 |
|
| 75 |
-
See [here](https://github.com/
|
| 76 |
definitions.
|
| 77 |
|
| 78 |
### Collected Statistics after Document Conversion
|
|
@@ -97,7 +97,7 @@ input:
|
|
| 97 |
name: en
|
| 98 |
```
|
| 99 |
|
| 100 |
-
For token based metrics, this uses `bert-base-uncased` from `transformer.AutoTokenizer` (see [AutoTokenizer](https://huggingface.co/docs/transformers/v4.37.1/en/model_doc/auto#transformers.AutoTokenizer), and [bert-based-uncased](https://huggingface.co/bert-base-uncased) to tokenize `text` in `TextDocumentWithLabeledSpansAndBinaryRelations` (see [document type](https://github.com/
|
| 101 |
|
| 102 |
#### Relation argument (outer) token distance per label
|
| 103 |
|
|
|
|
| 7 |
|
| 8 |
```python
|
| 9 |
from pie_datasets import load_dataset
|
| 10 |
+
from pie_modules.documents import TextDocumentWithLabeledSpansAndBinaryRelations
|
| 11 |
|
| 12 |
# load English variant
|
| 13 |
dataset = load_dataset("pie/argmicro", name="en")
|
|
|
|
| 57 |
- `tail` (tuple, annotation type: `LabeledAnnotationCollection`, target: `adus`)
|
| 58 |
- `label` (str, optional), values: `sup`, `exa`, `reb`, `und` (see [here](https://huggingface.co/datasets/DFKI-SLT/argmicro/blob/main/argmicro.py#L37) for reference, but note that helper relations `seg` and `add` are not there anymore, see above).
|
| 59 |
|
| 60 |
+
See [here](https://github.com/ArneBinder/pie-modules/blob/main/src/pie_modules/annotations.py) for the annotation type definitions.
|
| 61 |
|
| 62 |
## Document Converters
|
| 63 |
|
| 64 |
The dataset provides document converters for the following target document types:
|
| 65 |
|
| 66 |
+
- `pie_modules.documents.TextDocumentWithLabeledSpansAndBinaryRelations`
|
| 67 |
- `LabeledSpans`, converted from `ArgMicroDocument`'s `adus`
|
| 68 |
- labels: `opp`, `pro`
|
| 69 |
- if an ADU contains multiple spans (i.e. EDUs), we take the start of the first EDU and the end of the last EDU as the boundaries of the new `LabeledSpan`. We also raise exceptions if any newly created `LabeledSpan`s overlap.
|
|
|
|
| 72 |
- if the `head` or `tail` consists of multiple `adus`, then we build `BinaryRelation`s with all `head`-`tail` combinations and take the label from the original relation. Then, we build `BinaryRelations`' with label `joint` between each component that previously belongs to the same `head` or `tail`, respectively.
|
| 73 |
- `metadata`, we keep the `ArgMicroDocument`'s `metadata`, but `stance` and `topic_id`.
|
| 74 |
|
| 75 |
+
See [here](https://github.com/ArneBinder/pie-modules/blob/main/src/pie_modules/documents.py) for the document type
|
| 76 |
definitions.
|
| 77 |
|
| 78 |
### Collected Statistics after Document Conversion
|
|
|
|
| 97 |
name: en
|
| 98 |
```
|
| 99 |
|
| 100 |
+
For token based metrics, this uses `bert-base-uncased` from `transformer.AutoTokenizer` (see [AutoTokenizer](https://huggingface.co/docs/transformers/v4.37.1/en/model_doc/auto#transformers.AutoTokenizer), and [bert-based-uncased](https://huggingface.co/bert-base-uncased) to tokenize `text` in `TextDocumentWithLabeledSpansAndBinaryRelations` (see [document type](https://github.com/ArneBinder/pie-modules/blob/main/src/pie_modules/documents.py)).
|
| 101 |
|
| 102 |
#### Relation argument (outer) token distance per label
|
| 103 |
|
argmicro.py
CHANGED
|
@@ -6,9 +6,9 @@ from itertools import combinations
|
|
| 6 |
from typing import Any, Dict, List, Optional, Set, Tuple
|
| 7 |
|
| 8 |
import datasets
|
| 9 |
-
from
|
| 10 |
-
from
|
| 11 |
-
from
|
| 12 |
TextBasedDocument,
|
| 13 |
TextDocumentWithLabeledSpansAndBinaryRelations,
|
| 14 |
)
|
|
@@ -42,10 +42,10 @@ class MultiRelation(Annotation):
|
|
| 42 |
@dataclasses.dataclass
|
| 43 |
class ArgMicroDocument(TextBasedDocument):
|
| 44 |
topic_id: Optional[str] = None
|
| 45 |
-
stance:
|
| 46 |
-
edus:
|
| 47 |
-
adus:
|
| 48 |
-
relations:
|
| 49 |
|
| 50 |
|
| 51 |
def example_to_document(
|
|
|
|
| 6 |
from typing import Any, Dict, List, Optional, Set, Tuple
|
| 7 |
|
| 8 |
import datasets
|
| 9 |
+
from pie_core import Annotation, AnnotationLayer, annotation_field
|
| 10 |
+
from pie_modules.annotations import BinaryRelation, Label, LabeledSpan, Span
|
| 11 |
+
from pie_modules.documents import (
|
| 12 |
TextBasedDocument,
|
| 13 |
TextDocumentWithLabeledSpansAndBinaryRelations,
|
| 14 |
)
|
|
|
|
| 42 |
@dataclasses.dataclass
|
| 43 |
class ArgMicroDocument(TextBasedDocument):
|
| 44 |
topic_id: Optional[str] = None
|
| 45 |
+
stance: AnnotationLayer[Label] = annotation_field()
|
| 46 |
+
edus: AnnotationLayer[Span] = annotation_field(target="text")
|
| 47 |
+
adus: AnnotationLayer[LabeledAnnotationCollection] = annotation_field(target="edus")
|
| 48 |
+
relations: AnnotationLayer[MultiRelation] = annotation_field(target="adus")
|
| 49 |
|
| 50 |
|
| 51 |
def example_to_document(
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
pie-datasets>=0.
|
|
|
|
|
|
| 1 |
+
pie-datasets>=0.10.11,<0.11.0
|
| 2 |
+
pie-modules>=0.15.9,<0.16.0
|