Brian Dunning's FileMaker Custom Functions

Ngram ( Inputstring ; Chuncksize )

This function is usefull to create an 'alternative' robust more fuzzy search and index method

  Average rating: 5.0 (1 vote) Log in to vote

paul larmuseau   paul larmuseau - Show more from this author
gaverapotheek
http://www.gaverapotheek.be

Share on Facebook Share on Twitter

  Sample input:
InputString "abcdefghi" Chuncksize 3
  Sample output:
abc¶
bcd¶
cde¶
def¶
efg¶
... etc

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function together with the matching calculation, is the core to make an index that finds fe
a name 'van den berghe' and links it with a high probability to another name 'vandenberge'
In this easy way you can create a 'robust search function in google style' that is mild for typo's and couple two databases with possible typo's or small differences in names'

To make it work you need to add the first THREE FIELDS

1/ ngram > text field

With script replace field or calculated field
ngram (name;3)

2/ temp_search > global field
has an ngram of your search name

3/ matching > calculated field, is counting the number of 'correspondin ngram's on the total number of ngrams

ValueCount( FilterValues(ngram;temp_search) ) /ValueCount(ngram)

or even better bidirectional

ValueCount( FilterValues(ngram3;temp_search) ) /ValueCount(ngram3)
+ValueCount( FilterValues(ngram3;temp_search) ) /ValueCount(temp_search)


4/ left4 > calculated field, this limits a list of possible related records to all those that begin with the same 3,4, 5 letters (its your choice)

left(name,4)

5/ create a searchscript with
fill field [file1::ngram;Ngram(file1::name;3)]
fill field [file2::temp_search;file1::ngram]


Now when you want to do a 'robust search and couple two databases with possible typo's or small differences in names', you add a relation... Remember those mentioned fields have to exist in both files

File 1 'ngram' = relation Link with File 2 'ngram' and
File1 'left4' = relation link with File2 'left4'

The result is visible in a portal view, and you see all the names that begin with the same four letters, and have equivalent ngram's.
To be usefull you sort the portal view on the 'matching' field of File 2 descending and you will see a very good list of candidate names.
You embed the searchscript after a button on the form

and this should work

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: