...
<#assign dom = doc.soup> <#assign source = dom.text()> <#assign abstract = "blah blah blah"> <#assign sim = LIB.textSimilarity(source, abstract)> similarity=${sim}
Spelling
The same spell checker that is available as a ‘predefined’ filter is also available to scripts. The value returned is the integer error rate from 0 to 100 where 100 would mean every single word is misspelled! Note that the spelling dictionary is (currently) hard-coded to American English … hmm, how is that not an oxymoron? … so be careful how tightly to filter for spelling errors if you are expecting non-American spellings.
<#assign s0 ="this is a string that has no spelling errors of any kind that I know of">
<#assign s1 = "this is a strig that has summ spelling errors of teh sortt yu might ecpect">
<#assign n0 = LIB.getSpellingErrorRate(s0)>
<#assign n1 = LIB.getSpellingErrorRate(s1)>
n0 = ${n0}<br/>
n1 = ${n1}<br/>