Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Suggesting alternative search terms to web site users

How do you report search results to your users? Users are notorious spellers, and they'll enter text in the wrong case, use the wrong letters, and join words up where they shouldn't.

On our web site, we wanted to report on accurate matches when a user searches, but also recommend other possible search terms when the search finds nothing or very little to report.

A COMPARISON OF PHP "LOOK ALIKE" FUNCTIONS

PHP supports a number of functions that allow the comparison of text strings to see "how similar" they are.

1. soundex returns a 4 character string that represents what a word sounds like when pronounced

2. metaphone creates a variable length character string that also represents what a word sounds like when it's pronounced. More accurate than soundex.

3. similar_text calculates the similarity (as a percentage) between two strings.

4. levenshtein returns the number of changes (character deletes, inserts and replaces) that are needed to transform one string into another. More efficient than similar_text.

You can also use low level string functions and regular expressions to compare text strings - although the four functions listed above are probably more suited for looking for "words like".

APPLICATION OF LOOK ALIKE FUNCTIONS TO A WEB SEARCH

There are nearly 40000 different words used on our web site, and our search pages examine over 5000 different pages. Clearly it's not practical to go through every page and do searches and "look like" comparisons at every search, so here's what we do:

a) When our website is updated, we generate a table of all the words used on the site and their metaphone values. A third column in this table records the number of times each word occurs.

b) When a search fails, we look for all words that we've used with an identical metaphone, and we offer these starting with the most used word first.

c) If the user is searching for a single word and there's still very little we can offer, we attempt to make up a matching metaphone using two words. For example, the metaphone for "dresscode" is TRSKT, so we look to make up that string with words like "dress" and "trees".

d) Stage (c) can generate a very large number of options so we use levenshtein to select those which are nearest to the use's original search term, and to eliminate those which are spelt wildly differently


See also PHP training courses

Please note that articles in this section of our web site were current and correct to the best of our ability when published, but by the nature of our business may go out of date quite quickly. The quoting of a price, contract term or any other information in this area of our website is NOT an offer to supply now on those terms - please check back via our main web site

Related Material

PHP - Further Web Page and Network Handling
  [220] - ()
  [314] - ()
  [345] - ()
  [356] - ()
  [372] - ()
  [376] - ()
  [410] - ()
  [425] - ()
  [443] - ()
  [451] - ()
  [484] - ()
  [537] - ()
  [542] - ()
  [565] - ()
  [603] - ()
  [675] - ()
  [767] - ()
  [789] - ()
  [847] - ()
  [904] - ()
  [936] - ()
  [1009] - ()
  [1114] - ()
  [1183] - ()
  [1187] - ()
  [1210] - ()
  [1355] - ()
  [1379] - ()
  [1485] - ()
  [1495] - ()
  [1496] - ()
  [1505] - ()
  [1515] - ()
  [1518] - ()
  [1549] - ()
  [2632] - ()
  [2679] - ()
  [2729] - ()
  [2918] - ()
  [3036] - ()
  [3432] - ()
  [3540] - ()
  [3568] - ()
  [3918] - ()
  [4070] - ()
  [4483] - ()

Web site techniques, utility and visibility
  [23] - ()
  [32] - ()
  [98] - ()
  [109] - ()
  [117] - ()
  [142] - ()
  [165] - ()
  [173] - ()
  [179] - ()
  [182] - ()
  [197] - ()
  [202] - ()
  [222] - ()
  [259] - ()
  [261] - ()
  [268] - ()
  [274] - ()
  [276] - ()
  [278] - ()
  [284] - ()
  [288] - ()
  [311] - ()
  [314] - ()
  [320] - ()
  [322] - ()
  [347] - ()
  [348] - ()
  [369] - ()
  [376] - ()
  [414] - ()
  [492] - ()
  [510] - ()
  [528] - ()
  [533] - ()
  [649] - ()
  [658] - ()
  [681] - ()
  [718] - ()
  [732] - ()
  [757] - ()
  [767] - ()
  [800] - ()
  [893] - ()
  [916] - ()
  [976] - ()
  [994] - ()
  [1015] - ()
  [1029] - ()
  [1055] - ()
  [1104] - ()
  [1177] - ()
  [1184] - ()
  [1186] - ()
  [1198] - ()
  [1207] - ()
  [1212] - ()
  [1237] - ()
  [1297] - ()
  [1437] - ()
  [1494] - ()
  [1505] - ()
  [1506] - ()
  [1513] - ()
  [1534] - ()
  [1541] - ()
  [1554] - ()
  [1610] - ()
  [1630] - ()
  [1634] - ()
  [1653] - ()
  [1711] - ()
  [1747] - ()
  [1756] - ()
  [1793] - ()
  [1797] - ()
  [1833] - ()
  [1856] - ()
  [1888] - ()
  [1955] - ()
  [1961] - ()
  [1970] - ()
  [1982] - ()
  [2056] - ()
  [2065] - ()
  [2225] - ()
  [2332] - ()
  [2333] - ()
  [2334] - ()
  [2335] - ()
  [2336] - ()
  [2337] - ()
  [2338] - ()
  [2339] - ()
  [2340] - ()
  [2340] - ()
  [2341] - ()
  [2389] - ()
  [2410] - ()
  [2519] - ()
  [2532] - ()
  [2552] - ()
  [2569] - ()
  [2668] - ()
  [2981] - ()
  [3022] - ()
  [3087] - ()
  [3149] - ()
  [3197] - ()
  [3367] - ()
  [3426] - ()
  [3491] - ()
  [3532] - ()
  [3554] - ()
  [3563] - ()
  [3589] - ()
  [3623] - ()
  [3734] - ()
  [3744] - ()
  [3745] - ()
  [3776] - ()
  [3896] - ()
  [3974] - ()
  [4001] - ()
  [4076] - ()
  [4115] - ()
  [4136] - ()
  [4239] - ()
  [4376] - ()
  [4401] - ()
  [4474] - ()
  [4492] - ()

resource index - PHP
Solutions centre home page

You'll find shorter technical items at The Horse's Mouth and delegate's questions answered at the Opentalk forum.

At Well House Consultants, we provide training courses on subjects such as Ruby, Lua, Perl, Python, Linux, C, C++, Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer) many questions, and answers to those which are of general interest are published in this area of our site.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/solutions/php-sugg ... users.html • PAGE BUILT: Wed Mar 28 07:47:11 2012 • BUILD SYSTEM: wizard