Datasets:

Modalities:
Text
Formats:
parquet
ArXiv:
Libraries:
Datasets
Dask

Seeing some nested SVGs cut off

#1
by darknoon - opened

I was investigating why some svgs in this dataset are failing to parse, and it appears that often the cause is the closing tag </svg> not actually being the end of the document, ie they're clipped. Could this be due to using a regex to remove content surrounding the svg document?

This issue seems to affect ~1% of examples.

Here is one such example:

<svg version="1.1" id="topsvg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:cml="http://www.xml-cml.org/schema" x="0" y="0" width="200px" height="200px" viewBox="0 0 100 100">
<title> - Open Babel Depiction</title>
<rect x="0" y="0" width="100" height="100" fill="white"/>
<g transform="translate(0,0)">
<svg width="100" height="100" x="0" y="0" viewBox="0 0 397.364 410.329"
font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="2"  stroke-linecap="round">
<line x1="175.0" y1="145.5" x2="156.3" y2="177.9" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="83.4" y1="243.5" x2="60.2" y2="251.1" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="45.1" y1="267.8" x2="42.7" y2="279.0" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="83.4" y1="243.5" x2="194.5" y2="188.9" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="193.1" y1="183.1" x2="181.7" y2="183.1" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="123.3" y1="333.1" x2="125.8" y2="357.4" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="247.7" y1="160.0" x2="250.2" y2="184.3" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="241.7" y1="160.6" x2="244.3" y2="184.9" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="285.2" y1="137.9" x2="309.2" y2="143.0" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="306.9" y1="141.0" x2="323.3" y2="122.8" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="311.4" y1="145.0" x2="327.7" y2="126.8" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="309.2" y1="143.0" x2="316.7" y2="166.3" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="333.4" y1="181.3" x2="344.6" y2="183.7" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="257.3" y1="101.0" x2="269.5" y2="79.8" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="184.6" y1="86.5" x2="182.1" y2="62.2" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="190.6" y1="85.9" x2="188.0" y2="61.5" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="147.1" y1="108.5" x2="123.1" y2="103.5" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="125.4" y1="105.5" x2="109.0" y2="123.6" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="120.9" y1="101.4" x2="104.5" y2="119.6" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="123.1" y1="103.5" x2="115.6" y2="80.2" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="120.3" y1="58.2" x2="127.9" y2="49.7" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="111.2" y1="218.4" x2="143.7" y2="237.2" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="120.0" y1="215.2" x2="142.1" y2="227.9" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="143.7" y1="237.2" x2="161.8" y2="220.8" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="166.2" y1="200.2" x2="156.3" y2="177.9" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="156.3" y1="177.9" x2="119.0" y2="181.8" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="151.1" y1="185.7" x2="125.7" y2="188.3" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="119.0" y1="181.8" x2="111.2" y2="218.4" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="123.3" y1="333.1" x2="141.5" y2="316.7" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="145.8" y1="296.1" x2="135.9" y2="273.8" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="135.9" y1="273.8" x2="98.6" y2="277.7" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="130.7" y1="281.6" x2="105.4" y2="284.3" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="98.6" y1="277.7" x2="90.9" y2="314.4" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="90.9" y1="314.4" x2="123.3" y2="333.1" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="99.7" y1="311.1" x2="121.7" y2="323.8" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="244.7" y1="160.3" x2="262.9" y2="143.9" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="267.2" y1="123.3" x2="257.3" y2="101.0" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="257.3" y1="101.0" x2="220.0" y2="104.9" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="252.1" y1="108.8" x2="226.8" y2="111.4" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="220.0" y1="104.9" x2="212.3" y2="141.5" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="212.3" y1="141.5" x2="244.7" y2="160.3" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="220.0" y1="104.9" x2="187.6" y2="86.2" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="187.6" y1="86.2" x2="169.4" y2="102.5" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="165.1" y1="123.1" x2="175.0" y2="145.5" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="175.0" y1="145.5" x2="212.3" y2="141.5" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="180.2" y1="137.7" x2="205.5" y2="135.0" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="135.9" y1="273.8" x2="143.7" y2="237.2" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="111.2" y1="218.4" x2="83.4" y2="243.5" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<line x1="83.4" y1="243.5" x2="98.6" y2="277.7" stroke="rgb(0,0,0)"  stroke-width="2.0"/>
<text x="270.013522" y="76.555644" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
<text x="242.602040" y="205.516526" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
<text x="266.520480" y="143.206861" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
<text x="328.216870" y="123.160489" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
<text x="314.729342" y="186.614316" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
<text x="353.364427" y="194.401344" fill="rgb(102,102,102)"  stroke="rgb(102,102,102)" stroke-width="1" font-size="16" >CH</text>
<text x="377.364427" y="198.081344" fill="rgb(102,102,102)"  stroke="rgb(102,102,102)" stroke-width="1" font-size="13" >3</text>
<text x="177.687724" y="56.931190" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
<text x="153.769284" y="119.240855" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
<text x="92.072894" y="139.287227" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
<text x="105.560421" y="75.833400" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
<text x="132.621727" y="48.000000" fill="rgb(102,102,102)"  stroke="rgb(102,102,102)" stroke-width="1" font-size="16" >CH</text>
<text x="156.621727" y="51.680000" fill="rgb(102,102,102)"  stroke="rgb(102,102,102)" stroke-width="1" font-size="13" >3</text>
<text x="41.787028" y="263.077201" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
<text x="165.509966" y="220.107578" fill="rgb(178,178,0)"  stroke="rgb(178,178,0)" stroke-width="1" font-size="16" >S</text>
<text x="14.000000" y="299.712285" fill="rgb(102,102,102)"  stroke="rgb(102,102,102)" stroke-width="1" font-size="16" >H</text>
<text x="26.000000" y="303.392285" fill="rgb(102,102,102)"  stroke="rgb(102,102,102)" stroke-width="1" font-size="13" >3</text>
<text x="32.500000" y="299.712285" fill="rgb(102,102,102)"  stroke="rgb(102,102,102)" stroke-width="1" font-size="16" >C</text>
<text x="200.132799" y="191.143246" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
<text x="142.679265" y="191.143246" fill="rgb(102,102,102)"  stroke="rgb(102,102,102)" stroke-width="1" font-size="16" >H</text>
<text x="154.679265" y="194.823246" fill="rgb(102,102,102)"  stroke="rgb(102,102,102)" stroke-width="1" font-size="13" >3</text>
<text x="161.179265" y="191.143246" fill="rgb(102,102,102)"  stroke="rgb(102,102,102)" stroke-width="1" font-size="16" >C</text>
<text x="121.204824" y="378.329139" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
<text x="145.123264" y="316.019474" fill="rgb(178,178,0)"  stroke="rgb(178,178,0)" stroke-width="1" font-size="16" >S</text>
</svg>

Sign up or log in to comment