1 00:00:00,430 --> 00:00:07,870 Now we'll just see one function call to English check, OK, and for example, if we just go to the 2 00:00:07,870 --> 00:00:12,310 interactive shell here, we have already imported this English. 3 00:00:12,730 --> 00:00:14,680 Now we say is chick. 4 00:00:15,560 --> 00:00:17,990 English, that is. 5 00:00:19,240 --> 00:00:30,220 English, check this in capital, in Brakhage, we give Biton and just do one string in this, you know, 6 00:00:30,790 --> 00:00:33,310 let's give another Cicek. 7 00:00:33,940 --> 00:00:37,990 English dot is English chick. 8 00:00:40,580 --> 00:00:42,620 Python and 50. 9 00:00:43,800 --> 00:00:44,730 Still, it is true. 10 00:00:44,970 --> 00:00:52,990 OK, so now it is evaluated in the first one of this python coma, 20 commodity 500 in the city, despite 11 00:00:52,990 --> 00:00:54,480 the outcome of 50 80. 12 00:00:55,230 --> 00:01:08,190 Now, if you see, for example, to check English is English, check and you'll give Python comma 50, 13 00:01:08,190 --> 00:01:09,360 comma 60. 14 00:01:10,380 --> 00:01:20,670 Still, it is true or if you want to give see chick English, that is English chick in Brakhage the 15 00:01:20,690 --> 00:01:27,410 string and you want to go a four letter or send a star is equal to 60. 16 00:01:27,810 --> 00:01:36,050 So it is evaluated now I say Biton, then 20, the default one for one person in the CIA and 60 percent 17 00:01:36,060 --> 00:01:36,960 is still in this case. 18 00:01:37,360 --> 00:01:37,710 OK. 19 00:01:38,710 --> 00:01:44,470 So now, for example, the one which we have seen here, we are calling the function when it is called 20 00:01:44,470 --> 00:01:50,050 the second and third parameter specified program use, those parameters are not the default ones. 21 00:01:50,410 --> 00:01:53,740 Now, let's move back to our calculating percentages. 22 00:01:54,130 --> 00:01:59,080 Now, once we know the percentages are program will use, we will need to calculate the percentage, 23 00:01:59,080 --> 00:02:00,550 what the message is disastrous. 24 00:02:01,480 --> 00:02:05,310 For example, let us assume that we are having C.. 25 00:02:05,830 --> 00:02:07,300 We just put this in the comment. 26 00:02:07,720 --> 00:02:18,730 OK, so we are having the string AC Biton, then one more vote, say OK, then we take some more again. 27 00:02:18,730 --> 00:02:19,390 Some more. 28 00:02:19,640 --> 00:02:21,540 OK, now again, some more. 29 00:02:21,640 --> 00:02:27,970 Now this particular string is having five votes, but in that case only, let's say, will make one 30 00:02:27,970 --> 00:02:28,270 more. 31 00:02:29,020 --> 00:02:31,020 Who is out of this? 32 00:02:31,030 --> 00:02:32,670 Only three votes are English. 33 00:02:32,980 --> 00:02:37,900 Now to calculate the percentage of English words in the string, you will have to divide the number 34 00:02:37,900 --> 00:02:41,330 of English words by total number of votes and multiply it by a hundred. 35 00:02:41,650 --> 00:02:47,620 So the percentage of English words in this case would be something like, say, three, divided by five, 36 00:02:47,860 --> 00:02:53,350 multiplied by a hundred, OK, which would be, for example, 60 percent in this case. 37 00:02:53,620 --> 00:03:00,750 OK, now similarly, suppose you have the number of English votes, says three or six. 38 00:03:00,760 --> 00:03:01,570 Let's take it now. 39 00:03:01,570 --> 00:03:03,640 Six and the number of votes. 40 00:03:04,540 --> 00:03:12,610 So again, if we say here six divided by, say, 10 multiplied by hundred would also come to sixty, 41 00:03:12,850 --> 00:03:14,370 or in that case they'll be gone. 42 00:03:14,380 --> 00:03:19,770 Almost thirty two English votes out of eighty seven multiplied by a hundred. 43 00:03:19,780 --> 00:03:23,650 This could give you something like forty six point seventy eight. 44 00:03:24,970 --> 00:03:32,830 For example, or zero English words, and then total votes multiplied by 100 will give you the value 45 00:03:32,830 --> 00:03:33,100 zero. 46 00:03:33,460 --> 00:03:37,960 OK, so this way we may have all different percentages calculated in this case. 47 00:03:38,250 --> 00:03:44,920 Now, the percentage will always be between zero percent, meaning no votes are English and 100 percent 48 00:03:44,920 --> 00:03:46,480 meaning all the votes are English. 49 00:03:46,750 --> 00:03:48,870 OK, so other is English or English. 50 00:03:48,880 --> 00:03:54,670 Check function will consider a string English if it is at least 20 percent of the vote existing in the 51 00:03:54,670 --> 00:03:56,670 dictionary and the rest. 52 00:03:56,680 --> 00:03:59,410 Eighty five percent of the correct those in the string of letters. 53 00:04:00,850 --> 00:04:08,110 Now this means the message will still be detected as English, even if the dictionary file is imperfect, 54 00:04:08,110 --> 00:04:13,030 or if some words in the message are something other than what we define as English words. 55 00:04:13,360 --> 00:04:19,690 OK, so now if we come back to our program, let us just remove this line in our program over here where 56 00:04:19,690 --> 00:04:25,510 we are calculating the percentage to recognize the English words in the messages by passing the message 57 00:04:25,510 --> 00:04:30,760 is start to get English comp, which does the division, and returns the floor between zero point zero 58 00:04:30,760 --> 00:04:32,750 and one point zero over here. 59 00:04:33,070 --> 00:04:39,090 OK, so we are seeing more majesty that is equal to get English or get English word count positive as 60 00:04:39,100 --> 00:04:44,240 a gesture multiplied by hundreds, if that's more than equal to the word percent this year. 61 00:04:44,560 --> 00:04:50,140 Now to get a percentage from this float multiplied by hundred if the resulting number is greater than 62 00:04:50,140 --> 00:04:56,290 or equal to four percent parameter through iStore in the word match, OK, otherwise false will be stopped. 63 00:04:56,770 --> 00:04:57,050 OK. 64 00:04:57,070 --> 00:05:02,950 Now similarly, if we go on to the next line where we are saying no to is equal to the length of removing 65 00:05:02,950 --> 00:05:06,120 one letter last year and passing the messages still to it. 66 00:05:06,430 --> 00:05:12,010 OK, we have written this function to find all the letters and space characters in a string, so we 67 00:05:12,010 --> 00:05:13,580 just need to reuse it. 68 00:05:13,780 --> 00:05:20,950 OK, similarly, if we see call to remove letters and the only one to get a string of just the letters 69 00:05:20,950 --> 00:05:26,030 and the space characters in the message is still not passing the string to the length function of the 70 00:05:26,360 --> 00:05:29,630 return total number of letters in space in the message. 71 00:05:29,920 --> 00:05:33,790 OK, the next line over here that we have is sending a message. 72 00:05:33,790 --> 00:05:40,420 Letter percentage is still is equal to convert to flow number letters divided by the length of messages 73 00:05:40,750 --> 00:05:41,510 in two hundred. 74 00:05:41,890 --> 00:05:47,170 Now over here we are getting the percentage of the letters by getting a flawed version of the integer 75 00:05:47,170 --> 00:05:50,560 in numbers and dividing it by the length of the message. 76 00:05:50,890 --> 00:05:56,140 The return value of this will be a total number of characters in our message is still OK. 77 00:05:56,150 --> 00:06:02,650 So as discussed previously, the call to float is made to make sure that this particular line performs 78 00:06:02,650 --> 00:06:05,350 a regular revision instead of integer division. 79 00:06:05,350 --> 00:06:10,140 Just in the case of the program to import your checking list, model is running on Python. 80 00:06:10,840 --> 00:06:19,090 OK, next, we check whether the percentage in our message a little percentage is greater than or equal 81 00:06:19,090 --> 00:06:20,620 to the letter percent this year. 82 00:06:20,920 --> 00:06:25,800 And this expression evaluates to a boolean value that is stored in the letters match SGA. 83 00:06:26,200 --> 00:06:28,630 Now we want is English check to return. 84 00:06:28,630 --> 00:06:36,880 True, only if both the word match is still that is in the first line and our letter match is in the 85 00:06:36,880 --> 00:06:38,680 second last line contains true. 86 00:06:39,190 --> 00:06:43,210 OK, so we have combined these values into expression using an angle. 87 00:06:44,050 --> 00:06:47,800 So we are saying little more magisterial and later majesty. 88 00:06:48,280 --> 00:06:55,030 So if both the four match and the letter match variables are true, that is the is English check will 89 00:06:55,030 --> 00:07:01,810 declare the message is English and return the value to otherwise reject it as a non English and return 90 00:07:01,810 --> 00:07:02,350 the value. 91 00:07:02,350 --> 00:07:02,900 Folson. 92 00:07:02,920 --> 00:07:04,110 That's OK. 93 00:07:04,480 --> 00:07:10,650 So in this way, we have created this particular file that is genuinely stoppie by file. 94 00:07:10,990 --> 00:07:17,620 Now in the next session, we will see how to use this in another file for checking the transposition 95 00:07:18,530 --> 00:07:19,980 transposition cipher in that.