ArneBinder commited on
Commit
fb23b1c
·
verified ·
1 Parent(s): 37bcdde

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. cdcp.py +3 -3
  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/cdcp")
@@ -38,20 +38,20 @@ and the following annotation layers:
38
  - `relations` (annotation type: `BinaryRelation`, target: `propositions`)
39
  - `urls` (annotation type: `Attribute`, target: `propositions`)
40
 
41
- See [here](https://github.com/ArneBinder/pie-modules/blob/main/src/pie_modules/annotations.py) for the annotation type definitions.
42
 
43
  ## Document Converters
44
 
45
  The dataset provides document converters for the following target document types:
46
 
47
- - `pie_modules.documents.TextDocumentWithLabeledSpansAndBinaryRelations`
48
  - `labeled_spans`: `LabeledSpan` annotations, converted from `CDCPDocument`'s `propositions`
49
  - labels: `fact`, `policy`, `reference`, `testimony`, `value`
50
  - if `propositions` contain whitespace at the beginning and/or the end, the whitespace are trimmed out.
51
  - `binary_relations`: `BinaryRelation` annotations, converted from `CDCPDocument`'s `relations`
52
  - labels: `reason`, `evidence`
53
 
54
- See [here](https://github.com/ArneBinder/pie-modules/blob/main/src/pie_modules/documents.py) for the document type
55
  definitions.
56
 
57
  ### Collected Statistics after Document Conversion
@@ -75,7 +75,7 @@ input:
75
  revision: 001722894bdca6df6a472d0d186a3af103e392c5
76
  ```
77
 
78
- 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)).
79
 
80
  #### Relation argument (outer) token distance per label
81
 
 
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/cdcp")
 
38
  - `relations` (annotation type: `BinaryRelation`, target: `propositions`)
39
  - `urls` (annotation type: `Attribute`, target: `propositions`)
40
 
41
+ See [here](https://github.com/ArneBinder/pie-documents/blob/main/src/pie_documents/annotations.py) for the annotation type definitions.
42
 
43
  ## Document Converters
44
 
45
  The dataset provides document converters for the following target document types:
46
 
47
+ - `pie_documents.documents.TextDocumentWithLabeledSpansAndBinaryRelations`
48
  - `labeled_spans`: `LabeledSpan` annotations, converted from `CDCPDocument`'s `propositions`
49
  - labels: `fact`, `policy`, `reference`, `testimony`, `value`
50
  - if `propositions` contain whitespace at the beginning and/or the end, the whitespace are trimmed out.
51
  - `binary_relations`: `BinaryRelation` annotations, converted from `CDCPDocument`'s `relations`
52
  - labels: `reason`, `evidence`
53
 
54
+ See [here](https://github.com/ArneBinder/pie-documents/blob/main/src/pie_documents/documents.py) for the document type
55
  definitions.
56
 
57
  ### Collected Statistics after Document Conversion
 
75
  revision: 001722894bdca6df6a472d0d186a3af103e392c5
76
  ```
77
 
78
+ 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)).
79
 
80
  #### Relation argument (outer) token distance per label
81
 
cdcp.py CHANGED
@@ -4,9 +4,9 @@ from typing import Any, Dict, List, Optional
4
 
5
  import datasets
6
  from pie_core import Annotation, AnnotationLayer, annotation_field
7
- from pie_modules.annotations import BinaryRelation, LabeledSpan
8
- from pie_modules.document.processing.text_span_trimmer import trim_text_spans
9
- from pie_modules.documents import (
10
  TextBasedDocument,
11
  TextDocumentWithLabeledSpansAndBinaryRelations,
12
  )
 
4
 
5
  import datasets
6
  from pie_core import Annotation, AnnotationLayer, annotation_field
7
+ from pie_documents.annotations import BinaryRelation, LabeledSpan
8
+ from pie_documents.document.processing.text_span_trimmer import trim_text_spans
9
+ from pie_documents.documents import (
10
  TextBasedDocument,
11
  TextDocumentWithLabeledSpansAndBinaryRelations,
12
  )
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