|
4601 | 4601 | " <td>King Arthur</td>\n",
|
4602 | 4602 | " </tr>\n",
|
4603 | 4603 | "\n",
|
| 4604 | + " </tbody>\n", |
| 4605 | + " </table>\n", |
| 4606 | + " <p style='\n", |
| 4607 | + " padding: 1em;\n", |
| 4608 | + " line-height: calc(var(--jp-content-line-height, 1.6) * 1.6);\n", |
| 4609 | + " '>\n", |
| 4610 | + "\n", |
| 4611 | + " In AD 932, \n", |
| 4612 | + "\n", |
| 4613 | + " <span class='mark btn-primary' style='padding:0.4em;border-radius:0.35em;background-color: #a0c4ff;color:black;'>King Arthur</span>\n", |
| 4614 | + " and his squire, Patsy, travel throughout Britain searching for men to join the Knights of the Round Table. Along the way, he recruits Sir Bedevere the Wise, Sir Lancelot the Brave, Sir Galahad the Pure, Sir Robin the Not-Quite-So-Brave-as-Sir-Lancelot, and Sir Not-Appearing-in-this-Film, along with their squires and Robin's troubadours.\n", |
| 4615 | + " </p>\n", |
| 4616 | + " </div>\n", |
| 4617 | + "\n", |
| 4618 | + " <div class='document'>\n", |
| 4619 | + " <table style='\n", |
| 4620 | + " table-layout: auto;\n", |
| 4621 | + " overflow: hidden;\n", |
| 4622 | + " width: 100%;\n", |
| 4623 | + " border-collapse: collapse;\n", |
| 4624 | + " '>\n", |
| 4625 | + " <thead style='font-variant-caps: all-petite-caps;'>\n", |
| 4626 | + " <th></th>\n", |
| 4627 | + " <th>begin</th>\n", |
| 4628 | + " <th>end</th>\n", |
| 4629 | + " <th style='text-align:right;width:100%'>context</th>\n", |
| 4630 | + " </tr></thead>\n", |
| 4631 | + " <tbody>\n", |
| 4632 | + "\n", |
4604 | 4633 | " <tr>\n",
|
4605 |
| - " <td><b>1</b></td>\n", |
| 4634 | + " <td><b>0</b></td>\n", |
4606 | 4635 | " <td>0</td>\n",
|
4607 | 4636 | " <td>15</td>\n",
|
4608 |
| - " <td>In AD 932, King</td>\n", |
| 4637 | + " <td>Second document</td>\n", |
4609 | 4638 | " </tr>\n",
|
4610 | 4639 | "\n",
|
4611 | 4640 | " </tbody>\n",
|
|
4615 | 4644 | " line-height: calc(var(--jp-content-line-height, 1.6) * 1.6);\n",
|
4616 | 4645 | " '>\n",
|
4617 | 4646 | "\n",
|
4618 |
| - " In AD 932, \n", |
4619 |
| - "\n", |
4620 |
| - " <span class='mark btn-primary' style='padding:0.4em;border-radius:0.35em;background-color: #a0c4ff;color:black;'>King Arthur</span>\n", |
4621 | 4647 | "\n",
|
4622 | 4648 | "\n",
|
| 4649 | + " <span class='mark btn-primary' style='padding:0.4em;border-radius:0.35em;background-color: #a0c4ff;color:black;'>Second document</span>\n", |
4623 | 4650 | "\n",
|
4624 |
| - " <span class='mark btn-info complex-set' style='\n", |
4625 |
| - " padding:0.4em;\n", |
4626 |
| - " border-radius:0.35em;\n", |
4627 |
| - " background:linear-gradient(to right, #a0c4ff, #ffadad);\n", |
4628 |
| - " color: black;\n", |
4629 |
| - " '>In AD 932, King Arthur\n", |
4630 |
| - " <span class='mark-tag' style='\n", |
4631 |
| - " font-weight: bolder;\n", |
4632 |
| - " font-size: 0.8em;\n", |
4633 |
| - " font-variant: small-caps;\n", |
4634 |
| - " font-variant-caps: small-caps;\n", |
4635 |
| - " font-variant-caps: all-small-caps;\n", |
4636 |
| - " margin-left: 8px;\n", |
4637 |
| - " text-transform: uppercase;\n", |
4638 |
| - " color: black;\n", |
4639 |
| - " '>Set</span>\n", |
4640 |
| - " </span>\n", |
4641 |
| - " and his squire, Patsy, travel throughout Britain searching for men to join the Knights of the Round Table. Along the way, he recruits Sir Bedevere the Wise, Sir Lancelot the Brave, Sir Galahad the Pure, Sir Robin the Not-Quite-So-Brave-as-Sir-Lancelot, and Sir Not-Appearing-in-this-Film, along with their squires and Robin's troubadours.\n", |
4642 | 4651 | " </p>\n",
|
4643 | 4652 | " </div>\n",
|
4644 | 4653 | "\n",
|
|
4651 | 4660 | " const documents = []\n",
|
4652 | 4661 | "\n",
|
4653 | 4662 | " {\n",
|
4654 |
| - " const doc_spans = Span.arrayFromSpanArray([[11,22],[0,15]])\n", |
| 4663 | + " const doc_spans = Span.arrayFromSpanArray([[11,22]])\n", |
4655 | 4664 | " const doc_text = 'In AD 932, King Arthur and his squire, Patsy, travel throughout Britain searching for men to join the Knights of the Round Table. Along the way, he recruits Sir Bedevere the Wise, Sir Lancelot the Brave, Sir Galahad the Pure, Sir Robin the Not-Quite-So-Brave-as-Sir-Lancelot, and Sir Not-Appearing-in-this-Film, along with their squires and Robin\\'s troubadours.'\n",
|
4656 | 4665 | " documents.push({doc_text: doc_text, doc_spans: doc_spans})\n",
|
4657 | 4666 | " }\n",
|
4658 | 4667 | "\n",
|
| 4668 | + " {\n", |
| 4669 | + " const doc_spans = Span.arrayFromSpanArray([[0,15]])\n", |
| 4670 | + " const doc_text = 'Second document'\n", |
| 4671 | + " documents.push({doc_text: doc_text, doc_spans: doc_spans})\n", |
| 4672 | + " }\n", |
| 4673 | + "\n", |
4659 | 4674 | " const instance = new window.SpanArray.SpanArray(documents, true, script_context)\n",
|
4660 | 4675 | " instance.render()\n",
|
4661 | 4676 | " }\n",
|
|
5057 | 5072 | " [4, 5],\n",
|
5058 | 5073 | " [6, 7],\n",
|
5059 | 5074 | " [8, 9]]),\n",
|
5060 |
| - " <text_extensions_for_pandas.array.tensor.TensorDtype at 0x7fb59860c3a0>)" |
| 5075 | + " <text_extensions_for_pandas.array.tensor.TensorDtype at 0x7f9ae00cadc0>)" |
5061 | 5076 | ]
|
5062 | 5077 | },
|
5063 | 5078 | "execution_count": 22,
|
|
5438 | 5453 | " <tr>\n",
|
5439 | 5454 | " <th>0</th>\n",
|
5440 | 5455 | " <td>[0, 2): 'In'</td>\n",
|
5441 |
| - " <td>[1, 0, 0, 0]</td>\n", |
| 5456 | + " <td>[0, 0, 0, 1]</td>\n", |
5442 | 5457 | " </tr>\n",
|
5443 | 5458 | " <tr>\n",
|
5444 | 5459 | " <th>1</th>\n",
|
5445 | 5460 | " <td>[3, 5): 'AD'</td>\n",
|
5446 |
| - " <td>[0, 1, 0, 0]</td>\n", |
| 5461 | + " <td>[0, 0, 0, 1]</td>\n", |
5447 | 5462 | " </tr>\n",
|
5448 | 5463 | " <tr>\n",
|
5449 | 5464 | " <th>2</th>\n",
|
5450 | 5465 | " <td>[6, 9): '932'</td>\n",
|
5451 |
| - " <td>[1, 0, 0, 0]</td>\n", |
| 5466 | + " <td>[0, 1, 0, 0]</td>\n", |
5452 | 5467 | " </tr>\n",
|
5453 | 5468 | " <tr>\n",
|
5454 | 5469 | " <th>3</th>\n",
|
|
5458 | 5473 | " <tr>\n",
|
5459 | 5474 | " <th>4</th>\n",
|
5460 | 5475 | " <td>[16, 22): 'Arthur'</td>\n",
|
5461 |
| - " <td>[0, 0, 1, 0]</td>\n", |
| 5476 | + " <td>[0, 1, 0, 0]</td>\n", |
5462 | 5477 | " </tr>\n",
|
5463 | 5478 | " </tbody>\n",
|
5464 | 5479 | "</table>\n",
|
5465 | 5480 | "</div>"
|
5466 | 5481 | ],
|
5467 | 5482 | "text/plain": [
|
5468 | 5483 | " span features\n",
|
5469 |
| - "0 [0, 2): 'In' [1, 0, 0, 0]\n", |
5470 |
| - "1 [3, 5): 'AD' [0, 1, 0, 0]\n", |
5471 |
| - "2 [6, 9): '932' [1, 0, 0, 0]\n", |
| 5484 | + "0 [0, 2): 'In' [0, 0, 0, 1]\n", |
| 5485 | + "1 [3, 5): 'AD' [0, 0, 0, 1]\n", |
| 5486 | + "2 [6, 9): '932' [0, 1, 0, 0]\n", |
5472 | 5487 | "3 [11, 15): 'King' [1, 0, 0, 0]\n",
|
5473 |
| - "4 [16, 22): 'Arthur' [0, 0, 1, 0]" |
| 5488 | + "4 [16, 22): 'Arthur' [0, 1, 0, 0]" |
5474 | 5489 | ]
|
5475 | 5490 | },
|
5476 | 5491 | "execution_count": 32,
|
|
5530 | 5545 | " <tr>\n",
|
5531 | 5546 | " <th>0</th>\n",
|
5532 | 5547 | " <td>[0, 2): 'In'</td>\n",
|
5533 |
| - " <td>[1, 0, 0, 0]</td>\n", |
| 5548 | + " <td>[0, 0, 0, 1]</td>\n", |
5534 | 5549 | " </tr>\n",
|
5535 | 5550 | " <tr>\n",
|
5536 | 5551 | " <th>1</th>\n",
|
5537 | 5552 | " <td>[3, 5): 'AD'</td>\n",
|
5538 |
| - " <td>[0, 1, 0, 0]</td>\n", |
| 5553 | + " <td>[0, 0, 0, 1]</td>\n", |
5539 | 5554 | " </tr>\n",
|
5540 | 5555 | " <tr>\n",
|
5541 | 5556 | " <th>2</th>\n",
|
5542 | 5557 | " <td>[6, 9): '932'</td>\n",
|
5543 |
| - " <td>[1, 0, 0, 0]</td>\n", |
| 5558 | + " <td>[0, 1, 0, 0]</td>\n", |
5544 | 5559 | " </tr>\n",
|
5545 | 5560 | " <tr>\n",
|
5546 | 5561 | " <th>3</th>\n",
|
|
5550 | 5565 | " <tr>\n",
|
5551 | 5566 | " <th>4</th>\n",
|
5552 | 5567 | " <td>[16, 22): 'Arthur'</td>\n",
|
5553 |
| - " <td>[0, 0, 1, 0]</td>\n", |
| 5568 | + " <td>[0, 1, 0, 0]</td>\n", |
5554 | 5569 | " </tr>\n",
|
5555 | 5570 | " </tbody>\n",
|
5556 | 5571 | "</table>\n",
|
5557 | 5572 | "</div>"
|
5558 | 5573 | ],
|
5559 | 5574 | "text/plain": [
|
5560 | 5575 | " span features\n",
|
5561 |
| - "0 [0, 2): 'In' [1, 0, 0, 0]\n", |
5562 |
| - "1 [3, 5): 'AD' [0, 1, 0, 0]\n", |
5563 |
| - "2 [6, 9): '932' [1, 0, 0, 0]\n", |
| 5576 | + "0 [0, 2): 'In' [0, 0, 0, 1]\n", |
| 5577 | + "1 [3, 5): 'AD' [0, 0, 0, 1]\n", |
| 5578 | + "2 [6, 9): '932' [0, 1, 0, 0]\n", |
5564 | 5579 | "3 [11, 15): 'King' [1, 0, 0, 0]\n",
|
5565 |
| - "4 [16, 22): 'Arthur' [0, 0, 1, 0]" |
| 5580 | + "4 [16, 22): 'Arthur' [0, 1, 0, 0]" |
5566 | 5581 | ]
|
5567 | 5582 | },
|
5568 | 5583 | "execution_count": 34,
|
|
5613 | 5628 | ],
|
5614 | 5629 | "metadata": {
|
5615 | 5630 | "kernelspec": {
|
5616 |
| - "display_name": "pd", |
| 5631 | + "display_name": "Python 3", |
5617 | 5632 | "language": "python",
|
5618 |
| - "name": "pd" |
| 5633 | + "name": "python3" |
5619 | 5634 | },
|
5620 | 5635 | "language_info": {
|
5621 | 5636 | "codemirror_mode": {
|
|
0 commit comments