0

Hello, i am making a keyboarding site for my class, and i have a div with some text inside, when they type, i want to check if the text matches the text in the div, if it dosn't, i wan't to update a box with an "error count". How can i achive this?

4
Contributors
8
Replies
10
Views
5 Years
Discussion Span
Last Post by Troy III
0

for error count you could just simply loop through each character and compare to make sure they match. This has a problem though, if, for instance, the person types an extra space but doesn't correct for it, every character after the space will be wrong.

0

Exactly. Same happens for any omission or extra character. It's not a fair measure of fidelity as it penalises an early error far more than a late error.

I wonder if John Resig's Javascript Diff Algorithm might offer a way ahead? It won't give an error count but instead will generate a version of the typed string, highlighted on a word-by-word basis to indicate its differnece from the original. That's the best I can come up with.

DEMO

Edited by Airshow

1

Hello, i am making a keyboarding site for my class, and i have a div with some text inside, when they type, i want to check if the text matches the text in the div, if it dosn't, i wan't to update a box with an "error count". How can i achive this?

Is this a typing practice class?

Votes + Comments
Yes this is for a class in my highschool. I am making it for my teacher
0

Actually, it shouldn't be too hard to take that js file and have it output the number of errors as well. Good find Airshow.

0

Mmm, not so trivial Stb because the algorithm works on whole words rather than individual characters.

It helps to space-separate every character in the strings :

DEMO

But the behaviour is not perfect. Total errors should be the sum of "Errors" and "Omissions", however :

  • A single incorrect character results in an Error and and Omission.
  • It's hard to find a reliable way to suppress "omissions" for the as yet unattempted part of the text.
  • The algorithm isn't tollerant of gross errors; try typing "Pleeze retipe that."
0

So how exactly would i do this? I'm more used to coding with php/html/css. And i'm more learning java. And this is confusing me,

I wan't it to count the errors. And show them which character they should be typing at the momment, so like highlet, or underscore the character there currently typing

Oh and by the way sorry it took a while to respond, it hasn't been letting me log into daniweb :(

Edited by zacharysr

0

And finally:
are you interested in counting all the typing errors as you go, or only the errors reflected at the final output?

The answer to this question is very important since it shapes the backbone of the algorithm.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.