Spaces:
Sleeping
Sleeping
deploy at 2025-12-28 21:00:05.194822
Browse files- Dependency length.ipynb +154 -174
- main.py +2 -2
Dependency length.ipynb
CHANGED
|
@@ -38,7 +38,7 @@
|
|
| 38 |
},
|
| 39 |
{
|
| 40 |
"cell_type": "code",
|
| 41 |
-
"execution_count":
|
| 42 |
"id": "cefdbf22-b747-4bea-b279-c9b01e75ff2e",
|
| 43 |
"metadata": {},
|
| 44 |
"outputs": [],
|
|
@@ -62,7 +62,7 @@
|
|
| 62 |
" to_reverse[i-1].dep_ = \"comp\"\n",
|
| 63 |
" for token in doc:\n",
|
| 64 |
" if token.dep_ == \"dep\": token.dep_ = \"unknown\"\n",
|
| 65 |
-
" if token.dep_ == \"prep\" and token.head.pos_ == \"VERB\" and token.i < token.head.i:\n",
|
| 66 |
" token.dep_ = \"mod\"\n",
|
| 67 |
" if token.dep_ == \"ccomp\" and any(sibling.dep_ in relations[\"comp\"] \n",
|
| 68 |
" for sibling in token.head.rights if sibling.i < token.i):\n",
|
|
@@ -83,7 +83,7 @@
|
|
| 83 |
" subject = [child for child in token.children if child.dep_ == \"subj\"]\n",
|
| 84 |
" if subject:\n",
|
| 85 |
" for child in [c for c in token.children if c.i < subject[0].i]:\n",
|
| 86 |
-
" if child.dep_ in [\"comp\", \"udep\"]:\n",
|
| 87 |
" child.dep_ = \"mod\"\n",
|
| 88 |
" for token in doc:\n",
|
| 89 |
" if any(t.text == \";\" for t in doc if (token.i < t.i < token.head.i or token.head.i < t.i < token.i) and token.pos_ != \"PUNCT\"):\n",
|
|
@@ -157,355 +157,334 @@
|
|
| 157 |
},
|
| 158 |
{
|
| 159 |
"cell_type": "code",
|
| 160 |
-
"execution_count":
|
| 161 |
"id": "ba90ff19-c665-49d8-8ad4-5caee885901d",
|
| 162 |
"metadata": {},
|
| 163 |
"outputs": [
|
| 164 |
{
|
| 165 |
"data": {
|
| 166 |
"text/html": [
|
| 167 |
-
"<span class=\"tex2jax_ignore\"><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:lang=\"en\" id=\"
|
| 168 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 169 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"50\">
|
| 170 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"50\">
|
| 171 |
"</text>\n",
|
| 172 |
"\n",
|
| 173 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 174 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"225\">
|
| 175 |
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"225\">VERB</tspan>\n",
|
| 176 |
"</text>\n",
|
| 177 |
"\n",
|
| 178 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 179 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"400\">
|
| 180 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"400\">
|
| 181 |
"</text>\n",
|
| 182 |
"\n",
|
| 183 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 184 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"575\">
|
| 185 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"575\">
|
| 186 |
"</text>\n",
|
| 187 |
"\n",
|
| 188 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 189 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"750\">
|
| 190 |
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"750\">NOUN</tspan>\n",
|
| 191 |
"</text>\n",
|
| 192 |
"\n",
|
| 193 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 194 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"925\">
|
| 195 |
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"925\">ADP</tspan>\n",
|
| 196 |
"</text>\n",
|
| 197 |
"\n",
|
| 198 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 199 |
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1100\">the</tspan>\n",
|
| 200 |
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1100\">DET</tspan>\n",
|
| 201 |
"</text>\n",
|
| 202 |
"\n",
|
| 203 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 204 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1275\">
|
| 205 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1275\">
|
| 206 |
"</text>\n",
|
| 207 |
"\n",
|
| 208 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 209 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1450\">
|
| 210 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1450\">
|
| 211 |
"</text>\n",
|
| 212 |
"\n",
|
| 213 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 214 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1625\">
|
| 215 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1625\">
|
| 216 |
"</text>\n",
|
| 217 |
"\n",
|
| 218 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 219 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1800\">
|
| 220 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1800\">
|
| 221 |
"</text>\n",
|
| 222 |
"\n",
|
| 223 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 224 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1975\">
|
| 225 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1975\">
|
| 226 |
"</text>\n",
|
| 227 |
"\n",
|
| 228 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 229 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"2150\">
|
| 230 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"2150\">
|
| 231 |
"</text>\n",
|
| 232 |
"\n",
|
| 233 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 234 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"2325\">
|
| 235 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"2325\">
|
| 236 |
"</text>\n",
|
| 237 |
"\n",
|
| 238 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 239 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"2500\">
|
| 240 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"2500\">
|
| 241 |
"</text>\n",
|
| 242 |
"\n",
|
| 243 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 244 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"2675\">
|
| 245 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"2675\">
|
| 246 |
"</text>\n",
|
| 247 |
"\n",
|
| 248 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 249 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"2850\">
|
| 250 |
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"2850\">NOUN</tspan>\n",
|
| 251 |
"</text>\n",
|
| 252 |
"\n",
|
| 253 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 254 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3025\">
|
| 255 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3025\">
|
| 256 |
"</text>\n",
|
| 257 |
"\n",
|
| 258 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 259 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3200\">
|
| 260 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3200\">
|
| 261 |
"</text>\n",
|
| 262 |
"\n",
|
| 263 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 264 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3375\">
|
| 265 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3375\">
|
| 266 |
"</text>\n",
|
| 267 |
"\n",
|
| 268 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 269 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3550\">
|
| 270 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3550\">
|
| 271 |
"</text>\n",
|
| 272 |
"\n",
|
| 273 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 274 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3725\">
|
| 275 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3725\">
|
| 276 |
"</text>\n",
|
| 277 |
"\n",
|
| 278 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 279 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3900\">
|
| 280 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3900\">
|
| 281 |
"</text>\n",
|
| 282 |
"\n",
|
| 283 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 284 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"4075\">
|
| 285 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"4075\">
|
| 286 |
"</text>\n",
|
| 287 |
"\n",
|
| 288 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 289 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"4250\">
|
| 290 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"4250\">
|
| 291 |
"</text>\n",
|
| 292 |
"\n",
|
| 293 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"
|
| 294 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"4425\">
|
| 295 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"4425\">
|
| 296 |
"</text>\n",
|
| 297 |
"\n",
|
| 298 |
-
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"397.0\">\n",
|
| 299 |
-
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"4600\">species</tspan>\n",
|
| 300 |
-
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"4600\">NOUN</tspan>\n",
|
| 301 |
-
"</text>\n",
|
| 302 |
-
"\n",
|
| 303 |
-
"<g class=\"displacy-arrow\">\n",
|
| 304 |
-
" <path class=\"displacy-arc\" id=\"arrow-91f44e7b72df4952ba0ee597a77e0111-0-0\" stroke-width=\"2px\" d=\"M70,352.0 C70,264.5 210.0,264.5 210.0,352.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 305 |
-
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 306 |
-
" <textPath xlink:href=\"#arrow-91f44e7b72df4952ba0ee597a77e0111-0-0\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">subj</textPath>\n",
|
| 307 |
-
" </text>\n",
|
| 308 |
-
" <path class=\"displacy-arrowhead\" d=\"M70,354.0 L62,342.0 78,342.0\" fill=\"currentColor\"/>\n",
|
| 309 |
-
"</g>\n",
|
| 310 |
-
"\n",
|
| 311 |
-
"<g class=\"displacy-arrow\">\n",
|
| 312 |
-
" <path class=\"displacy-arc\" id=\"arrow-91f44e7b72df4952ba0ee597a77e0111-0-1\" stroke-width=\"2px\" d=\"M420,352.0 C420,177.0 740.0,177.0 740.0,352.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 313 |
-
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 314 |
-
" <textPath xlink:href=\"#arrow-91f44e7b72df4952ba0ee597a77e0111-0-1\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">det</textPath>\n",
|
| 315 |
-
" </text>\n",
|
| 316 |
-
" <path class=\"displacy-arrowhead\" d=\"M420,354.0 L412,342.0 428,342.0\" fill=\"currentColor\"/>\n",
|
| 317 |
-
"</g>\n",
|
| 318 |
-
"\n",
|
| 319 |
"<g class=\"displacy-arrow\">\n",
|
| 320 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 321 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 322 |
-
" <textPath xlink:href=\"#arrow-
|
| 323 |
" </text>\n",
|
| 324 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 325 |
"</g>\n",
|
| 326 |
"\n",
|
| 327 |
"<g class=\"displacy-arrow\">\n",
|
| 328 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 329 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 330 |
-
" <textPath xlink:href=\"#arrow-
|
| 331 |
" </text>\n",
|
| 332 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 333 |
"</g>\n",
|
| 334 |
"\n",
|
| 335 |
"<g class=\"displacy-arrow\">\n",
|
| 336 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 337 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 338 |
-
" <textPath xlink:href=\"#arrow-
|
| 339 |
" </text>\n",
|
| 340 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 341 |
"</g>\n",
|
| 342 |
"\n",
|
| 343 |
"<g class=\"displacy-arrow\">\n",
|
| 344 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 345 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 346 |
-
" <textPath xlink:href=\"#arrow-
|
| 347 |
" </text>\n",
|
| 348 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 349 |
"</g>\n",
|
| 350 |
"\n",
|
| 351 |
"<g class=\"displacy-arrow\">\n",
|
| 352 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 353 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 354 |
-
" <textPath xlink:href=\"#arrow-
|
| 355 |
" </text>\n",
|
| 356 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 357 |
"</g>\n",
|
| 358 |
"\n",
|
| 359 |
"<g class=\"displacy-arrow\">\n",
|
| 360 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 361 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 362 |
-
" <textPath xlink:href=\"#arrow-
|
| 363 |
" </text>\n",
|
| 364 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 365 |
"</g>\n",
|
| 366 |
"\n",
|
| 367 |
"<g class=\"displacy-arrow\">\n",
|
| 368 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 369 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 370 |
-
" <textPath xlink:href=\"#arrow-
|
| 371 |
" </text>\n",
|
| 372 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 373 |
"</g>\n",
|
| 374 |
"\n",
|
| 375 |
"<g class=\"displacy-arrow\">\n",
|
| 376 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 377 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 378 |
-
" <textPath xlink:href=\"#arrow-
|
| 379 |
" </text>\n",
|
| 380 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 381 |
"</g>\n",
|
| 382 |
"\n",
|
| 383 |
"<g class=\"displacy-arrow\">\n",
|
| 384 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 385 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 386 |
-
" <textPath xlink:href=\"#arrow-
|
| 387 |
" </text>\n",
|
| 388 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 389 |
"</g>\n",
|
| 390 |
"\n",
|
| 391 |
"<g class=\"displacy-arrow\">\n",
|
| 392 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 393 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 394 |
-
" <textPath xlink:href=\"#arrow-
|
| 395 |
" </text>\n",
|
| 396 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 397 |
"</g>\n",
|
| 398 |
"\n",
|
| 399 |
"<g class=\"displacy-arrow\">\n",
|
| 400 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 401 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 402 |
-
" <textPath xlink:href=\"#arrow-
|
| 403 |
" </text>\n",
|
| 404 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 405 |
"</g>\n",
|
| 406 |
"\n",
|
| 407 |
"<g class=\"displacy-arrow\">\n",
|
| 408 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 409 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 410 |
-
" <textPath xlink:href=\"#arrow-
|
| 411 |
" </text>\n",
|
| 412 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 413 |
"</g>\n",
|
| 414 |
"\n",
|
| 415 |
"<g class=\"displacy-arrow\">\n",
|
| 416 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 417 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 418 |
-
" <textPath xlink:href=\"#arrow-
|
| 419 |
" </text>\n",
|
| 420 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 421 |
"</g>\n",
|
| 422 |
"\n",
|
| 423 |
"<g class=\"displacy-arrow\">\n",
|
| 424 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 425 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 426 |
-
" <textPath xlink:href=\"#arrow-
|
| 427 |
" </text>\n",
|
| 428 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 429 |
"</g>\n",
|
| 430 |
"\n",
|
| 431 |
"<g class=\"displacy-arrow\">\n",
|
| 432 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 433 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 434 |
-
" <textPath xlink:href=\"#arrow-
|
| 435 |
" </text>\n",
|
| 436 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 437 |
"</g>\n",
|
| 438 |
"\n",
|
| 439 |
"<g class=\"displacy-arrow\">\n",
|
| 440 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 441 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 442 |
-
" <textPath xlink:href=\"#arrow-
|
| 443 |
" </text>\n",
|
| 444 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 445 |
"</g>\n",
|
| 446 |
"\n",
|
| 447 |
"<g class=\"displacy-arrow\">\n",
|
| 448 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 449 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 450 |
-
" <textPath xlink:href=\"#arrow-
|
| 451 |
" </text>\n",
|
| 452 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 453 |
"</g>\n",
|
| 454 |
"\n",
|
| 455 |
"<g class=\"displacy-arrow\">\n",
|
| 456 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 457 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 458 |
-
" <textPath xlink:href=\"#arrow-
|
| 459 |
" </text>\n",
|
| 460 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 461 |
"</g>\n",
|
| 462 |
"\n",
|
| 463 |
"<g class=\"displacy-arrow\">\n",
|
| 464 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 465 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 466 |
-
" <textPath xlink:href=\"#arrow-
|
| 467 |
" </text>\n",
|
| 468 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 469 |
"</g>\n",
|
| 470 |
"\n",
|
| 471 |
"<g class=\"displacy-arrow\">\n",
|
| 472 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 473 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 474 |
-
" <textPath xlink:href=\"#arrow-
|
| 475 |
" </text>\n",
|
| 476 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 477 |
"</g>\n",
|
| 478 |
"\n",
|
| 479 |
"<g class=\"displacy-arrow\">\n",
|
| 480 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 481 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 482 |
-
" <textPath xlink:href=\"#arrow-
|
| 483 |
" </text>\n",
|
| 484 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 485 |
"</g>\n",
|
| 486 |
"\n",
|
| 487 |
"<g class=\"displacy-arrow\">\n",
|
| 488 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 489 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 490 |
-
" <textPath xlink:href=\"#arrow-
|
| 491 |
" </text>\n",
|
| 492 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 493 |
"</g>\n",
|
| 494 |
"\n",
|
| 495 |
"<g class=\"displacy-arrow\">\n",
|
| 496 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 497 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 498 |
-
" <textPath xlink:href=\"#arrow-
|
| 499 |
" </text>\n",
|
| 500 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 501 |
"</g>\n",
|
| 502 |
"\n",
|
| 503 |
"<g class=\"displacy-arrow\">\n",
|
| 504 |
-
" <path class=\"displacy-arc\" id=\"arrow-
|
| 505 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 506 |
-
" <textPath xlink:href=\"#arrow-
|
| 507 |
" </text>\n",
|
| 508 |
-
" <path class=\"displacy-arrowhead\" d=\"
|
| 509 |
"</g>\n",
|
| 510 |
"</svg></span>"
|
| 511 |
],
|
|
@@ -518,7 +497,7 @@
|
|
| 518 |
}
|
| 519 |
],
|
| 520 |
"source": [
|
| 521 |
-
"doc = ssudify(nlp(\"
|
| 522 |
"# Since this is an interactive Jupyter environment, we can use displacy.render here\n",
|
| 523 |
"displacy.render(doc, style='dep')"
|
| 524 |
]
|
|
@@ -532,9 +511,10 @@
|
|
| 532 |
{
|
| 533 |
"data": {
|
| 534 |
"text/plain": [
|
| 535 |
-
"[(
|
| 536 |
-
"
|
| 537 |
-
" (
|
|
|
|
| 538 |
]
|
| 539 |
},
|
| 540 |
"execution_count": 7,
|
|
|
|
| 38 |
},
|
| 39 |
{
|
| 40 |
"cell_type": "code",
|
| 41 |
+
"execution_count": 22,
|
| 42 |
"id": "cefdbf22-b747-4bea-b279-c9b01e75ff2e",
|
| 43 |
"metadata": {},
|
| 44 |
"outputs": [],
|
|
|
|
| 62 |
" to_reverse[i-1].dep_ = \"comp\"\n",
|
| 63 |
" for token in doc:\n",
|
| 64 |
" if token.dep_ == \"dep\": token.dep_ = \"unknown\"\n",
|
| 65 |
+
" if token.dep_ == \"prep\" and token.head.pos_ == \"VERB\" and token.i < token.head.i and token.head.dep_ not in relations[\"mod\"]:\n",
|
| 66 |
" token.dep_ = \"mod\"\n",
|
| 67 |
" if token.dep_ == \"ccomp\" and any(sibling.dep_ in relations[\"comp\"] \n",
|
| 68 |
" for sibling in token.head.rights if sibling.i < token.i):\n",
|
|
|
|
| 83 |
" subject = [child for child in token.children if child.dep_ == \"subj\"]\n",
|
| 84 |
" if subject:\n",
|
| 85 |
" for child in [c for c in token.children if c.i < subject[0].i]:\n",
|
| 86 |
+
" if child.dep_ in [\"comp\", \"udep\"] and token.dep_ != \"mod\":\n",
|
| 87 |
" child.dep_ = \"mod\"\n",
|
| 88 |
" for token in doc:\n",
|
| 89 |
" if any(t.text == \";\" for t in doc if (token.i < t.i < token.head.i or token.head.i < t.i < token.i) and token.pos_ != \"PUNCT\"):\n",
|
|
|
|
| 157 |
},
|
| 158 |
{
|
| 159 |
"cell_type": "code",
|
| 160 |
+
"execution_count": 24,
|
| 161 |
"id": "ba90ff19-c665-49d8-8ad4-5caee885901d",
|
| 162 |
"metadata": {},
|
| 163 |
"outputs": [
|
| 164 |
{
|
| 165 |
"data": {
|
| 166 |
"text/html": [
|
| 167 |
+
"<span class=\"tex2jax_ignore\"><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:lang=\"en\" id=\"9f58d58c7a8540688553bdb828bd211d-0\" class=\"displacy\" width=\"4600\" height=\"662.0\" direction=\"ltr\" style=\"max-width: none; height: 662.0px; color: #000000; background: #ffffff; font-family: Arial; direction: ltr\">\n",
|
| 168 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 169 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"50\">to</tspan>\n",
|
| 170 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"50\">PART</tspan>\n",
|
| 171 |
"</text>\n",
|
| 172 |
"\n",
|
| 173 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 174 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"225\">assume,</tspan>\n",
|
| 175 |
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"225\">VERB</tspan>\n",
|
| 176 |
"</text>\n",
|
| 177 |
"\n",
|
| 178 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 179 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"400\">among</tspan>\n",
|
| 180 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"400\">ADP</tspan>\n",
|
| 181 |
"</text>\n",
|
| 182 |
"\n",
|
| 183 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 184 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"575\">the</tspan>\n",
|
| 185 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"575\">DET</tspan>\n",
|
| 186 |
"</text>\n",
|
| 187 |
"\n",
|
| 188 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 189 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"750\">powers</tspan>\n",
|
| 190 |
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"750\">NOUN</tspan>\n",
|
| 191 |
"</text>\n",
|
| 192 |
"\n",
|
| 193 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 194 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"925\">of</tspan>\n",
|
| 195 |
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"925\">ADP</tspan>\n",
|
| 196 |
"</text>\n",
|
| 197 |
"\n",
|
| 198 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 199 |
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1100\">the</tspan>\n",
|
| 200 |
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1100\">DET</tspan>\n",
|
| 201 |
"</text>\n",
|
| 202 |
"\n",
|
| 203 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 204 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1275\">earth,</tspan>\n",
|
| 205 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1275\">NOUN</tspan>\n",
|
| 206 |
"</text>\n",
|
| 207 |
"\n",
|
| 208 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 209 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1450\">the</tspan>\n",
|
| 210 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1450\">DET</tspan>\n",
|
| 211 |
"</text>\n",
|
| 212 |
"\n",
|
| 213 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 214 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1625\">separate</tspan>\n",
|
| 215 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1625\">ADJ</tspan>\n",
|
| 216 |
"</text>\n",
|
| 217 |
"\n",
|
| 218 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 219 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1800\">and</tspan>\n",
|
| 220 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1800\">CCONJ</tspan>\n",
|
| 221 |
"</text>\n",
|
| 222 |
"\n",
|
| 223 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 224 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"1975\">equal</tspan>\n",
|
| 225 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"1975\">ADJ</tspan>\n",
|
| 226 |
"</text>\n",
|
| 227 |
"\n",
|
| 228 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 229 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"2150\">station</tspan>\n",
|
| 230 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"2150\">NOUN</tspan>\n",
|
| 231 |
"</text>\n",
|
| 232 |
"\n",
|
| 233 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 234 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"2325\">to</tspan>\n",
|
| 235 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"2325\">PART</tspan>\n",
|
| 236 |
"</text>\n",
|
| 237 |
"\n",
|
| 238 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 239 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"2500\">which</tspan>\n",
|
| 240 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"2500\">PRON</tspan>\n",
|
| 241 |
"</text>\n",
|
| 242 |
"\n",
|
| 243 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 244 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"2675\">the</tspan>\n",
|
| 245 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"2675\">DET</tspan>\n",
|
| 246 |
"</text>\n",
|
| 247 |
"\n",
|
| 248 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 249 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"2850\">laws</tspan>\n",
|
| 250 |
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"2850\">NOUN</tspan>\n",
|
| 251 |
"</text>\n",
|
| 252 |
"\n",
|
| 253 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 254 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3025\">of</tspan>\n",
|
| 255 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3025\">ADP</tspan>\n",
|
| 256 |
"</text>\n",
|
| 257 |
"\n",
|
| 258 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 259 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3200\">nature</tspan>\n",
|
| 260 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3200\">NOUN</tspan>\n",
|
| 261 |
"</text>\n",
|
| 262 |
"\n",
|
| 263 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 264 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3375\">and</tspan>\n",
|
| 265 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3375\">CCONJ</tspan>\n",
|
| 266 |
"</text>\n",
|
| 267 |
"\n",
|
| 268 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 269 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3550\">of</tspan>\n",
|
| 270 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3550\">ADP</tspan>\n",
|
| 271 |
"</text>\n",
|
| 272 |
"\n",
|
| 273 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 274 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3725\">nature</tspan>\n",
|
| 275 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3725\">NOUN</tspan>\n",
|
| 276 |
"</text>\n",
|
| 277 |
"\n",
|
| 278 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 279 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"3900\">’s</tspan>\n",
|
| 280 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"3900\">PART</tspan>\n",
|
| 281 |
"</text>\n",
|
| 282 |
"\n",
|
| 283 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 284 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"4075\">God</tspan>\n",
|
| 285 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"4075\">PROPN</tspan>\n",
|
| 286 |
"</text>\n",
|
| 287 |
"\n",
|
| 288 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 289 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"4250\">entitle</tspan>\n",
|
| 290 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"4250\">VERB</tspan>\n",
|
| 291 |
"</text>\n",
|
| 292 |
"\n",
|
| 293 |
+
"<text class=\"displacy-token\" fill=\"currentColor\" text-anchor=\"middle\" y=\"572.0\">\n",
|
| 294 |
+
" <tspan class=\"displacy-word\" fill=\"currentColor\" x=\"4425\">them</tspan>\n",
|
| 295 |
+
" <tspan class=\"displacy-tag\" dy=\"2em\" fill=\"currentColor\" x=\"4425\">PRON</tspan>\n",
|
| 296 |
"</text>\n",
|
| 297 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
"<g class=\"displacy-arrow\">\n",
|
| 299 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-0\" stroke-width=\"2px\" d=\"M70,527.0 C70,439.5 200.0,439.5 200.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 300 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 301 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-0\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">comp</textPath>\n",
|
| 302 |
" </text>\n",
|
| 303 |
+
" <path class=\"displacy-arrowhead\" d=\"M200.0,529.0 L208.0,517.0 192.0,517.0\" fill=\"currentColor\"/>\n",
|
| 304 |
"</g>\n",
|
| 305 |
"\n",
|
| 306 |
"<g class=\"displacy-arrow\">\n",
|
| 307 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-1\" stroke-width=\"2px\" d=\"M245,527.0 C245,439.5 375.0,439.5 375.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 308 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 309 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-1\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">udep</textPath>\n",
|
| 310 |
" </text>\n",
|
| 311 |
+
" <path class=\"displacy-arrowhead\" d=\"M375.0,529.0 L383.0,517.0 367.0,517.0\" fill=\"currentColor\"/>\n",
|
| 312 |
"</g>\n",
|
| 313 |
"\n",
|
| 314 |
"<g class=\"displacy-arrow\">\n",
|
| 315 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-2\" stroke-width=\"2px\" d=\"M595,527.0 C595,439.5 725.0,439.5 725.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 316 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 317 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-2\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">det</textPath>\n",
|
| 318 |
" </text>\n",
|
| 319 |
+
" <path class=\"displacy-arrowhead\" d=\"M595,529.0 L587,517.0 603,517.0\" fill=\"currentColor\"/>\n",
|
| 320 |
"</g>\n",
|
| 321 |
"\n",
|
| 322 |
"<g class=\"displacy-arrow\">\n",
|
| 323 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-3\" stroke-width=\"2px\" d=\"M420,527.0 C420,352.0 730.0,352.0 730.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 324 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 325 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-3\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">comp</textPath>\n",
|
| 326 |
" </text>\n",
|
| 327 |
+
" <path class=\"displacy-arrowhead\" d=\"M730.0,529.0 L738.0,517.0 722.0,517.0\" fill=\"currentColor\"/>\n",
|
| 328 |
"</g>\n",
|
| 329 |
"\n",
|
| 330 |
"<g class=\"displacy-arrow\">\n",
|
| 331 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-4\" stroke-width=\"2px\" d=\"M770,527.0 C770,439.5 900.0,439.5 900.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 332 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 333 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-4\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">udep</textPath>\n",
|
| 334 |
" </text>\n",
|
| 335 |
+
" <path class=\"displacy-arrowhead\" d=\"M900.0,529.0 L908.0,517.0 892.0,517.0\" fill=\"currentColor\"/>\n",
|
| 336 |
"</g>\n",
|
| 337 |
"\n",
|
| 338 |
"<g class=\"displacy-arrow\">\n",
|
| 339 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-5\" stroke-width=\"2px\" d=\"M1120,527.0 C1120,439.5 1250.0,439.5 1250.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 340 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 341 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-5\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">det</textPath>\n",
|
| 342 |
" </text>\n",
|
| 343 |
+
" <path class=\"displacy-arrowhead\" d=\"M1120,529.0 L1112,517.0 1128,517.0\" fill=\"currentColor\"/>\n",
|
| 344 |
"</g>\n",
|
| 345 |
"\n",
|
| 346 |
"<g class=\"displacy-arrow\">\n",
|
| 347 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-6\" stroke-width=\"2px\" d=\"M945,527.0 C945,352.0 1255.0,352.0 1255.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 348 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 349 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-6\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">comp</textPath>\n",
|
| 350 |
" </text>\n",
|
| 351 |
+
" <path class=\"displacy-arrowhead\" d=\"M1255.0,529.0 L1263.0,517.0 1247.0,517.0\" fill=\"currentColor\"/>\n",
|
| 352 |
"</g>\n",
|
| 353 |
"\n",
|
| 354 |
"<g class=\"displacy-arrow\">\n",
|
| 355 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-7\" stroke-width=\"2px\" d=\"M1470,527.0 C1470,177.0 2140.0,177.0 2140.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 356 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 357 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-7\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">det</textPath>\n",
|
| 358 |
" </text>\n",
|
| 359 |
+
" <path class=\"displacy-arrowhead\" d=\"M1470,529.0 L1462,517.0 1478,517.0\" fill=\"currentColor\"/>\n",
|
| 360 |
"</g>\n",
|
| 361 |
"\n",
|
| 362 |
"<g class=\"displacy-arrow\">\n",
|
| 363 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-8\" stroke-width=\"2px\" d=\"M1645,527.0 C1645,264.5 2135.0,264.5 2135.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 364 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 365 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-8\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">udep</textPath>\n",
|
| 366 |
" </text>\n",
|
| 367 |
+
" <path class=\"displacy-arrowhead\" d=\"M1645,529.0 L1637,517.0 1653,517.0\" fill=\"currentColor\"/>\n",
|
| 368 |
"</g>\n",
|
| 369 |
"\n",
|
| 370 |
"<g class=\"displacy-arrow\">\n",
|
| 371 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-9\" stroke-width=\"2px\" d=\"M1645,527.0 C1645,439.5 1775.0,439.5 1775.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 372 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 373 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-9\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">cc</textPath>\n",
|
| 374 |
" </text>\n",
|
| 375 |
+
" <path class=\"displacy-arrowhead\" d=\"M1775.0,529.0 L1783.0,517.0 1767.0,517.0\" fill=\"currentColor\"/>\n",
|
| 376 |
"</g>\n",
|
| 377 |
"\n",
|
| 378 |
"<g class=\"displacy-arrow\">\n",
|
| 379 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-10\" stroke-width=\"2px\" d=\"M1645,527.0 C1645,352.0 1955.0,352.0 1955.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 380 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 381 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-10\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">conj</textPath>\n",
|
| 382 |
" </text>\n",
|
| 383 |
+
" <path class=\"displacy-arrowhead\" d=\"M1955.0,529.0 L1963.0,517.0 1947.0,517.0\" fill=\"currentColor\"/>\n",
|
| 384 |
"</g>\n",
|
| 385 |
"\n",
|
| 386 |
"<g class=\"displacy-arrow\">\n",
|
| 387 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-11\" stroke-width=\"2px\" d=\"M245,527.0 C245,89.5 2145.0,89.5 2145.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 388 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 389 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-11\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">comp</textPath>\n",
|
| 390 |
" </text>\n",
|
| 391 |
+
" <path class=\"displacy-arrowhead\" d=\"M2145.0,529.0 L2153.0,517.0 2137.0,517.0\" fill=\"currentColor\"/>\n",
|
| 392 |
"</g>\n",
|
| 393 |
"\n",
|
| 394 |
"<g class=\"displacy-arrow\">\n",
|
| 395 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-12\" stroke-width=\"2px\" d=\"M2345,527.0 C2345,352.0 2830.0,352.0 2830.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 396 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 397 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-12\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">udep</textPath>\n",
|
| 398 |
" </text>\n",
|
| 399 |
+
" <path class=\"displacy-arrowhead\" d=\"M2345,529.0 L2337,517.0 2353,517.0\" fill=\"currentColor\"/>\n",
|
| 400 |
"</g>\n",
|
| 401 |
"\n",
|
| 402 |
"<g class=\"displacy-arrow\">\n",
|
| 403 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-13\" stroke-width=\"2px\" d=\"M2345,527.0 C2345,439.5 2475.0,439.5 2475.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 404 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 405 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-13\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">comp</textPath>\n",
|
| 406 |
" </text>\n",
|
| 407 |
+
" <path class=\"displacy-arrowhead\" d=\"M2475.0,529.0 L2483.0,517.0 2467.0,517.0\" fill=\"currentColor\"/>\n",
|
| 408 |
"</g>\n",
|
| 409 |
"\n",
|
| 410 |
"<g class=\"displacy-arrow\">\n",
|
| 411 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-14\" stroke-width=\"2px\" d=\"M2695,527.0 C2695,439.5 2825.0,439.5 2825.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 412 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 413 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-14\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">det</textPath>\n",
|
| 414 |
" </text>\n",
|
| 415 |
+
" <path class=\"displacy-arrowhead\" d=\"M2695,529.0 L2687,517.0 2703,517.0\" fill=\"currentColor\"/>\n",
|
| 416 |
"</g>\n",
|
| 417 |
"\n",
|
| 418 |
"<g class=\"displacy-arrow\">\n",
|
| 419 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-15\" stroke-width=\"2px\" d=\"M2170,527.0 C2170,264.5 2835.0,264.5 2835.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 420 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 421 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-15\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">mod</textPath>\n",
|
| 422 |
" </text>\n",
|
| 423 |
+
" <path class=\"displacy-arrowhead\" d=\"M2835.0,529.0 L2843.0,517.0 2827.0,517.0\" fill=\"currentColor\"/>\n",
|
| 424 |
"</g>\n",
|
| 425 |
"\n",
|
| 426 |
"<g class=\"displacy-arrow\">\n",
|
| 427 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-16\" stroke-width=\"2px\" d=\"M2870,527.0 C2870,439.5 3000.0,439.5 3000.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 428 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 429 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-16\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">udep</textPath>\n",
|
| 430 |
" </text>\n",
|
| 431 |
+
" <path class=\"displacy-arrowhead\" d=\"M3000.0,529.0 L3008.0,517.0 2992.0,517.0\" fill=\"currentColor\"/>\n",
|
| 432 |
"</g>\n",
|
| 433 |
"\n",
|
| 434 |
"<g class=\"displacy-arrow\">\n",
|
| 435 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-17\" stroke-width=\"2px\" d=\"M3045,527.0 C3045,439.5 3175.0,439.5 3175.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 436 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 437 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-17\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">comp</textPath>\n",
|
| 438 |
" </text>\n",
|
| 439 |
+
" <path class=\"displacy-arrowhead\" d=\"M3175.0,529.0 L3183.0,517.0 3167.0,517.0\" fill=\"currentColor\"/>\n",
|
| 440 |
"</g>\n",
|
| 441 |
"\n",
|
| 442 |
"<g class=\"displacy-arrow\">\n",
|
| 443 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-18\" stroke-width=\"2px\" d=\"M2870,527.0 C2870,352.0 3355.0,352.0 3355.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 444 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 445 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-18\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">cc</textPath>\n",
|
| 446 |
" </text>\n",
|
| 447 |
+
" <path class=\"displacy-arrowhead\" d=\"M3355.0,529.0 L3363.0,517.0 3347.0,517.0\" fill=\"currentColor\"/>\n",
|
| 448 |
"</g>\n",
|
| 449 |
"\n",
|
| 450 |
"<g class=\"displacy-arrow\">\n",
|
| 451 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-19\" stroke-width=\"2px\" d=\"M2870,527.0 C2870,264.5 3535.0,264.5 3535.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 452 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 453 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-19\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">udep</textPath>\n",
|
| 454 |
" </text>\n",
|
| 455 |
+
" <path class=\"displacy-arrowhead\" d=\"M3535.0,529.0 L3543.0,517.0 3527.0,517.0\" fill=\"currentColor\"/>\n",
|
| 456 |
"</g>\n",
|
| 457 |
"\n",
|
| 458 |
"<g class=\"displacy-arrow\">\n",
|
| 459 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-20\" stroke-width=\"2px\" d=\"M3570,527.0 C3570,439.5 3700.0,439.5 3700.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 460 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 461 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-20\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">comp</textPath>\n",
|
| 462 |
" </text>\n",
|
| 463 |
+
" <path class=\"displacy-arrowhead\" d=\"M3700.0,529.0 L3708.0,517.0 3692.0,517.0\" fill=\"currentColor\"/>\n",
|
| 464 |
"</g>\n",
|
| 465 |
"\n",
|
| 466 |
"<g class=\"displacy-arrow\">\n",
|
| 467 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-21\" stroke-width=\"2px\" d=\"M245,527.0 C245,2.0 3900.0,2.0 3900.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 468 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 469 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-21\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">punct</textPath>\n",
|
| 470 |
" </text>\n",
|
| 471 |
+
" <path class=\"displacy-arrowhead\" d=\"M3900.0,529.0 L3908.0,517.0 3892.0,517.0\" fill=\"currentColor\"/>\n",
|
| 472 |
"</g>\n",
|
| 473 |
"\n",
|
| 474 |
"<g class=\"displacy-arrow\">\n",
|
| 475 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-22\" stroke-width=\"2px\" d=\"M4095,527.0 C4095,439.5 4225.0,439.5 4225.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 476 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 477 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-22\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">subj</textPath>\n",
|
| 478 |
" </text>\n",
|
| 479 |
+
" <path class=\"displacy-arrowhead\" d=\"M4095,529.0 L4087,517.0 4103,517.0\" fill=\"currentColor\"/>\n",
|
| 480 |
"</g>\n",
|
| 481 |
"\n",
|
| 482 |
"<g class=\"displacy-arrow\">\n",
|
| 483 |
+
" <path class=\"displacy-arc\" id=\"arrow-9f58d58c7a8540688553bdb828bd211d-0-23\" stroke-width=\"2px\" d=\"M4270,527.0 C4270,439.5 4400.0,439.5 4400.0,527.0\" fill=\"none\" stroke=\"currentColor\"/>\n",
|
| 484 |
" <text dy=\"1.25em\" style=\"font-size: 0.8em; letter-spacing: 1px\">\n",
|
| 485 |
+
" <textPath xlink:href=\"#arrow-9f58d58c7a8540688553bdb828bd211d-0-23\" class=\"displacy-label\" startOffset=\"50%\" side=\"left\" fill=\"currentColor\" text-anchor=\"middle\">comp</textPath>\n",
|
| 486 |
" </text>\n",
|
| 487 |
+
" <path class=\"displacy-arrowhead\" d=\"M4400.0,529.0 L4408.0,517.0 4392.0,517.0\" fill=\"currentColor\"/>\n",
|
| 488 |
"</g>\n",
|
| 489 |
"</svg></span>"
|
| 490 |
],
|
|
|
|
| 497 |
}
|
| 498 |
],
|
| 499 |
"source": [
|
| 500 |
+
"doc = ssudify(nlp(\"to assume, among the powers of the earth, the separate and equal station to which the laws of nature and of nature’s God entitle them\"))\n",
|
| 501 |
"# Since this is an interactive Jupyter environment, we can use displacy.render here\n",
|
| 502 |
"displacy.render(doc, style='dep')"
|
| 503 |
]
|
|
|
|
| 511 |
{
|
| 512 |
"data": {
|
| 513 |
"text/plain": [
|
| 514 |
+
"[(Males have a bony protrusion from the gill area (the opercular process) that is,\n",
|
| 515 |
+
" 0),\n",
|
| 516 |
+
" (elongated and club-, 4),\n",
|
| 517 |
+
" (like, a feature that inspired the name of the species, 0)]"
|
| 518 |
]
|
| 519 |
},
|
| 520 |
"execution_count": 7,
|
main.py
CHANGED
|
@@ -32,7 +32,7 @@ def ssudify(doc):
|
|
| 32 |
to_reverse[i-1].dep_ = "comp"
|
| 33 |
for token in doc:
|
| 34 |
if token.dep_ == "dep": token.dep_ = "unknown"
|
| 35 |
-
if token.dep_ == "prep" and token.head.pos_ == "VERB" and token.i < token.head.i:
|
| 36 |
token.dep_ = "mod"
|
| 37 |
if token.dep_ == "ccomp" and any(sibling.dep_ in relations["comp"]
|
| 38 |
for sibling in token.head.rights if sibling.i < token.i):
|
|
@@ -53,7 +53,7 @@ def ssudify(doc):
|
|
| 53 |
subject = [child for child in token.children if child.dep_ == "subj"]
|
| 54 |
if subject:
|
| 55 |
for child in [c for c in token.children if c.i < subject[0].i]:
|
| 56 |
-
if child.dep_ in ["comp", "udep"]:
|
| 57 |
child.dep_ = "mod"
|
| 58 |
for token in doc:
|
| 59 |
if any(t.text == ";" for t in doc if (token.i < t.i < token.head.i or token.head.i < t.i < token.i) and token.pos_ != "PUNCT"):
|
|
|
|
| 32 |
to_reverse[i-1].dep_ = "comp"
|
| 33 |
for token in doc:
|
| 34 |
if token.dep_ == "dep": token.dep_ = "unknown"
|
| 35 |
+
if token.dep_ == "prep" and token.head.pos_ == "VERB" and token.i < token.head.i and token.head.dep_ not in relations["mod"]:
|
| 36 |
token.dep_ = "mod"
|
| 37 |
if token.dep_ == "ccomp" and any(sibling.dep_ in relations["comp"]
|
| 38 |
for sibling in token.head.rights if sibling.i < token.i):
|
|
|
|
| 53 |
subject = [child for child in token.children if child.dep_ == "subj"]
|
| 54 |
if subject:
|
| 55 |
for child in [c for c in token.children if c.i < subject[0].i]:
|
| 56 |
+
if child.dep_ in ["comp", "udep"] and token.dep_ != "mod":
|
| 57 |
child.dep_ = "mod"
|
| 58 |
for token in doc:
|
| 59 |
if any(t.text == ";" for t in doc if (token.i < t.i < token.head.i or token.head.i < t.i < token.i) and token.pos_ != "PUNCT"):
|