Hy to all,
I want to implement a small application for me, for odds comparison but unfortunately I got a dead end.
I succeeded to import the games and odds from all the bookmakers that is interesting me, but now I have some problem finding the same game on 5 bookmakers.
The problem is that they don't have all the same name for a team.
For example : Fc Koln (from Germany) can be find as : Koln or Coblenza.
And now I don;t know how to handle is the best manner the problem.
Can someone suggest me how to think this problem ? I was thinking on some AI or maybe to have some mysql tables for to write all the possibilities for a team (this will be do only the first time)
Compare strings that doesn't match 100%
Moderator: General Moderators
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Compare strings that doesn't match 100%
You could use regular expressions and do something like:aka_eu wrote:For example : Fc Koln (from Germany) can be find as : Koln or Coblenza.
Code: Select all
$bookmaker_name = 'Fc Koln';
$regex = '/(Koln|Coblenza)/'; // match 'Koln' or 'Coblenza'
if (preg_match($pattern, $bookmaker_name)) {
// match found
} else {
// no match
}(#10850)
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
$bookmaker_name = 'Fc Koln';
$regex = '/(Koln|Coblenza)/'; // match 'Koln' or 'Coblenza'
if (preg_match($pattern, $bookmaker_name)) {
// match found
} else {
// no match
}Code: Select all
$bookmaker_name = 'Fc Koln';
preg_replace('/(Koln|Coblenza)/', '$1 (a.k.a. '. $bookmaker_name.')', $source);Yes of course that I understand that solution but the problem is that I don't have to know each time how the team will be wrote. For example maybe sometime a bookmaker instead of Fc Koln will write Fc Kon , so I was thing as something like AI algorithm that will understand himself when it will meat Fc Kon that is about Fc Koln
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
FULL TEXT comparison in the database? similar_text() on the PHP side?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US