<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/spelling-2-0-improved-markdown-and-rstudio-support/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://ropensci.org/technotes/2018/12/20/spelling-20/"> rOpenSci - open tools for open science</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>We have released updates for the rOpenSci text analysis tools. This technote will highlight some of the major improvements in the <a rel="nofollow" href="https://github.com/ropensci/spelling#readme" target="_blank">spelling</a> package and also the underlying <a rel="nofollow" href="https://cloud.r-project.org/web/packages/hunspell/vignettes/intro.html" target="_blank">hunspell</a> package, which provides the spelling engine for the spelling package.</p>
<pre><code>install.packages(&quot;spelling&quot;)
</code></pre>
<p>Update to the latest versions to use these cool new features!</p>
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">Upcoming version of <a rel="nofollow" href="https://twitter.com/hashtag/rstats?src=hash&ref_src=twsrc%5Etfw" target="_blank">#rstats</a> spelling package will also check your package readme and news files. <a rel="nofollow" href="https://t.co/bem8rGx9e3" target="_blank">pic.twitter.com/bem8rGx9e3</a></p>
<p>— Jeroen Ooms (@opencpu) <a rel="nofollow" href="https://twitter.com/opencpu/status/1074762150504226822?ref_src=twsrc%5Etfw" target="_blank">December 17, 2018</a></p></blockquote>
<p></p>
<h2>Automatic Checking of README and NEWS files</h2>
<p>Users that are already using <em>spelling</em> on their packages might discover a few new typos! The new version of spelling now also checks the <code>readme.md</code> and <code>news.md</code> and <code>index.md</code> files in your package root directory.</p>
<pre><code>spelling::spell_check_package()
#   WORD       FOUND IN
# AppVeyor   README.md:5
# CMD        description:3
#            README.md:12
# devtools   README.md:93
# hunspell   spell_check_files.Rd:18,32
#            spell_check_package.Rd:24
#            README.md:31
</code></pre>
<p>Of course it also still checks your manual pages, vignettes and description fields. Hence we now spell check all content that is used to generate your package website with pkgdown.</p>
<h2>Improved Markdown Parsing</h2>
<p>Parsing of markdown files in <code>spell_check_files()</code> and <code>spell_check_package()</code> has been tweaked in a few places, resulting in less false positives.</p>
<p>First of all, it now properly parses the yaml front-matter and only runs the spell check only on the <code>title</code>, <code>subtitle</code> and <code>description</code> fields. The other fields usually contain code or options, not actual language we want to check.</p>
<pre><code>spelling::spell_check_files(&quot;README.md&quot;)
#   WORD       FOUND IN
# AppVeyor   README.md:5
# CMD        README.md:12
# devtools   README.md:93
# hunspell   README.md:31
# readme     README.md:37
# RStudio    README.md:8,93
# wordlist   README.md:12
</code></pre>
<p>Also the parser now filters words that contain <strong>@</strong> symbol. Such a word is usually a <a rel="nofollow" href="https://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html" target="_blank">rmarkdown citation</a> or twitter handle, or email address, neither of which should be spell checked.</p>
<p>Finally all markdown files are now treated as UTF-8 which should fix a problem that Windows users may have been seeing when checking files that contain non-ascii text, such as words with <a rel="nofollow" href="https://github.com/ropensci/spelling/issues/17" target="_blank">diacritics</a> or basically anything that is not in Latin script. Which brings us to the next topic…</p>
<h2>Support for RStudio Dictionaries</h2>
<p>The spelling and hunspell packages require a dictionary for spell checking text in a given language. By default we include <code>en-US</code> and <code>en-GB</code>, but installing additional dictionaries has become even easier. The package will now automatically find dictionaries that you have installed in RStudio:</p>
<p><a rel="nofollow" href="https://cloud.r-project.org/web/packages/hunspell/vignettes/intro.html#hunspell_dictionaries" target="_blank"><img alt="screenshot" src="https://i2.wp.com/jeroen.github.io/images/rs-hunspell.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p>The RStudio IDE has a menu to install additional languages <code>(Global Options -> Spelling -> Main Dictionary Language -> Install)</code>. The installed dictionaries will automatically become available to hunspell and you can use them in all hunspell/spelling functions that take a <code>lang</code> or <code>dict</code> argument.</p>
<pre><code>hunspell::list_dictionaries()
#  [1] &quot;bg_BG&quot;     &quot;ca_ES&quot;     &quot;cs_CZ&quot;     &quot;da_DK&quot;     &quot;de_DE_neu&quot; &quot;de_DE&quot;     &quot;el_GR&quot;    
#  [8] &quot;en_AU&quot;     &quot;en_CA&quot;     &quot;en_GB&quot;     &quot;en_US&quot;     &quot;es_ES&quot;     &quot;fr_FR&quot;     &quot;hr_HR&quot;    
# [15] &quot;hu-HU&quot;     &quot;id_ID&quot;     &quot;it_IT&quot;     &quot;lt_LT&quot;     &quot;lv_LV&quot;     &quot;nb_NO&quot;     &quot;nl_NL&quot;    
# [22] &quot;pl_PL&quot;     &quot;pt_BR&quot;     &quot;pt_PT&quot;     &quot;ro_RO&quot;     &quot;ru_RU&quot;     &quot;sh&quot;        &quot;sk_SK&quot;    
# [29] &quot;sl_SI&quot;     &quot;sr&quot;        &quot;sv_SE&quot;     &quot;uk_UA&quot;     &quot;vi_VN&quot;

hunspell::hunspell(&quot;Nou breekt mijn klomp!&quot;, dict = 'nl_NL')
# character(0)
</code></pre>
<p>Not using RStudio? The last chapter of the <a rel="nofollow" href="https://cloud.r-project.org/web/packages/hunspell/vignettes/intro.html#hunspell_dictionaries" target="_blank">hunspell vignette</a> explains in detail how to install dictionaries on different platforms.</p>
<h2>Low Level Hunspell Updates</h2>
<p>Text analysis experts might notice some significant improvements in hunspell because it includes the latest <a rel="nofollow" href="https://github.com/explore" target="_blank">libhunspell 1.7</a> library. This version has lots of new features and bug fixes by László Németh.</p>
<p>Among the changes are performance enhancements and tweaks in the suggestion algorithm, i.e. the <code>hunspell::hunspell_suggest()</code> function in R. For a complete overview of changes have a look at the <a rel="nofollow" href="https://github.com/hunspell/hunspell/blob/master/NEWS" target="_blank">release notes</a> from libhunspell.</p>
<p>Also we have updates the <code>en-US</code> and <code>en-GB</code> dictionaries included with the hunspell package to the latest version <code>2018.11.01</code> from <a rel="nofollow" href="https://extensions.libreoffice.org/extensions/english-dictionaries/2018-11.01" target="_blank">libreoffice</a>. This update include many new words that may have been previously marked as spelling errors.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://ropensci.org/technotes/2018/12/20/spelling-20/"> rOpenSci - open tools for open science</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/fFCry9ivG20" height="1"></a></div>