How do I compare text within % error ?

Get help using Construct 2

Post » Mon Jul 13, 2015 6:57 am

i need to compare the input of a text with the correct answer.

let's say Matrix is the correct answer

the user is entering matrixe

how can i say that this answer is good accepting a degre of tipping faults ?
B
16
S
3
Posts: 106
Reputation: 1,408

Post » Mon Jul 13, 2015 8:43 am

Well.... that's a whole question in itself. It really depends how far down the line you want to go. Perhaps something like, for each character in the correct answer, find the nearest character in the typed answer, work out the character difference and probably raise it by a power 1.5 or something so further away scores increasingly worse. I'd remove all controls, punctuation and case before you test.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Mon Jul 13, 2015 9:27 am

paulscottrobson wrote:It really depends how far down the line you want to go.


Very true..
The easiest way would probably create the list of common (typing/spelling) mistakes yourself and check that against the answer..
Otherwise it would consist of checking if the right answer is somewhere in there, by comparing the length of the answer, each letter compared to the right answer, etcetera..
If you want to go that way you should look at the system-expressions for strings/text..

I guess you are looking for some kind of implementation of the LevensteinDistance-algorithm..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jul 13, 2015 6:21 pm

ok, i think i'll use array with variante and errors possiblities, it looks less complicate for me.

thanks
B
16
S
3
Posts: 106
Reputation: 1,408

Post » Wed Jul 15, 2015 4:32 pm

An example of levenshtein distance in C2:
viewtopic.php?f=149&t=149869&p=950908#p950908
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Thu Jul 16, 2015 2:09 pm

i have to understand how you did that it looks really nice!
B
16
S
3
Posts: 106
Reputation: 1,408


Return to How do I....?

Who is online

Users browsing this forum: AndreasR, tarek2 and 12 guests