Skip to content

Instantly share code, notes, and snippets.

@erip
Created December 30, 2019 19:14
Show Gist options
  • Save erip/82869875762d67893937a93320fb055f to your computer and use it in GitHub Desktop.
Save erip/82869875762d67893937a93320fb055f to your computer and use it in GitHub Desktop.
RTL issue with displaCy
<!DOCTYPE html>
<html lang="fa">
<head>
<title>displaCy</title>
</head>
<body style="font-size: 16px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; padding: 4rem 2rem; direction: rtl">
<figure style="margin-bottom: 6rem">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="fa" id="6cc1af9f34a64a4592fa784da0aa419f-0" class="displacy" width="3650" height="887.0" direction="rtl" style="max-width: none; height: 887.0px; color: #000000; background: #ffffff; font-family: Arial; direction: rtl">
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="3600">آمریکا</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="3600">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="3450">شامگاه</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="3450">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="3300">یکشنبه</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="3300">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="3150">اعلام</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="3150">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="3000">کرد</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="3000">VERB</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="2850">که</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="2850">CONJ</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="2700">پنج</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="2700">NUM</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="2550">مقر</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="2550">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="2400">کتائب</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="2400">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="2250">حزب‌الله</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="2250">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="2100">عراق</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="2100">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="1950">را</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="1950">PART</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="1800">در</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="1800">ADP</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="1650">عراق</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="1650">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="1500">و</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="1500">CONJ</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="1350">سوریه</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="1350">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="1200">و</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="1200">CONJ</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="1050">در</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="1050">ADP</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="900">اقدامی &quot;</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="900">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="750">دفاعی&quot;</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="750">ADJ</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="600">هدف</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="600">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="450">قرار</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="450">NOUN</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="300">داده</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="300">VERB</tspan>
</text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0">
<tspan class="displacy-word" fill="currentColor" x="150">است.</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="150">VERB</tspan>
</text>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-0" stroke-width="2px" d="M3588,752.0 3588,652.0 3018.0,652.0 3018.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-0" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">nsubj</textPath>
</text>
<path class="displacy-arrowhead" d="M3588,754.0 L3584,746.0 3592,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-1" stroke-width="2px" d="M3438,752.0 3438,677.0 3021.0,677.0 3021.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-1" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">advmod</textPath>
</text>
<path class="displacy-arrowhead" d="M3438,754.0 L3434,746.0 3442,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-2" stroke-width="2px" d="M3438,752.0 3438,727.0 3327.0,727.0 3327.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-2" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">flat</textPath>
</text>
<path class="displacy-arrowhead" d="M3327.0,754.0 L3331.0,746.0 3323.0,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-3" stroke-width="2px" d="M3138,752.0 3138,727.0 3027.0,727.0 3027.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-3" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">compound:lvc</textPath>
</text>
<path class="displacy-arrowhead" d="M3138,754.0 L3134,746.0 3142,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-4" stroke-width="2px" d="M2838,752.0 2838,527.0 303.0,527.0 303.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-4" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">mark</textPath>
</text>
<path class="displacy-arrowhead" d="M2838,754.0 L2834,746.0 2842,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-5" stroke-width="2px" d="M2688,752.0 2688,727.0 2577.0,727.0 2577.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-5" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">nummod</textPath>
</text>
<path class="displacy-arrowhead" d="M2688,754.0 L2684,746.0 2692,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-6" stroke-width="2px" d="M2538,752.0 2538,552.0 306.0,552.0 306.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-6" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">nsubj</textPath>
</text>
<path class="displacy-arrowhead" d="M2538,754.0 L2534,746.0 2542,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-7" stroke-width="2px" d="M2538,752.0 2538,727.0 2427.0,727.0 2427.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-7" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">nmod:poss</textPath>
</text>
<path class="displacy-arrowhead" d="M2427.0,754.0 L2431.0,746.0 2423.0,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-8" stroke-width="2px" d="M2238,752.0 2238,577.0 309.0,577.0 309.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-8" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">obj</textPath>
</text>
<path class="displacy-arrowhead" d="M2238,754.0 L2234,746.0 2242,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-9" stroke-width="2px" d="M2238,752.0 2238,727.0 2127.0,727.0 2127.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-9" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">nmod:poss</textPath>
</text>
<path class="displacy-arrowhead" d="M2127.0,754.0 L2131.0,746.0 2123.0,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-10" stroke-width="2px" d="M2238,752.0 2238,702.0 1974.0,702.0 1974.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-10" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">case</textPath>
</text>
<path class="displacy-arrowhead" d="M1974.0,754.0 L1978.0,746.0 1970.0,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-11" stroke-width="2px" d="M1788,752.0 1788,727.0 1677.0,727.0 1677.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-11" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">case</textPath>
</text>
<path class="displacy-arrowhead" d="M1788,754.0 L1784,746.0 1792,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-12" stroke-width="2px" d="M1638,752.0 1638,602.0 312.0,602.0 312.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-12" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">obl</textPath>
</text>
<path class="displacy-arrowhead" d="M1638,754.0 L1634,746.0 1642,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-13" stroke-width="2px" d="M1488,752.0 1488,727.0 1377.0,727.0 1377.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-13" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">cc</textPath>
</text>
<path class="displacy-arrowhead" d="M1488,754.0 L1484,746.0 1492,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-14" stroke-width="2px" d="M1638,752.0 1638,702.0 1374.0,702.0 1374.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-14" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">conj</textPath>
</text>
<path class="displacy-arrowhead" d="M1374.0,754.0 L1378.0,746.0 1370.0,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-15" stroke-width="2px" d="M1188,752.0 1188,702.0 924.0,702.0 924.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-15" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">cc</textPath>
</text>
<path class="displacy-arrowhead" d="M1188,754.0 L1184,746.0 1192,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-16" stroke-width="2px" d="M1038,752.0 1038,727.0 927.0,727.0 927.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-16" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">case</textPath>
</text>
<path class="displacy-arrowhead" d="M1038,754.0 L1034,746.0 1042,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-17" stroke-width="2px" d="M1788,752.0 1788,627.0 915.0,627.0 915.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-17" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">conj</textPath>
</text>
<path class="displacy-arrowhead" d="M915.0,754.0 L919.0,746.0 911.0,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-18" stroke-width="2px" d="M888,752.0 888,727.0 777.0,727.0 777.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-18" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">amod</textPath>
</text>
<path class="displacy-arrowhead" d="M777.0,754.0 L781.0,746.0 773.0,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-19" stroke-width="2px" d="M888,752.0 888,702.0 624.0,702.0 624.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-19" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">nmod:poss</textPath>
</text>
<path class="displacy-arrowhead" d="M624.0,754.0 L628.0,746.0 620.0,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-20" stroke-width="2px" d="M438,752.0 438,727.0 327.0,727.0 327.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-20" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">compound:lvc</textPath>
</text>
<path class="displacy-arrowhead" d="M438,754.0 L434,746.0 442,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-21" stroke-width="2px" d="M2988,752.0 2988,502.0 300.0,502.0 300.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-21" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">ccomp</textPath>
</text>
<path class="displacy-arrowhead" d="M300.0,754.0 L304.0,746.0 296.0,746.0" fill="currentColor"/>
</g>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-6cc1af9f34a64a4592fa784da0aa419f-0-22" stroke-width="2px" d="M288,752.0 288,727.0 177.0,727.0 177.0,752.0" fill="none" stroke="currentColor"/>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-6cc1af9f34a64a4592fa784da0aa419f-0-22" class="displacy-label" startOffset="50%" side="right" fill="currentColor" text-anchor="middle">aux</textPath>
</text>
<path class="displacy-arrowhead" d="M177.0,754.0 L181.0,746.0 173.0,746.0" fill="currentColor"/>
</g>
</svg>
</figure>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment