I need some help with an algorithm. Well, basically I know one way of doing it, but I'm wondering if there is a smarter way of doing it.
Say i have a list of possible (or rather, known) values for a field, and I want to compare the current value of the field against all the known values to come up with some suggestions to change the current value into a known value. Much like how a spell checker works, only with phrases that contain more then 1 word. My basic algorithm looks something like:
Step 1. Start with the first 2 characters, and grab everything out of the known list with those first 2 characters.
Step 2. Compare the first 3 characters with the first 3 characters of everything that was grabbed in step 1, move those to the top of the list.
Step 3. Repeat Step 2, with 4 characters and so forth until the entire length of the given string has been gone through, with the most likely matches at the top of the list.
Some background:
I have this HUGE Excel spreadsheet full of testing data on different non-metal materials. I need to get all that data into an Access Database. I'm currently making a custom dialog box that will crank through all the "Trade Names" and compare them to what "Trade Names" we already have in our Access Database. If no close match can be found, then the user has the option to insert the new trade name into the database.
If you can think of a better method of comparing what is in the spread sheet against the possible values in the database, i'd like to know! Thanks!!
Question
Shadrack
I need some help with an algorithm. Well, basically I know one way of doing it, but I'm wondering if there is a smarter way of doing it.
Say i have a list of possible (or rather, known) values for a field, and I want to compare the current value of the field against all the known values to come up with some suggestions to change the current value into a known value. Much like how a spell checker works, only with phrases that contain more then 1 word. My basic algorithm looks something like:
Step 1. Start with the first 2 characters, and grab everything out of the known list with those first 2 characters.
Step 2. Compare the first 3 characters with the first 3 characters of everything that was grabbed in step 1, move those to the top of the list.
Step 3. Repeat Step 2, with 4 characters and so forth until the entire length of the given string has been gone through, with the most likely matches at the top of the list.
Some background:
I have this HUGE Excel spreadsheet full of testing data on different non-metal materials. I need to get all that data into an Access Database. I'm currently making a custom dialog box that will crank through all the "Trade Names" and compare them to what "Trade Names" we already have in our Access Database. If no close match can be found, then the user has the option to insert the new trade name into the database.
If you can think of a better method of comparing what is in the spread sheet against the possible values in the database, i'd like to know! Thanks!!
-Nic
Link to comment
Share on other sites
2 answers to this question
Recommended Posts