use pie-modules instead of pytorch-ie
Browse filessee https://github.com/ArneBinder/pie-datasets/pull/204 for further information
- requirements.txt +2 -2
- tacred.py +10 -10
requirements.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
pie-datasets>=0.
|
| 2 |
-
pie-modules>=0.
|
|
|
|
| 1 |
+
pie-datasets>=0.10.11,<0.11.0
|
| 2 |
+
pie-modules>=0.15.9,<0.16.0
|
tacred.py
CHANGED
|
@@ -2,10 +2,10 @@ from dataclasses import dataclass, field
|
|
| 2 |
from typing import Any, Dict, Optional
|
| 3 |
|
| 4 |
import datasets
|
|
|
|
|
|
|
| 5 |
from pie_modules.document.processing import token_based_document_to_text_based
|
| 6 |
-
from
|
| 7 |
-
from pytorch_ie.core import Annotation, AnnotationList, annotation_field
|
| 8 |
-
from pytorch_ie.documents import (
|
| 9 |
TextDocumentWithLabeledSpansAndBinaryRelations,
|
| 10 |
TokenBasedDocument,
|
| 11 |
)
|
|
@@ -29,17 +29,17 @@ class TokenAttribute(Annotation):
|
|
| 29 |
|
| 30 |
@dataclass
|
| 31 |
class TacredDocument(TokenBasedDocument):
|
| 32 |
-
stanford_ner:
|
| 33 |
-
stanford_pos:
|
| 34 |
-
entities:
|
| 35 |
-
relations:
|
| 36 |
-
dependency_relations:
|
| 37 |
|
| 38 |
|
| 39 |
@dataclass
|
| 40 |
class SimpleTacredDocument(TokenBasedDocument):
|
| 41 |
-
labeled_spans:
|
| 42 |
-
binary_relations:
|
| 43 |
|
| 44 |
|
| 45 |
def example_to_document(
|
|
|
|
| 2 |
from typing import Any, Dict, Optional
|
| 3 |
|
| 4 |
import datasets
|
| 5 |
+
from pie_core import Annotation, AnnotationLayer, annotation_field
|
| 6 |
+
from pie_modules.annotations import BinaryRelation, LabeledSpan
|
| 7 |
from pie_modules.document.processing import token_based_document_to_text_based
|
| 8 |
+
from pie_modules.documents import (
|
|
|
|
|
|
|
| 9 |
TextDocumentWithLabeledSpansAndBinaryRelations,
|
| 10 |
TokenBasedDocument,
|
| 11 |
)
|
|
|
|
| 29 |
|
| 30 |
@dataclass
|
| 31 |
class TacredDocument(TokenBasedDocument):
|
| 32 |
+
stanford_ner: AnnotationLayer[TokenAttribute] = annotation_field(target="tokens")
|
| 33 |
+
stanford_pos: AnnotationLayer[TokenAttribute] = annotation_field(target="tokens")
|
| 34 |
+
entities: AnnotationLayer[LabeledSpan] = annotation_field(target="tokens")
|
| 35 |
+
relations: AnnotationLayer[BinaryRelation] = annotation_field(target="entities")
|
| 36 |
+
dependency_relations: AnnotationLayer[TokenRelation] = annotation_field(target="tokens")
|
| 37 |
|
| 38 |
|
| 39 |
@dataclass
|
| 40 |
class SimpleTacredDocument(TokenBasedDocument):
|
| 41 |
+
labeled_spans: AnnotationLayer[LabeledSpan] = annotation_field(target="tokens")
|
| 42 |
+
binary_relations: AnnotationLayer[BinaryRelation] = annotation_field(target="labeled_spans")
|
| 43 |
|
| 44 |
|
| 45 |
def example_to_document(
|