Software Open Access

detect-delimiter software project

McNamara, Timothy S


DataCite XML Export

<?xml version='1.0' encoding='utf-8'?>
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.1/metadata.xsd">
  <identifier identifierType="DOI">10.5281/zenodo.1323186</identifier>
  <creators>
    <creator>
      <creatorName>McNamara, Timothy S</creatorName>
      <givenName>Timothy S</givenName>
      <familyName>McNamara</familyName>
      <nameIdentifier nameIdentifierScheme="ORCID" schemeURI="http://orcid.org/">0000-0002-2494-2700</nameIdentifier>
      <affiliation>DOT loves data</affiliation>
    </creator>
  </creators>
  <titles>
    <title>detect-delimiter software project</title>
  </titles>
  <publisher>Zenodo</publisher>
  <publicationYear>2018</publicationYear>
  <subjects>
    <subject>text processing</subject>
    <subject>Python programming</subject>
  </subjects>
  <dates>
    <date dateType="Issued">2018-07-29</date>
  </dates>
  <language>en</language>
  <resourceType resourceTypeGeneral="Software"/>
  <alternateIdentifiers>
    <alternateIdentifier alternateIdentifierType="url">https://zenodo.org/record/1323186</alternateIdentifier>
  </alternateIdentifiers>
  <relatedIdentifiers>
    <relatedIdentifier relatedIdentifierType="DOI" relationType="IsVersionOf">10.5281/zenodo.1323185</relatedIdentifier>
  </relatedIdentifiers>
  <version>0.1.1</version>
  <rightsList>
    <rights rightsURI="https://creativecommons.org/licenses/by/4.0/legalcode">Creative Commons Attribution 4.0 International</rights>
    <rights rightsURI="info:eu-repo/semantics/openAccess">Open Access</rights>
  </rightsList>
  <descriptions>
    <description descriptionType="Abstract">&lt;p&gt;Data sharing and research collaboration is hindered when messy data is released. Despite this, it still exists. detect-delimiter aims to provide tools with an option for inspecting the header of a text file and checking the actual delimiter used, rather than blindly believing the file extension.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Usage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The detect_delimiter module exposes the detect() functinon, which takes a str as input and returns a delimiter.&lt;/p&gt;

&lt;pre&gt;&lt;code class="language-python"&gt;&amp;gt;&amp;gt;&amp;gt; from detect_delimiter import detect
&amp;gt;&amp;gt;&amp;gt; detect("looks|like|the vertical bar\n is|the|delimiter\n")
'|'&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When detect() doesn&amp;#39;t know, it returns None:&lt;/p&gt;

&lt;pre&gt;&lt;code class="language-python"&gt;&amp;gt;&amp;gt;&amp;gt; text = "not really any delimiters in here.\nthis is just text.\n"
&amp;gt;&amp;gt;&amp;gt; detect()&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It&amp;#39;s possible to provide a default, which will be used in that case:&lt;/p&gt;

&lt;pre&gt;&lt;code class="language-python"&gt;&amp;gt;&amp;gt;&amp;gt; detect(text, default=',')
','&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;br&gt;
By default, detect() will prevent avoid checking alpha-numeric characters and the period/full stop character (&amp;quot;.&amp;quot;). This can be adjusted via the blacklist parameter.&lt;/p&gt;

&lt;p&gt;If you believe that you know the delimiter, it&amp;#39;s possible to provide a list of possible delimiters to check for via the whitelist parameter. If you don&amp;#39;t provide a value, [&amp;#39;,&amp;#39;, &amp;#39;;&amp;#39;, &amp;#39;:&amp;#39;, &amp;#39;|&amp;#39;, &amp;#39;\t&amp;#39;] will be checked.&lt;/p&gt;</description>
    <description descriptionType="Other">This Python package can also be installed via "pip": "pip install detect-delimiter".</description>
  </descriptions>
</resource>
112
23
views
downloads
All versions This version
Views 112112
Downloads 2323
Data volume 71.3 kB71.3 kB
Unique views 101101
Unique downloads 2222

Share

Cite as