Re: SOUNDS_LIKE, SOUNDEX
| From: | Ron Piggott | Date: | Mon, 11 Oct 2010 21:45:39 +0000 |
| Subject: | Re: SOUNDS_LIKE, SOUNDEX | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-47385@lists.php.net to get a copy of this message | ||
After looking at the response I tried to make 2 mySQL queries that I need
help with. (I didn't use the PHP functions because I am trying to query
the database for results:
#1:
SELECT
word FROM bible_concordance_words WHERE
SOUNDEX('command')
ORDER BY word ASC
- There are no results, I don't understand because Commanded, Commander,
Commanding, Commandment, Commandments are all in the datase
#2:
SELECT word FROM bible_concordance_words WHERE command SOUNDS_LIKE
word ORDER BY word ASC
- I receive the error:
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'SOUNDS_LIKE
word ORDER BY word ASC
I think it wants me to specify an actual word, not the word column.
Is there a way to tweak either of the syntaxes I have started?
Ron
> Hello, Ron:
>
> I apologize if I was supposed to reply to the list directly, however.. I
> saw no direct way to do so that would also ensure my reply to you.
>
> I believe the functions you are looking for would be :
>
> - levenshtein()
> <http://www.php.net/manual/en/function.levenshtein.php>
> -
> Calculate Levenshtein distance between two strings
> - metaphone()
> <http://www.php.net/manual/en/function.metaphone.php> -
> Calculate the metaphone key of a string
> - similar_text()
> <http://www.php.net/manual/en/function.similar-text.php>
> -
> Calculate the similarity between two strings
> - soundex()
> <http://www.php.net/manual/en/function.soundex.php> -
> Calculate the soundex key of a string
>
> You would need to use your word and then run the words you want displayed
> as
> possible matches through this function. Alternatively, SQL also has the
> Soundex function , and MySQL has sound_like, which means you could get the
> possible matches returned through the dataset.
>
> Hope this helps!
>
>
>> ---------- Forwarded message ----------
>> From: "Ron Piggott" <ron.piggott@actsministries.org>
>> To: php-db@lists.php.net
>> Date: Mon, 11 Oct 2010 17:12:17 -0400
>> Subject: "Similar to" searches
>>
>> I am wondering if there is a way to or how you would have mySQL query
>> for
>> similar words in comparison to what the user provided.
>>
>> I have a table which contains only single words. It has two columns:
>>
>> - reference int(10) NOT NULL AUTO_INCREMENT,
>> - word varchar(100)
>>
>> I am wondering if there is a way to cross reference the word the user
>> has
>> provided to similar words in the database (So I could offer "SEE ALSO:"
>> links).
>>
>> An example: If the word the user has provided is: Forced
>> I would like the mySQL query results to find the words: Forcing, Force
>> and
>> Forces to be the results of the query in the words database.
>>
>> Is there any way of achieving this?
>>
>> Ron
>>
>> The Verse of the Day
>> Encouragement from God's Word
>> www.TheVerseOfTheDay.info
>>
>>
>>
>
>
> --
> "Act only according to that maxim whereby you can at the same time will
> that
> it should become a universal law." - Kant
> "He who learns but does not think, is lost; He who thinks but does not
> learn
> is in great danger." - Confucius
>
The Verse of the Day
Encouragement from God's Word
www.TheVerseOfTheDay.info