subject

KeyboardDistance is similar to LevenshteinDistance, it houses a single method, distance(x, y). It is very often the case that, when users are typing on a keyboard, they don't make random errors but they mistakenly press adjacent keys. Searching for all potential combinations of this type of mispellings would require programming techniques that we haven't yet covered, therefore, we're going to implement an oversimplified version of this concept. So, we will make the following assumptions:. • A mispelled word will have the same length with the respective correct word (i. e. mispellings do not add/remove characters, they only alter the existing ones).
• There won't be more than one mispellings in a single word.
• For a misspelling to count as a misspelling, the user must have pressed the adjacent key that is either to the left or to the right of the intended key (1.e. not the key above below or any other key that is not adjacent).
• The distance of a mispelled word from a correct word depends on the location of the mispelling: if the mispelling is in the first character, the distance is 1, if it's in the second character, the distance is 2. and so forth. If the two words are the same, the distance is 0. If the two words cannot count as a misspelling of each other, the distance is infinite (i. e. assign the maximum value that corresponds to the type of variable you declared). It goes without saying that this is a naive formula for a string distance but our goal here is different.
• We will only consider one keyboard layout, the one depicted in this link. A mistyping can occur only in the 26 characters of the alphabet (i. e. not in numbers, special characters, etc.)
• Characters A and z have one mistyping only: the characters 5 and X respectively i. e. disregard the caps lock and the shift keys). So, for example:
• A mistyping of 'U' will become either an 'Y' or an 'I'
• A mistyping of 'S' will become either an 'A' or a 'D'
• A mistyping of 'A' can only become 'S' . Words unn and univerdity have a distance of 7
• Words mason and mason have a distance of 0
• Words Mason and MASON have an infinite distance Unit Testing We haven't provided JUnit tests for this class. You must write your own tests and put them in keyboardDistanceTests. java

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:50, williamsgregg5214
Drag each label to the correct location on the image list the do’s and don’ts of safeguarding your password. a. keep yourself logged in when you leave your computer. b. don’t write your password down and leave it where others can find it. c. share your password with your friends. d.each time you visit a website, retain the cookies on your computer. e. use a long password with mixed characters.1. do's 2. don'ts
Answers: 2
image
Computers and Technology, 23.06.2019 18:40, brooklyn4932
How does is make you feel when you're kind to others? what are some opportunities in your life to be more kind to your friends and loved ones? imagine a world where kindness has be outlawed. how would people act differently? would your day-to-day life change significantly? why or why not?
Answers: 2
image
Computers and Technology, 24.06.2019 10:00, shrafe
Which two technologies support the building of single-page applications?
Answers: 2
image
Computers and Technology, 24.06.2019 18:30, WATBOI01
What is the local portion of the e-mail address below? twrigley@gumchewer. biz a.) @ b.) biz c.) gumchewer d.) twrigley
Answers: 1
You know the right answer?
KeyboardDistance is similar to LevenshteinDistance, it houses a single method, distance(x, y). It is...

Questions in other subjects:

Konu
Health, 09.09.2020 21:01
Konu
Mathematics, 09.09.2020 21:01
Konu
Mathematics, 09.09.2020 21:01
Konu
English, 09.09.2020 21:01
Konu
Mathematics, 09.09.2020 21:01
Konu
History, 09.09.2020 21:01
Konu
Mathematics, 09.09.2020 21:01
Konu
Mathematics, 09.09.2020 21:01
Konu
Chemistry, 09.09.2020 21:01
Konu
Mathematics, 09.09.2020 21:01