A set of similarity metricts to compare html files.
Project description
This package provides a set of functions to measure the similarity between web pages.
Install
The quick way:
pip install html-similarity
How it works?
Structural Similarity
We use sequence comparison fo the html tags to compute the structural similarity instead of tree edit distance because tree edit distance is slower than sequence comparison.
The idea of sequence comparison was taken from Page Compare.
Style Similarity
Extracts css classes of each html document and calculates the jaccard similarity of the sets of classes. The idea was taken from [1]
Joint Similarity (Structural Similarity and Style Similarity)
The joint similarity metric is calculated as:
k * structural_similarity(document_1, document_2) + (1 - k) * style_similarity(document_1, document_2)
This was taken from [1]
The value is in the interval of 0 and 1.
Recommendations for joint similarity
Using k=0.3 give use better results. The style similarity can gives more information about the similarity rather than the style.
References
Development
See CONTRIBUTING.md file
TODO
[ ] Add information about the package in pypi
[ ] Add documentation
[ ] Add examples
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for html_similarity-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f801a3dd9901c40b1824a57dc394dfcd846faf60e47dba9664b158a4cadebdaa |
|
MD5 | 19ffc0da36c017cefd92210da00fadd4 |
|
BLAKE2b-256 | 9f862b6384bf252c241fbde594b6598c97e8e037ac7b9c83c139b358df3c6cd2 |