#1 (permalink)  
Old 12-02-2008, 03:41 AM
Registered User
 
Join Date: Jul 2004
Posts: 249
Matching phrases

I can't figure this out. I spent a lot of time (weeks!) trying to figure it out but no success.

What I want is for common_phrase to have the phrases in common from both mySplitString and mySplitString2separated by ,,.
Code:
	var common_phrase = "";//the last result of the string
	k=0;
	var count=0;
	for(var i=0; i < wordCollection.length; i++){ //length of the collection of words in common in the two strings mySplitString and mySplitString2
		for(var j=0; j < mySplitString.length; j++){ //picks a word and runs through 2nd array
			if(wordCollection[i] == mySplitString[j]){ //when match found
				for(k=0; k < mySplitString2.length; k++){
					if(wordCollection[i] == mySplitString2[k]){
						for(m=0; m<wordCollection.length; m++){
							if(mySplitString[j+m] == mySplitString2[k+m]){
								common_phrase += mySplitString[j+m]+" "; //records word
								count++;
							}
						}
					}else{
						if(count > 0){
							common_phrase += ",,";
							count=0;
						}
					}
				}	
			}
		}
	}
__________________
Gilgal's website:
Wheel Of God
Now easy to post scripture verses!
Portfolio

  #2 (permalink)  
Old 12-03-2008, 08:04 PM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,533
I'm still somewhat at a loss as to how you are generating the phrases you're trying to match. Are your users typing in a phrase that you're trying to match against various sources, or are you simply trying to find common phrases between all of the books you have in the database?

If your users are typing in the phrases, the best way to go about this is to use a fulltext search within your MySQL database. If you're simply trying to compare two or more database results to find common phrases, I honestly can't think of a good way to do so, unfortunately.
__________________
I hate Internet Explorer! Anyone with me?
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SEO Future? Cleo8 SEO - Search Engine Optimization 19 04-08-2009 11:38 AM
matching phrases gilgalbiblewhee Programming and Scripting 8 11-25-2008 06:02 AM


All times are GMT -5. The time now is 02:05 PM.

 
Clicky Web Analytics
CloudContacts
Loop11
Page.ly


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.1 PL1
© 1997-2009 HTMLCenter