Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2007-11-21 21:58:14

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: smd_fuzzy_find needs beta testers/coders

Hey Stef,

I finally found time to do some more testing, though not extensively. I found that setting tolerance to ‘1’ at least in Dutch gives better results than the default ‘2’. And the limit attribute, when used with ‘words’, is 1 off: for example limit="words:4" gives 5 words. It counts correctly with ‘articles’.

And there is something I don’t understand: have a look at the suggested words here for instance. Search term is ‘clikker’, while it should be spelled ‘clicker’. Now there are lots of words starting with ‘clicker’, like ‘clickeraar’, ‘clickeren’, etcetera. Why doesn’t it suggest those whole words, but instead ‘clickera’, ‘clickere’? At first I thought it was because of the word length, but in other cases that doesn’t seem to matter that much. Or is the difference here the search term being at the end or the beginning of the word? (This is not something I’m asking you to fix, I just don’t get how it works.)

I still like the plugin a lot :)

Offline

#38 2007-11-22 09:19:21

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,568
Website GitHub

Re: smd_fuzzy_find needs beta testers/coders

Hey Els, thanks for testing this some more.

I found that setting tolerance to ‘1’ at least in Dutch gives better results than the default ‘2’.

Weird, but cool. Nice to know.

And the limit attribute, when used with ‘words’, is 1 off

D’oh, well spotted. A rogue missing “=” sign on line 383 of the plugin is the culprit. I’m hopefully going to be making this plugin as official as I can over the next week or so to take advantage of the better-written stuff in smd_lib v0.3 (which was essentially a rewrite of the “unofficial” version of the beta smd_lib 0.23 that fuzzy_find uses). In the meantime, if you want to patch the plugin, go down near the bottom and find:

if (array_key_exists("words", $limitBy) && $ctr > $limitBy["words"]) {

and change it to:

if (array_key_exists("words", $limitBy) && $ctr >= $limitBy["words"]) {

That makes it count better :-)

Search term is ‘clikker’, while it should be spelled ‘clicker’. Now there are lots of words starting with ‘clicker’, like ‘clickeraar’, ‘clickeren’, etcetera. Why doesn’t it suggest those whole words, but instead ‘clickera’, ‘clickere’? … is the difference here the search term being at the end or the beginning of the word?

It is odd isn’t it. I don’t know if the beginning/end of the word thing has any bearing on the results, but it may well be a factor (I wish I understood this guy’s function so I could have a stab at an intelligent answer!) If it’s any consolation it’s the same in english. In that last example I have no idea what’s going on with the results, especially the last article! Totally bizarre: for some reason the algorithm thinks that ‘ca’ is a suitable replacement for ‘arestia’ (a very badly-spelled portion from the middle of the word ‘marestail’). The mind boggles.

In the process of moving this plugin towards officialdom I’m going to review some of the stuff anyway and I’ll do some extensive testing to see if this sort of thing is a result of the fuzzy find algorithm throwing weird stuff out, or if it’s a(nother) bug in my “get the nearest word” function. If I find anything I’ll post here first.

Many thanks for giving the code a good seeing to, and for spotting that naughty bug. If I had Best Beta Tester badges available, you’d get one :0)

Last edited by Bloke (2007-11-22 09:22:02)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#39 2007-11-22 19:27:53

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: smd_fuzzy_find needs beta testers/coders

Bloke wrote:

If I had Best Beta Tester badges available, you’d get one :0)

Thank you, but to be honest, where is the competition? ;-)

Offline

Board footer

Powered by FluxBB