hello i need help here please asap I have a Chrome extension that records the da
ID: 3904979 • Letter: H
Question
hello i need help here please asap
I have a Chrome extension that records the date, time spent, and url of sites visited in a popup window. I would like to categorize the urls into five (or more) basic categories and place that category in the popup. I have seen web categorization APIs online. However, perhaps this is more simple than that. I just want to scan the url and then pretty much attach a label to it and display it. For example, anything with the word store in it could be categorized as "Retail" or .gov as "Government". What is the best way to do this?
Explanation / Answer
Q1) I just want to scan the url and then pretty much attach a label to it and display it
First you have create a Map of what words in the URL of the webiste should match what Labels you want
eg <gov, "Government">, <"org", "Organisation">, <"in", "Retails">, <"com", "Company"> etc
Now scan the URL and split the URL based on "." dot
https://portal.incometaxindiaefiling.gov.in/e-Filing/UserLogin/LoginHome.html#
After this store each splitted String so obtained in an array and check if either of the splitted strings matches with the key of the Map that we have created. If key is matched, then the corresponding Label will tell you what type of site is that.
In this your Map has to be very very exhaustive as there could be multiple keys that can match to same Label for a particular website:-
eg:- https://portal.incometaxindiaefiling.gov.in/e-Filing/UserLogin/LoginHome.html# ---> This is Government
https://tin.tin.nsdl.com/pan/newpanforeign.html ---> This too is Governement site but here nsdl is the key to identify the fact that I have stated above.
Please let me know in case of any clarifications required. Thanks!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.