WEBVTT

00:05.150 --> 00:06.590
Hi everyone welcome back.

00:06.800 --> 00:13.640
So in this video we're going to start designing a new API which will be basically handling similarity

00:13.640 --> 00:14.290
of dicks.

00:14.300 --> 00:21.560
Are you going to write what the objective of this API is a similarity of text so sometimes people call

00:21.560 --> 00:24.560
this plagiarism plagiarism check.

00:24.590 --> 00:25.850
So what does this really mean.

00:25.850 --> 00:32.180
So if you've ever submitted like an assignment in college or something like that then usually they would

00:32.180 --> 00:36.110
have something called a playgoer as test where they would take your assignments.

00:36.110 --> 00:38.090
Let's say you sent an assignment right.

00:38.090 --> 00:44.000
You wrote it and then they have a bunch of other assigned documents in assignments right gathered from

00:44.000 --> 00:50.080
the Internet and then they would take your document and compare it to each one of these documents.

00:50.240 --> 00:52.370
And then they would see how much of a similarity.

00:52.460 --> 00:54.030
Like the maximum similarity.

00:54.050 --> 00:57.210
So I say there's a document here which is very similar.

00:57.200 --> 00:59.470
So for example 30 percent similar.

00:59.630 --> 01:04.550
So they would tell you that hey your document or they would tell your instructor hey this document is

01:04.550 --> 01:07.480
30 percent similar to this document over here.

01:07.910 --> 01:12.500
And you know he should manually check it make sure that you haven't just copied stuff from here right

01:12.530 --> 01:14.760
because that would be plagiarism.

01:14.780 --> 01:20.780
So the API that we're going to be developing in this coming few videos is a similarity of text or a

01:20.780 --> 01:22.990
playgoer as a test to check.

01:23.000 --> 01:30.320
We're going to be given to X so two documents or two strings if you need to do strings 1 and 2 and then

01:30.350 --> 01:35.510
using these two we want to compare their similarity and where we want to say okay how similar is the

01:35.510 --> 01:38.210
first document to the second or the opposite.

01:38.210 --> 01:42.190
How similar is the second document to the first document.

01:42.440 --> 01:42.950
Right.

01:42.950 --> 01:46.620
So this is basically the idea of the API that we're developing.

01:46.820 --> 01:53.810
So in this video we're going to be looking at the chart protocol protocol chart that we usually discuss

01:53.810 --> 01:57.240
before going into developing or designing the API.

01:57.260 --> 01:57.630
Right.

01:57.650 --> 02:02.170
Because we always make sure we know at least the architecture of our API.

02:02.730 --> 02:03.270
OK.

02:03.350 --> 02:04.220
So let's get started.

02:04.220 --> 02:05.930
So what are our resources.

02:05.930 --> 02:08.490
Let's first talk about resources.

02:08.690 --> 02:13.190
Well in an API like this the first thing we want is of course to register right.

02:13.190 --> 02:19.420
We want the ability to register a user right a new user or a new user.

02:19.430 --> 02:21.650
This is one of our resources right there.

02:21.680 --> 02:22.790
How can I.

02:23.000 --> 02:24.480
Let's just do a line here.

02:24.530 --> 02:29.060
So this is one of the resources that we should give to the user right that he would be able to register

02:29.060 --> 02:30.260
into our API.

02:30.470 --> 02:41.920
So that's one and then another one is to select is to detect similarity similarity off documents right

02:41.970 --> 02:42.790
off docs.

02:42.800 --> 02:43.890
I'm just going on right dogs.

02:43.900 --> 02:44.410
OK.

02:44.530 --> 02:45.850
So that's another one right here.

02:45.900 --> 02:51.670
Give us two attacks and then you and he would see the similarity between these two.

02:51.720 --> 02:53.820
Do the two documents right.

02:54.040 --> 02:59.530
And then the last one is well we haven't implemented this feature in the previous API.

02:59.710 --> 03:05.960
But if you remember Usually when a user uses one of these for example he detects the similarity of two

03:05.980 --> 03:09.120
documents we usually take away minus one token from him.

03:09.130 --> 03:09.830
Right.

03:10.540 --> 03:15.150
To subtract or to simulate what would happen if he had to pay.

03:15.150 --> 03:15.600
Right.

03:15.790 --> 03:20.570
So we're also I mean finding an additional feature here called refill.

03:20.590 --> 03:21.100
OK.

03:21.220 --> 03:28.410
So basically what refill is allows the admin of this API the administrator of this API to be able to

03:29.020 --> 03:34.090
to increase the quota of the of the tokens for one of the users right.

03:34.090 --> 03:38.500
So let's say one of the users is called ABC.

03:38.530 --> 03:39.020
Right.

03:39.130 --> 03:46.780
So ABC would pay for example to the to the API owners for example $5 for 1000 tokens.

03:46.870 --> 03:55.660
So the API owner would refill his API using 1000 tokens write extra tokens to this user.

03:55.690 --> 03:56.240
OK.

03:56.410 --> 03:59.630
So we're going to be implementing three three features right.

03:59.670 --> 04:00.430
The refill.

04:00.430 --> 04:01.530
This is the new one.

04:01.540 --> 04:03.160
And the Detect are the new ones.

04:03.250 --> 04:07.100
The Register we've talked about it and implemented something similar.

04:07.540 --> 04:08.820
Now what about the you or else.

04:08.850 --> 04:09.240
OK.

04:09.250 --> 04:11.770
How are we going to access these resources.

04:11.770 --> 04:19.180
Well for the Registered User we can just use Flash register and for the detecting of similarity we can

04:19.180 --> 04:26.560
just use Flash detect and for their refill we'll as the name might suggest we just we might use refill.

04:26.560 --> 04:27.140
Right.

04:27.420 --> 04:28.120
Okay great.

04:28.120 --> 04:31.330
So now we know the resources we know that you are those.

04:31.480 --> 04:35.050
What about the method the method of transportation.

04:35.050 --> 04:37.970
Is it a get up post a delete.

04:38.260 --> 04:44.760
Well for the registry and you user it is post right because the user is going to be sending us his username

04:44.800 --> 04:47.080
and password right in NJCAA.

04:47.110 --> 04:51.880
So it's a post similar lead for detecting off similarity of documents.

04:51.880 --> 04:57.540
It's also going to be post because the user will send us the two documents estranges right.

04:57.550 --> 05:04.400
So if the user sends these do documents then he has to send them using post finally refill the free

05:04.460 --> 05:12.360
fall that the administrators going to be sending How many points or how many tokens you wants to refill

05:12.630 --> 05:15.870
and which user he wants to refill these points.

05:15.870 --> 05:17.940
So he also has to send some information.

05:17.940 --> 05:24.370
So this is also going to be Post OK so now let's talk about parameters.

05:24.390 --> 05:28.850
What do we need from the user who's who's using this.

05:28.860 --> 05:29.450
OK.

05:29.580 --> 05:32.300
So the first one is to register a new user.

05:32.410 --> 05:36.320
Well what are we what what might we need from the user.

05:36.360 --> 05:41.570
Or we might need the user name that he wants and the password password.

05:41.660 --> 05:44.450
Just right P.W. short.

05:44.550 --> 05:49.680
OK so what about the detect OK for the detector of the similarity.

05:49.710 --> 05:56.360
We first need to make sure that the user has the correct has enough tokens to use our service right.

05:56.460 --> 06:00.590
So we need his username we need his password.

06:01.110 --> 06:04.820
And we also need that to text that he wants to compare.

06:04.890 --> 06:09.020
So we need text 1 and text do right.

06:09.140 --> 06:11.540
We need both of these things.

06:11.670 --> 06:18.000
And finally for their resale Well we need a couple of things we need to know which user is going to

06:18.000 --> 06:22.340
be refilled so we get that from the user.

06:22.590 --> 06:28.010
We also need the administrative password so-so admin password.

06:28.050 --> 06:29.630
So what do we need the admin password.

06:29.640 --> 06:33.980
Well if we leave this API and just open to anyone.

06:34.080 --> 06:41.130
Well if a user runs out of tokens if he knows where a slash refill is he might just say slash freeflow

06:41.220 --> 06:44.170
and then send his username and tokens.

06:44.370 --> 06:45.060
1 million.

06:45.060 --> 06:45.290
Right.

06:45.290 --> 06:49.580
So you would essentially add 1 million tokens to his account right.

06:49.590 --> 06:51.770
So this is you know this is not right.

06:51.870 --> 06:53.640
He has to pay for these tokens.

06:53.820 --> 06:59.930
So the idea here is we add an admin password which only the API owner knows.

07:00.040 --> 07:09.660
And so if you want to add some tokens to a user it has to use the slash refill the back or slash refill

07:09.700 --> 07:16.740
your L and he has to give the correct an industry that white only could you or only the API owner could

07:16.740 --> 07:19.510
use this and here slash refill.

07:19.740 --> 07:22.530
And also we need to know how many how many points.

07:22.530 --> 07:30.880
Right so a refill amount right to a refill amount how many tokens do I need to refill to this user Okay

07:30.890 --> 07:33.360
so finally statis good.

07:33.710 --> 07:38.240
What are we going to return to user in different case scenarios.

07:38.240 --> 07:41.440
Well lets start with a simple one with registration.

07:41.750 --> 07:44.650
Well we might the user might have registered just fine.

07:44.660 --> 07:46.630
So you might have have 200.

07:46.640 --> 07:47.190
OK.

07:47.210 --> 07:47.660
Right.

07:47.730 --> 07:49.750
Is no problem here.

07:49.790 --> 07:53.180
Another one is we might have had three 302.

07:53.240 --> 08:01.930
So an error is if the user input an invalid username or username which already exists in the database

08:01.940 --> 08:02.390
right.

08:02.510 --> 08:07.490
So invalid user name right a user which already exists in our database.

08:07.520 --> 08:09.450
So invalid username.

08:09.880 --> 08:10.710
OK.

08:11.000 --> 08:13.910
Another one is.

08:14.120 --> 08:20.170
Well for now let's just leave it as that if we want to add more we can talk about it we can add it in

08:20.180 --> 08:21.500
later videos.

08:21.500 --> 08:24.980
OK so what about the detect all that detect has a couple of things right.

08:24.990 --> 08:27.190
It might have 200 again.

08:27.260 --> 08:27.820
OK.

08:27.830 --> 08:32.760
So no problems of detected the similarity of the documents.

08:32.930 --> 08:37.600
And I also have to return with it's a return similarity.

08:37.760 --> 08:38.340
Right.

08:38.360 --> 08:40.690
How similar are these two documents.

08:42.390 --> 08:43.170
What else.

08:43.320 --> 08:49.710
Well we also need the user might add in but a wrong user name right.

08:49.710 --> 08:53.890
He might have input in our user name which doesn't exist in our database.

08:53.890 --> 08:57.900
So 3 0 1 invalid username right.

08:57.960 --> 08:59.180
This is a wrong username.

08:59.190 --> 09:03.570
You can't use this username what else will 302.

09:03.630 --> 09:07.400
You might have 302 which is an invalid password.

09:07.530 --> 09:13.350
So the user inputs a user name which exists in our database but he gave the wrong password right.

09:13.470 --> 09:17.650
So we tell him hey you input the wrong the wrong password right.

09:18.090 --> 09:19.130
OK so what else.

09:19.140 --> 09:24.600
Well we also have three all three right which means out of tokens.

09:24.600 --> 09:25.000
Right.

09:25.020 --> 09:30.510
So the user username and password are correct but he doesn't have enough tokens.

09:30.610 --> 09:32.500
This is tokens over here.

09:32.760 --> 09:33.090
Right.

09:33.090 --> 09:34.950
So this is it for now.

09:35.010 --> 09:36.560
Finally what about refills.

09:36.570 --> 09:44.300
So Furbies we might have again 200 if everything goes smoothly and the tokens are added to this user

09:44.300 --> 09:45.220
name.

09:45.240 --> 09:48.760
We also have 3 0 1 right invalid username.

09:48.810 --> 09:51.150
So that means that this user name doesn't exist.

09:51.150 --> 09:56.220
So how are you going to try to add 100 tokens for example to a user name that doesn't exist.

09:56.220 --> 10:04.080
So we'll have three or one invalid invalid username and then we also should have an extra one which

10:04.080 --> 10:11.250
is three or four invalid and you might have guessed it admin password.

10:11.420 --> 10:13.560
So what is the username is OK.

10:13.570 --> 10:14.410
It exists.

10:14.420 --> 10:15.780
But this password is wrong.

10:15.800 --> 10:16.540
Then we don't.

10:16.550 --> 10:17.720
And the point is right.

10:17.840 --> 10:22.690
Because this might be just a hacker trying to add some token points to this user.

10:22.850 --> 10:28.130
So we have to check that this admin password is the correct admin password.

10:28.160 --> 10:33.250
So this is basically the API that we will be building this is the overall architecture.

10:33.470 --> 10:39.160
And in the next video we're going to start implementing the architecture the design of it and we're

10:39.170 --> 10:40.470
going to started from scratch.

10:40.470 --> 10:44.050
So we're not going to use any other code snippets.

10:44.240 --> 10:46.460
So yeah we're going to stop here.

10:46.490 --> 10:48.470
And until the next video decoding.
