Skip to content
This repository was archived by the owner on Dec 29, 2021. It is now read-only.

Commit e625020

Browse files
authored
Support arcs in tagger (#34)
1 parent 7b1764e commit e625020

File tree

4 files changed

+329
-296
lines changed

4 files changed

+329
-296
lines changed

docs/developing.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,28 @@ Replace `<MODEL>` with the name of the [spaCy model](https://spacy.io/models) (e
77
### Development
88

99
```
10-
SPACY_MODEL=<MODEL> SENSE2VEC=<ENABLED> docker-compose -p dev --project-directory . \
11-
-f docker/docker-compose.yml -f docker/docker-compose.override.yml up --build
10+
SPACY_MODEL=<MODEL> SENSE2VEC=<ENABLED> docker-compose \
11+
-p dev \
12+
--project-directory . \
13+
-f docker/docker-compose.yml \
14+
-f docker/docker-compose.override.yml \
15+
up --build
1216
```
13-
1417
The server will be running on `http://localhost:8000`, and has automatic reload enabled.
1518

1619
### Testing
1720

18-
```
19-
docker-compose -p test --project-directory . -f docker/docker-compose.yml -f docker/docker-compose.test.yml \
20-
run --service-ports app sh -c '. scripts/setup.sh && bash'
21-
```
22-
23-
Changes to the source code will automatically be mirrored in the container. A bind mount connects the project directory and the container so that you can run commands like `pytest`.
21+
1. Start the container. A bind mount connects the project directory and the container so that changes to the source code will automatically be mirrored in the container.
22+
```
23+
docker-compose \
24+
-p test \
25+
--project-directory . \
26+
-f docker/docker-compose.yml \
27+
-f docker/docker-compose.test.yml \
28+
run --service-ports app sh -c '. scripts/setup.sh && bash'
29+
```
30+
1. Test whenever you want by running `pytest`.
31+
1. Exit the container once you're done: `exit`
2432
2533
### Production
2634

docs/spec/pos.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ post:
3232
text_with_ws: 'Google '
3333
whitespace: " "
3434
head: is
35+
head_index: 1
3536
left_edge: Google
3637
right_edge: Google
3738
index: 0
@@ -68,6 +69,7 @@ post:
6869
text_with_ws: 'is '
6970
whitespace: " "
7071
head: is
72+
head_index: 1
7173
left_edge: Google
7274
right_edge: "."
7375
index: 1
@@ -104,6 +106,7 @@ post:
104106
text_with_ws: 'a '
105107
whitespace: " "
106108
head: company
109+
head_index: 3
107110
left_edge: a
108111
right_edge: a
109112
index: 2
@@ -140,6 +143,7 @@ post:
140143
text_with_ws: company
141144
whitespace: ''
142145
head: is
146+
head_index: 1
143147
left_edge: a
144148
right_edge: company
145149
index: 3
@@ -176,6 +180,7 @@ post:
176180
text_with_ws: ". "
177181
whitespace: " "
178182
head: is
183+
head_index: 1
179184
left_edge: "."
180185
right_edge: "."
181186
index: 4
@@ -214,6 +219,7 @@ post:
214219
text_with_ws: 'Sundar '
215220
whitespace: " "
216221
head: Pichai
222+
head_index: 6
217223
left_edge: Sundar
218224
right_edge: Sundar
219225
index: 5
@@ -250,6 +256,7 @@ post:
250256
text_with_ws: 'Pichai '
251257
whitespace: " "
252258
head: is
259+
head_index: 7
253260
left_edge: Sundar
254261
right_edge: Pichai
255262
index: 6
@@ -286,6 +293,7 @@ post:
286293
text_with_ws: 'is '
287294
whitespace: " "
288295
head: is
296+
head_index: 7
289297
left_edge: Sundar
290298
right_edge: "."
291299
index: 7
@@ -322,6 +330,7 @@ post:
322330
text_with_ws: it
323331
whitespace: ''
324332
head: "'s"
333+
head_index: 9
325334
left_edge: it
326335
right_edge: it
327336
index: 8
@@ -358,6 +367,7 @@ post:
358367
text_with_ws: "'s "
359368
whitespace: " "
360369
head: is
370+
head_index: 7
361371
left_edge: it
362372
right_edge: CEO
363373
index: 9
@@ -394,6 +404,7 @@ post:
394404
text_with_ws: CEO
395405
whitespace: ''
396406
head: "'s"
407+
head_index: 9
397408
left_edge: CEO
398409
right_edge: CEO
399410
index: 10
@@ -430,6 +441,7 @@ post:
430441
text_with_ws: "."
431442
whitespace: ''
432443
head: is
444+
head_index: 7
433445
left_edge: "."
434446
right_edge: "."
435447
index: 11

src/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class Token:
159159
text_with_ws: str
160160
whitespace: str
161161
head: str
162+
head_index: int
162163
left_edge: str
163164
right_edge: str
164165
index: int
@@ -236,6 +237,7 @@ def build_token_with_sent(token) -> TokenWithSentence:
236237
text_with_ws=token.text_with_ws,
237238
whitespace=token.whitespace_,
238239
head=token.head.text,
240+
head_index=token.head.i,
239241
left_edge=token.left_edge.text,
240242
right_edge=token.right_edge.text,
241243
index=token.i,

0 commit comments

Comments
 (0)