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

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:00
How can data be added to a new table in data base
Answers: 1
question
Computers and Technology, 21.06.2019 22:00
Your task this week is to write a very simple spam classifier in python. it will classify messages as either spam (unwanted) or ham (wanted). the program will have a set of spam_words, words that are known to appear in spam messages. that set is included in the template file spam.pypreview the document. you will also define a spam threshold which reflects the allowed percentage of spam words in the message. you'll compute a 'spam indicator', which is the ratio of spam words to the total number of unique words in the message. if the spam indicator exceeds the spam threshold, the message is classified as spam. otherwise it is classified as ham. we'll assume that the spam threshold is a constant and has a value of 0.10. your program will prompt the user for a message and then will print the corresponding spam indicator with two decimal digits and the corresponding classification (spam or ham). the program will be case insensitive. the spam words are detected whether they are in lower case or upper case or mixed case. each word, spam or not, is counted once (even if it appears multiple times in the message.) the program will remove punctuation from the message before identifying the words and computing the spam indicator. for example '! ' must be identified as the spam word 'now'.
Answers: 3
question
Computers and Technology, 22.06.2019 10:40
5. illustrate how fine-line inventory classification can be used with product and market segments. what are the benefits and considerations when classifying inventory by product, market, and product/market?
Answers: 2
question
Computers and Technology, 22.06.2019 12:10
Linux is distributed under gnu gpl. why is this important? a. it ensures that only torvalds can profit from the sale of linux b. it prevents unknowledgeable users from downloading programs they don't know how to operate. c. it provides protection for the developers who created linux. d. it states that anyone can copy, modify, and share the program if changes are made public.
Answers: 1
You know the right answer?
KeyboardDistance is similar to LevenshteinDistance, it houses a single method, distance(x, y). It is...
Questions
question
Mathematics, 07.10.2020 14:01
question
Biology, 07.10.2020 14:01
question
Mathematics, 07.10.2020 14:01
question
Mathematics, 07.10.2020 14:01
Questions on the website: 13722367