ArneBinder commited on
Commit
837ff28
·
verified ·
1 Parent(s): 043590b

use pie-modules instead of pytorch-ie

Browse files

see https://github.com/ArneBinder/pie-datasets/pull/204 for further information

Files changed (2) hide show
  1. requirements.txt +2 -2
  2. tacred.py +10 -10
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- pie-datasets>=0.6.0,<0.9.0
2
- pie-modules>=0.8.0,<0.9.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 pytorch_ie.annotations import BinaryRelation, LabeledSpan
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: AnnotationList[TokenAttribute] = annotation_field(target="tokens")
33
- stanford_pos: AnnotationList[TokenAttribute] = annotation_field(target="tokens")
34
- entities: AnnotationList[LabeledSpan] = annotation_field(target="tokens")
35
- relations: AnnotationList[BinaryRelation] = annotation_field(target="entities")
36
- dependency_relations: AnnotationList[TokenRelation] = annotation_field(target="tokens")
37
 
38
 
39
  @dataclass
40
  class SimpleTacredDocument(TokenBasedDocument):
41
- labeled_spans: AnnotationList[LabeledSpan] = annotation_field(target="tokens")
42
- binary_relations: AnnotationList[BinaryRelation] = annotation_field(target="labeled_spans")
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(