Spell Check and correct Multi-Category Tags using Dynamo

I would like to use Spell Check option which is available for Text Notes to apply on Multi-Category Tags as well. Is it possible using Dynamo?

Yes. There are a few posts on this already. Have a look around the forum, and check out the FuzzyDyno package.

Note that you need to spell check the parameter values not the tags themselves.

1 Like

@jacob.small I have tried searching with FuzzyDyno keyword. But I am unable to find any relevant topic.
If you could help point me towards the post or help paste the solution here.

This blog post should get you started: Fuzzy String Matching - Dynamo BIM

1 Like

I have tried with this. Looks complicated. Is there any alternative method for Beginners?

Nope - winds up that performing a spell check is complicated work.

1 Like

Hello,
here are 2 other solutions (IronPython or Archilab)

the IronPython solution code (using Interrop)

import sys
import clr
import System

clr.AddReference("Microsoft.Office.Interop.Word")
import Microsoft.Office.Interop.Word as Word

clr.AddReference("office")
from Microsoft.Office.Core import *

clr.AddReference("System.Runtime.InteropServices")
import System.Runtime.InteropServices

lstWord = IN[0]
out = []
app = Word.ApplicationClass()
docWord = app.Documents.Add()
# automatically detects the language you are using as you type
languageAutoCheck = app.CheckLanguage 
# the language selected for the Microsoft Word user interface
currentUILangInt = app.Language 
currentUILanguage = System.Enum.ToObject(MsoLanguageID, currentUILangInt)

# check words
for w in lstWord:
	spellingIsCorrect = app.CheckSpelling(w)
	if spellingIsCorrect:
		out.append(w)
	else:
		suggestions = [x.Name for x in app.GetSpellingSuggestions(w)] 
		# get the first suggestion
		out.append(suggestions[0])
		
docWord.Close()
app.Quit()
app = None

OUT = out

pyspellchecker CPython3 package can be also an alternative

2 Likes

Thankyou @c.poupin
I have come to conclusion that spell check isn’t really 100% reliable with correct words. So I would request if you can help me just highlight the misspelt words in the project into say Orange color. Then it would be better to do it manually.

How would you highlight the words manually in the parameter field?

@jacob.small Can we highlight the entire comment where any word has been misspelt?

I saw a node on archilab which segregated misspelt words.

Sure you can override an object, but not necessarily a word in a parameter value in a tag; Word-by word edits an be done somewhat using text notes, but parameters are very limited in terms of formatting.

@jacob.small Ok yes. then can we highlight the whole object? So that I can manually change the misspelt word.

Can you share the dynamo for the same please

You’ll have to build it, but if the text from a parameter value is the same as the recommendation of the python node or the recommendation of the Archi-Lab node is an empty list then you know the spelling is correct. So

  1. Test for equality or count being 0
  2. Use a List.FilterByBoolMask node to separate the good (in) from the bad(out)
  3. Highlight the element in question using an OverideColorInView node or by setting a “misspelt” parameter to true and let the view template do the highlighting.
1 Like