# 🔡 psNetspell

By
,
Powershell
,
Modules
Published 2023-03-14

Spelling reminds me of these guys, although they look much older now
Spelling reminds me of these guys, although they look much older now

Get psNetspell here
https://www.powershellgallery.com/packages/psNetSpell/0.0.1

# 🎁 Super Spellchecking Module

things seemed to have changed on the street
things seemed to have changed on the street

I went on a massive drive last year with this website to get recognised. Mission accomplished! I have chatted live with Jason Helmick, got invited to several PowerShell events and Podcasts. Got offered to write a book, got offered my dream job. So many ticks in all the right boxes, it did not go without pain and struggle, as last year I was proper skint. I was looking for another job, and wanted to find the right job but this was taking longer than expected, and things were getting tight in the Bacon house-hold. Being able to support my family is key to me in life, but for I think the first-time we were all living off my wife’s wages. Thankfully I got a super-supportive-amazing wife, who kept encouraging me to wait for that perfect job, as I had turned down a few support jobs. I was just feeling fed-up in life, I guess working in a particular industry for so long, and having skills but not wanting to just take the first job that comes along as you will not be making full use of the skills you have or what you could be doing.

# 🔎 Job Hunt made me blog more

I was hungry
I was hungry

During this time in-between job hunting I found it helped me to blog, as I felt I was getting the word out there that I love PowerShell and I was looking for work, and it seemed like I was getting to know and talk to the right people, but I was doing all of my website work and design in good old trusted notepad.exe. Yes, that is right notepad. Using ReType to design the website meant I only needed to use Markdown and for me that is kinder-garden style HTML. Plus, if I have not stressed enough, I was totally skint, no office license, no spell check. This I felt was one of my downfalls to writing these blogs, was spelling mistakes. I know that may seem rather pedantic to you, but it would annoy the heck out of me if I realised then never got round to actually updating the mistakes annoyed me even more. I had made a few binary modules, but well never got round to making a module to do this.

# PowershellAI to the rescue

new ideas
new ideas

That is until I discovered OpenAI and seeing what module I could cook-up with my ever-so helpful side-kick AI Chatbot. Again, this is one of those things that annoys me when the only examples Microsoft can provide is C# code. Which can either totally put you off reading the article, or make it extremely difficult to understand. However, I had asked OpenAI about a .Net spellchecker, and found a webpage showing this in a windows form but written in C#. This was actually one of the libraries of examples on nuget.org but could not figure out how to compile it. I remember even getting a reply from Steve Lee on the Microsoft PowerShell team saying he thought this was a good idea. So with wanting to write blogs again, but this time have a poor-mans spell-checker for free in PowerShell seemed like it was a project I must complete.

# 🏁 It took more than one question to solve

I did not get to this point
I did not get to this point

This was not a one-hit wonder, as in I did not get the perfect code first time round, but with keeping the conversation history I was able to get the OpenAI chatbot to help in assisting correcting these errors. Then I finally had what I had dreamed of bringing to PowerShell psNetSpell a fully functional spellchecker that can check a document for spelling mistakes and correct them. I was super-pleased with the end-result, as I wanted this last year when I was blogging. Without the help of third-party software such as PowerShell Studio I would not have been able to do this on my own. That is the crazy thing about this OpenAI it can really work magic in helping you solve a real-world problem.

# 🥼 Should Work

I did some testing
I did some testing

The module should automatically add the required .dll file and the dictionary file automatically, which are both stored in the same directory the function is running from, and calls that via the $PSScriptRoot built-in variable. So all you need to do is provide a path to the document you want to check for spelling mistakes. I did only include the en-GB dictionary, however if you were to download another dictionary file you can pass this in via the -DictionaryDirectory parameter to specify the directory that you have stored this dictionary file in. I hope this module finds its way into your PowerShell tool-kit of modules, and remember OpenAI helped me with this project. Maybe it can help you too.

# Thanks for reading

Grab the module using the link below

Get psNetspell
https://www.powershellgallery.com/packages/psNetSpell/0.0.1