mortoau Posted June 8, 2011 Share Posted June 8, 2011 I am importing two XML feeds into a database. Each feed has "odds" on sporting events. The problem is each feed has different names of the same sporting event. For example: feed 1 describes an event as "Team A vs Team B" feed 2 describes the same event as "TEAM A v TEAM B" Do I need a mapping table to have a master event ID which knows feed 1 and feed 2's name of the event is actually the same? So when I import the XML feed to get the lastest odds for every event I know how to match the different names of the same event in each feed? Quote Link to comment Share on other sites More sharing options...
WebStyles Posted June 8, 2011 Share Posted June 8, 2011 if the differences are just the 2 you described (uppercase/lowecase and the fact that one says 'v' and the other says 'vs'), then just for the sake of comparison you could convert them all to lowercase and do a replace of all 'vs' str_replace(" vs "," v",$file_contents); Of course, this is just a silly fix, and also depends on how you're importing the data (string or array). a unique id per event, as you said, would be much better and easier to identify. Quote Link to comment Share on other sites More sharing options...
mortoau Posted June 9, 2011 Author Share Posted June 9, 2011 To further complicate things is the placeholders can also be different. Feed1 calls the game "event" and feed2 calls the game "competition". So the value and the placeholder tag are different but have the same meaning. <feed1> <event>Team A vs Team B</event> </feed1> <feed2> <competition>TEAM A v TEAM B</competition> </feed2> Quote Link to comment Share on other sites More sharing options...
WebStyles Posted June 9, 2011 Share Posted June 9, 2011 you could also build little translation arrays. Meaning: all the possible words for each placeholder (depends really on how many there are, if they're only a few, this could work fine). Like: $similar1 = array("event","competition","match","game"); then, when you grab a placeholder name, you search through the arrays looking for it. If you use position [0] as your default name, then you can easily translate them. If there are a lot, you can build a simple database with `defaultWord`,`similarWord` and just search through that. again, not the best way to solve your problem, but it should work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.