ArneBinder commited on
Commit
df69df5
·
verified ·
1 Parent(s): 146ba4e

use pie-documents 0.1.0

Browse files

from https://github.com/ArneBinder/pie-datasets/pull/209 (and https://github.com/ArneBinder/pie-datasets/pull/211), also see https://github.com/ArneBinder/pie-documents/releases/tag/v0.1.0

Files changed (3) hide show
  1. README.md +5 -5
  2. argmicro.py +2 -2
  3. requirements.txt +1 -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 pie_modules.documents import TextDocumentWithLabeledSpansAndBinaryRelations
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/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,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/ArneBinder/pie-modules/blob/main/src/pie_modules/documents.py) for the document type
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/ArneBinder/pie-modules/blob/main/src/pie_modules/documents.py)).
101
 
102
  #### Relation argument (outer) token distance per label
103
 
 
7
 
8
  ```python
9
  from pie_datasets import load_dataset
10
+ from pie_documents.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-documents/blob/main/src/pie_documents/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_documents.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-documents/blob/main/src/pie_documents/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-documents/blob/main/src/pie_documents/documents.py)).
101
 
102
  #### Relation argument (outer) token distance per label
103
 
argmicro.py CHANGED
@@ -7,8 +7,8 @@ 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
  )
 
7
 
8
  import datasets
9
  from pie_core import Annotation, AnnotationLayer, annotation_field
10
+ from pie_documents.annotations import BinaryRelation, Label, LabeledSpan, Span
11
+ from pie_documents.documents import (
12
  TextBasedDocument,
13
  TextDocumentWithLabeledSpansAndBinaryRelations,
14
  )
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
  pie-datasets>=0.10.11,<0.12.0
2
- pie-modules>=0.15.9,<0.16.0
 
1
  pie-datasets>=0.10.11,<0.12.0
2
+ pie-documents>=0.1.0,<0.2.0