...
<#assign n1 = LIB.randomInt(10)> <#assign b1 = LIB.randomBoolean()> random num = ${n1} <#if b1 > random bool = true <#else> random bool = false </#if>
Similarity
Turkers that copy/paste to create an abstract are a problem! Likewise those that produce a ‘quote’ that is not really a quote. This function allows us to detect these bad actors. The textSimilarity function uses Levenshtein distance to compare two strings. Their degree of similarity is returned as an integer percentage between 0 and 100 where 100 is an exact match.
Here is a simple example use, but see the Abstract and Author Quote steps in the Reference Persona workflows for real applications.
<#assign dom = doc.soup>
<#assign source = dom.text()>
<#assign abstract = "blah blah blah">
<#assign sim = LIB.textSimilarity(source, abstract)>
similarity=${sim}