Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text comparisation....?

Status
Not open for further replies.

Bramvg

IS-IT--Management
Jan 16, 2001
135
BE
Hi,


I have one text in a database [+- 10 sentences] and a sound file with a dictation.

My users have to typ the text they hear into a textarea.
Once done they click on OK and than I want to compare the two texts and see how many mistakes they've made.

Is this possible, and how? :-=

Taking into consideration:

1. Special characters can be 'deleted'
2. Uppercase/lowercase does not matter
3. When someone forgets a word this doesn't mean the rest of the sentence is wrong (this would happen if you compare word by word....

Any help more than welcome !!!
Bram






 
Ok just so I understand correctly...
1. Do you mean you're not checking for special characters, so when doing the comparison, you'd like to ignore them?

2. Makes sense

3. I'm lost on this one. You want to compare sentences, but not words? Can you give me a "for example?" I think this is easily done, but need a little more info so I don't tell you the wrong thing. Kevin
slanek@ssd.fsi.com
 
Hi Kevin,

Thanks for the reply!

Here some answers:

1. Indeed, when comparing the two textes you could 'get rid' of all the special characters.

2. OK

3. Well, I'll give an example:

3.1 Suppose this is the 'source' text (as stored in the database and is the correct text):
----------------------------------------------
"Yesterday I went to the shop"

3.2 The sound files 'speaks' this text and user has to typ the text, but he writes:
--------------------------------------------------
"Yesterday I want the shop"


Only 2 mistakes are made:

1: 'want' had to be wEnt
2: Now, the difficult part ;-)

The problem is: how to compare these two texts?
If you check word by word (delimter = 'space') the problem occurs that everything after to (the shop) is wrong, however: 'the shop' is spelled correctly.

BUT:

If you check word by word you get this:

Yesterday -> Yesterday
I -> I
went -> want [OK 1 fault here]
to -> ... (not filled in, but will be compared with the).
Which is wrong. Because the next word he will check is:

the -> he will compare it with: shop, because in the sentence of the user he/she forgot to typ: 'to' (the shop).

Is this clear?

Regards
Bram







With many thanks.
Bram


 
Hmmmm. This is an interesting one.

What if you:
1. Strip out the special characters from the source text and the text to compare.

2. First do a plain match. If it works, then you're done. If not, proceed to the next step.

3. Do a ListToArray with space as the delimiter on both so you have two separate arrays. array1 will be the stored text and array2 will be the typed text.

4. Start by comparaing array1[1] to array2[1] if they match increment both. Compare array1[2] to array2[2] and so on. This will give you a word-by-word comparison on your own terms. You'll have much greater control of how and when the comparisons are made.

There are so many variables here that it would take a while to tailor this thing to catch everything that could be thrown at it, but it may be a start. Kevin
slanek@ssd.fsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top