On the Ubuntu packages website (as well as on the Debian packages website), the page for each package contains a list of "similar packages." For example, on the page for Kate in the Bionic repository, the sidebar on the right provides a list of similar packages:
I cannot find any information in the documentation or anywhere else about how this list is calculated. I suspect that packages.debian.org is using a different data set than Ubuntu, since the similar package lists on Debian's site are often different. For example, the Debian Stretch page for Kate lists
as similar packages.
What I am looking for is an automatic way to get the list of similar packages for a given package from the terminal. i.e., I want some function which takes the name of a package as input and returns the list of similar packages that are shown on the packages website. It would probably be possible for a web crawler to scrape the package list, but it seems to me like there should be a better way to do it.
As far as I can tell from searching through documentation, the similar package lists are not visible to apt, apt-cache, synaptic, or any of the other front-ends for dpkg that I know of. Is this information available anywhere other than the package websites? If not, is there an API I should use for packages.debian.org or packages.ubuntu.com rather than using a web scraper?