Hello guys,We're dealing it some issue on attempting this:Right now with find() function or exact() you can't achieve the following:Let's say we have an e-mail with this phrase "I am an idealist", and on the other hand we have a key defined as: "ideal", right now because the body considers all the text, if you try with find(), the output is true because it finds "ideal" on "I am an [ideal]ist", and the exact() will not work as well because "I am an idealist" is not the same as "ideal", even if the key was "idealist" it will output false as well.
Any ideas?
Discussion posts and replies are publicly visible
Maybe it's too simplistic but aren't you looking for " ideal " rather than "ideal"? That is, the spaces either side of a word matter?
I'm unclear exactly what it is you *are* looking for. For instance are you looking for instances of " ideal " (i.e. with whitespace / non-word characters before and after, what we might call a "whole word" search elsewhere)? Or is it something else?
Just check the java code bellow, basically we wanted to turn that into appian SAIL code.. but we can't find how we can do a foreach to compare local!corpo and !localcriterios.
you have to match key value word by word for the sentence , here is what you can do to resolve that
a!localVariables( local!text:"I am an idealist", local!key:"ideal", local!wordWiseSentance: split(local!text," "), contains(local!wordWiseSentance,local!key) ) /*returns true means key is present else not present*/
I'd start with
whereContains(local!criterios, local!corpo)
...which will return an array of matches (indices in the 2nd array where value(s) from the 1st array are a match). If no matches, the returned array will be empty. You can do what you want from there with these results.
The same result is attainable via a nested a!forEach (as long as you structure it right, i think your examples above are close but both miss the mark somewhat) - but whereContains() does this work for you.
Not sure if this is what you're shooting for:
a!localVariables( local!criterios: split("teste,teste2,teste3",","), local!corpo: split("ola eu sou o carlos e tenhos teste e teste3"," "), a!forEach( items: local!corpo, expression: fn!contains(local!criterios, fv!item) ) )
which returns:
Or if simply using whereContains()...
a!localVariables( local!criterios: split("teste,teste2,teste3",","), local!corpo: split("ola eu sou o carlos e tenhos teste e teste3"," "), /*a!forEach( items: local!corpo, expression: fn!contains(local!criterios, fv!item) )*/ wherecontains(local!criterios, local!corpo) )
There is a new plug-in called Similarity that may help. "The Text Similarity function plug-in allows users to compute a similarity score between pairs of texts. By computing a similarity score, one can find related items, group similar items, detect duplicates, and more."