Spell Checking w/ Dynamo

image by archi-lab

I am not sure how useful this would be, but I saw a question on the Dynamo Forum, where someone was asking about potential to Spell Check their Schedules in Revit. Obviously we can do spell checking on Text Notes, that is now available out of the box in Revit. However, that spell checking tool doesn’t dig into Elements and their Parameter values, so it’s kind of useless for Schedules. These as we all know are simply a tabular representation of Elements and their parameter values. How do we go about checking these for spelling mistakes? Here’s one approach:

Let’s say that we have some Elements where Comments parameter is being scheduled. Doors is a good example when we are doing Door Schedules, it’s a common occurrence to leave some directions behind in that parameter.

As you can see above there are some words that have spelling mistakes. Here’s how we can correct those:

The above script uses a simple approach where:

  • we grab the elements that we want to spell check
  • get parameter value from each one. In this case we are looking at Comments, but the goal is really to get a string value from any parameter.
  • We then feed it through a Speller node called Speller.CheckSpelling. That’s a custom node from archi-lab.net library, but more specifically it uses an Open Source project called WeCantSpell.Hunspell This is a .NET wrapper around Hunspell library, that in turn uses bunch of Open Office dictionaries. That means that we can load any of the following languages into it, for spell checking: Dictionaries By default we are using English US Dictionary.
  • Once we pass it through there, what we will get is two lists. One will contain all of the words that library found to be misspelled, and another will have all of the potential fix suggestions.
  • For this example I just grabbed first suggestion for each misspelled word, and replaced them in the string, so that I can write that new value back into the Comments parameter.

That’s it! There is no magic here. There are some issues that I can foresee but also some potential for future development. At the moment we are using out of the box dictionaries, but we all know that Architects, Engineers etc. will have a ton of custom words, abbreviations etc. that we would want to exclude. We can do that of course, I just haven’t implemented a wrapper for that.

As a bonus content here’s the same script but spell checking Text Notes. I guess it’s always good to compare to the existing solution inside of Revit to make sure that we are not making existing things worse.

Again, feel free to post any comments, or issues either here or on the archi-lab.net GitHub page.

Finally, as always samples will be available for download for my Patreon supporters. Thank you to all that have been, and continue supporting me. Enjoy!

EDIT 2020.07.26:

So I noticed that there were some questions on the Dynamo Forum asking about Spell Checking a Schedule. The more advanced users of Revit surely know that a Schedule is just a different way of looking at the same model. Each row in a Schedule is actually connected to an Element in the model, so all we have to do to Spell Check a Schedule is get these Elements. Each column in a Schedule is just a Parameter value from that Element. Here’s a quick example of Spell Checking a Door Schedule and the Comments column:

As you can see above I have also added a way to create a set of custom words in our Spell Checking library for things like Abbreviations. Yes, Architects and Engineers surely like to have a list of custom words that they would like to omit when spell checking their work. This new Speller constructor allows you to do just that. Just feed it a list of custom words.

Also, as you can see above, I am showing a different way to obtain a Dictionary. For those of you that don’t want to use the default English dictionary, you can do so by supplying a path to a dictionary and affix files. I posted a link to bunch of different languages above.

Support archi-lab on Patreon!

6 Comments

  1. Cristina Rego says:

    Hi, how can I install this package?

  2. Cristina Rego says:

    Found it. I will let you know if it works :)

  3. Yura says:

    Please,send me nod Speller speller
    Thanks

  4. Leland says:

    Can you just do it for me?

Leave a Comment