<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Attribute Table Spell Check in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/attribute-table-spell-check/m-p/289527#M22435</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I did is spell check in MS Access.&amp;nbsp; Of course only works on Personal Geodatabases.&lt;/P&gt;&lt;P&gt;I then created a custom dictionary.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Feb 2018 19:50:08 GMT</pubDate>
    <dc:creator>RobertBorchert</dc:creator>
    <dc:date>2018-02-28T19:50:08Z</dc:date>
    <item>
      <title>Attribute Table Spell Check</title>
      <link>https://community.esri.com/t5/python-questions/attribute-table-spell-check/m-p/289525#M22433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know this might be a stretch, but has anyone had any success writing a spell check function that would check an attribute table? I know there has been a lot of discussion on the need for spelling checking map element text, but it would also be helpful to have something that could check spelling within the attributes as well.&lt;/P&gt;&lt;P&gt;Right now the only real options I can see are to export the table to a CSV or comparable format then importing it into Excel and using it's spell check. Which is not ideal.&lt;/P&gt;&lt;P&gt;I'm currently trying to use PyEnchant, but thought I'd check to see if anyone had any success with this previously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 19:26:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attribute-table-spell-check/m-p/289525#M22433</guid>
      <dc:creator>MikeEdwards</dc:creator>
      <dc:date>2018-02-28T19:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Table Spell Check</title>
      <link>https://community.esri.com/t5/python-questions/attribute-table-spell-check/m-p/289526#M22434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Although I didn't build it for attribute tables, I've had some success with spellchecking using Microsoft Word through Python.&amp;nbsp; The gist of my process was that I looped through a bunch of metadata files, grabbed a specific subset of metadata elements, wrote each element's text value to a new line in a text file, spellchecked the file in Word, then exported the errors out to a list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Upsides:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Easy to setup&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Downsides:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Not very fast when batch-processing a bunch of different metadata documents&lt;/LI&gt;&lt;LI&gt;Occasionally Word would visibly pop-up and stall the process&lt;/LI&gt;&lt;LI&gt;Obvious baked-in dependency&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did this as a one-off though, so I didn't really worry about the downsides - if I were to use it frequently I'd really want to nail down the second downside in particular.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code looked something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import win32com.client

app = win32com.client.gencache.EnsureDispatch("Word.Application")
for metadataFile in metadataFiles:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Extracted specific metadata elements here, put into list.
&amp;nbsp;&amp;nbsp;&amp;nbsp; # ...

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Dump to text file
&amp;nbsp;&amp;nbsp;&amp;nbsp; with io.open(tempDocPath, "w") as tempFile:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for elementText in elementTextBlocks:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tempFile.write(unicode(elementText))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tempFile.write(u"\n\n")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Open the doc
&amp;nbsp;&amp;nbsp;&amp;nbsp; doc = app.Documents.Open(tempDocPath)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for error in doc.SpellingErrors:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Do stuff
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # ...
&amp;nbsp;&amp;nbsp;&amp;nbsp; doc.Close()
&amp;nbsp;&amp;nbsp;&amp;nbsp; del doc
app.Quit()
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course the Close()/del/Quit() stuff was handled in finally blocks and all that, and because I was getting a lot of recurring proper nouns flagged as errors I ended up building in an exclusion process where Line 18 would be, but basically I ended up dumping everything to a CSV with the filename and misspelled word.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:58:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attribute-table-spell-check/m-p/289526#M22434</guid>
      <dc:creator>JamesMacKay3</dc:creator>
      <dc:date>2021-12-11T13:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Table Spell Check</title>
      <link>https://community.esri.com/t5/python-questions/attribute-table-spell-check/m-p/289527#M22435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I did is spell check in MS Access.&amp;nbsp; Of course only works on Personal Geodatabases.&lt;/P&gt;&lt;P&gt;I then created a custom dictionary.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 19:50:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attribute-table-spell-check/m-p/289527#M22435</guid>
      <dc:creator>RobertBorchert</dc:creator>
      <dc:date>2018-02-28T19:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Table Spell Check</title>
      <link>https://community.esri.com/t5/python-questions/attribute-table-spell-check/m-p/289528#M22436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. That's similar&amp;nbsp;&amp;nbsp;to the process I was looking into, except swap out Excel for Word.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 19:58:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attribute-table-spell-check/m-p/289528#M22436</guid>
      <dc:creator>MikeEdwards</dc:creator>
      <dc:date>2018-02-28T19:58:42Z</dc:date>
    </item>
  </channel>
</rss>

