This release is a pre-release and may not be stable for production use.
Homepage2Vec
Homepage2Vec: Language-Agnostic Website Embedding and Classification based on Curlie labels https://arxiv.org/pdf/2201.03677.pdf
Published @ International AAAI Conference on Web and Social Media (ICWSM)
Homepage2Vec is a pre-trained model that supports the classification and embedding of websites starting from their homepage.
Left: Projection in two dimensions with t-SNE of the embedding of 5K random samples of the testing set. Colors represent the 14 classes. Right: The projection with t-SNE of some popular websites shows that embedding vectors effectively capture website topics.
Curated Curlie Dataset
We release the full training dataset obtained from Curlie. The dataset includes the websites (online in April 2021) with the URL recognized as homepage, and it contains the original labels, the labels aligned to English, and the fetched HTML pages.
Get it here: https://doi.org/10.6084/m9.figshare.19406693
Getting started with the library
Installation:
Install the library with pip:
pip install homepage2vec
Note: Despite being optimized for GPUs, you can restrict the installation to a CPU-only usage with the flag --extra-index-url https://download.pytorch.org/whl/cpu during the pip installation.
Usage:
import logging
from homepage2vec.model import WebsiteClassifier
logging.getLogger().setLevel(logging.DEBUG)
model = WebsiteClassifier()
website = model.fetch_website('epfl.ch')
scores, embeddings = model.predict(website)
print("Classes probabilities:", scores)
print("Embedding:", embeddings)
Or if you have the HTML document already downloaded:
website = Webpage("<url>")
website.html = "..."
website.screenshot_path = "..." # optional
scores, embeddings = model.predict(website)
Result:
Classes probabilities: {'Arts': 0.3674524128437042, 'Business': 0.0720655769109726,
'Computers': 0.03488553315401077, 'Games': 7.529282356699696e-06,
'Health': 0.02021787129342556, 'Home': 0.0005890956381335855,
'Kids_and_Teens': 0.3113572597503662, 'News': 0.0079914266243577,
'Recreation': 0.00835705827921629, 'Reference': 0.931416392326355,
'Science': 0.959597110748291, 'Shopping': 0.0010162043618038297,
'Society': 0.23374591767787933, 'Sports': 0.00014659571752417833}
Embedding: [-4.596550941467285, 1.0690114498138428, 2.1633379459381104,
0.1665923148393631, -4.605356216430664, -2.894961357116699, 0.5615459084510803,
1.6420538425445557, -1.918184757232666, 1.227172613143921, 0.4358430504798889,
...]
The library automatically downloads the pre-trained models homepage2vec and XLM-R at the first usage.
Using visual features
If you wish to use the prediction using the visual features, Homepage2vec needs to take a screenshot of the website. This means you need a working copy of Selenium and the Chrome browser. Please note that as reported in the reference paper, the performance improvement is limited.
- Install the visual package of homepage2vec with
pip install homepage2vec[visual]. - Install the Selenium Chrome web driver, and add the folder to the system $PATH variable.
- You need a local copy of Chrome browser (See Getting started).
Getting involved
We invite contributions to Homepage2Vec! Please open a pull request if you have any suggestions.
Original publication
Homepage2Vec: Language-Agnostic Website Embedding and Classification
Sylvain Lugeon, Tiziano Piccardi, Robert West
Currently, publicly available models for website classification do not offer an embedding method and have limited support for languages beyond English. We release a dataset of more than two million category-labeled websites in 92 languages collected from Curlie, the largest multilingual human-edited Web directory. The dataset contains 14 website categories aligned across languages. Alongside it, we introduce Homepage2Vec, a machine-learned pre-trained model for classifying and embedding websites based on their homepage in a language-agnostic way. Homepage2Vec, thanks to its feature set (textual content, metadata tags, and visual attributes) and recent progress in natural language representation, is language-independent by design and generates embedding-based representations. We show that Homepage2Vec correctly classifies websites with a macro-averaged F1-score of 0.90, with stable performance across low- as well as high-resource languages. Feature analysis shows that a small subset of efficiently computable features suffices to achieve high performance even with limited computational resources. We make publicly available the curated Curlie dataset aligned across languages, the pre-trained Homepage2Vec model, and libraries.
https://arxiv.org/pdf/2201.03677.pdf
Citation format
If you found the provided resources useful, please cite the paper:
BibTex
@inproceedings{lugeon2022language,
title={Homepage2Vec: Language-Agnostic Website Embedding and Classification},
author={Lugeon, Sylvain and Piccardi, Tiziano and West, Robert},
booktitle={Proceedings of the International AAAI Conference on Web and Social Media},
year={2022}
}
Chicago
Lugeon, Sylvain, Tiziano Piccardi, and Robert West. "Homepage2Vec: Language-Agnostic Website Embedding and Classification." In Proceedings of the International AAAI Conference on Web and Social Media, 2022
Dataset License
Creative Commons Attribution 3.0 Unported License - Curlie
Learn more how to contribute: https://curlie.org/docs/en/about.html
Metadata
Release files for homepage2vec 0.0.3rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| homepage2vec-0.0.3rc1.tar.gz | 14.5 kB | Without provenance | Details for homepage2vec-0.0.3rc1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| homepage2vec-0.0.3rc1-py3-none-any.whl | Python 3 | none | any | Details for homepage2vec-0.0.3rc1-py3-none-any.whl |
Total release size: 27.6 kB
Release files / homepage2vec-0.0.3rc1.tar.gz
| Download URL | homepage2vec-0.0.3rc1.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b502b7e032a9ca7ce359423b672c0e5049896a4a4aa400c868be8cfa3be81e9
|
|
BLAKE2b-256 checksum How to use checksums |
3125fa4e91d496d35afafb7a41f0ee01c8f3d53fcb3934046fe04a2df8eb721e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.3
|
Release files / homepage2vec-0.0.3rc1-py3-none-any.whl
| Download URL | homepage2vec-0.0.3rc1-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f5b90a8a30a048fa420b2f912a120f4607f923f38a2be9d6ad557ea0c7dea93
|
|
BLAKE2b-256 checksum How to use checksums |
7bb91122be6821060e1a79fde61fed658998aad7c7bf6f7ddd8a2d1a52415024
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.3
|
Security for homepage2vec 0.0.3rc1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.