- About the project
- Getting started
- Usage
- Examples
- Roadmap
- Contributing
- License
- Contact
- Acknowledgments
About the project 📌
This project aims to provide a simple way to annotate HTML with microdata by utilizing Deep Learning methods.
The main motivation behind this project is to manage the tedious task of annotating HTML with microdata. Microdata is part of the WHATWG HTML Standard and is used to nest metadata within existing content on web pages. Search engines greatly benefit from microdata and boost web pages in search results.
This project is made as part of thesis work in Institute of Information Technologies and Intelligent Systems for a bachelor's degree
Getting started 📌
Prerequisites 📌
- Python == 3.7
- pip 24.0+
- python3-virtualenv if running Linux
Installation 📌
- Clone repository
git clone [email protected]:i-timur/annotate-with-microdata.git
- Setup virtual environment
- MacOS
python3 -m venv venv source venv/bin/activate
- Windows
python3 -m venv venv .\venv\Scripts\activate
- Linux
virtualenv venv source venv/bin/activate
- MacOS
- Install dependencies
pip install -r requirements.txt
- Install this package
- Install the package globally
pip install -e .
Usage 📌
HTML used for commands below requires the following minimal structure:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Page Title</title>
</head>
<body>
<!-- Content -->
</body>
Annotate HTML by passing a URL to the shell command:
microdata annotate https://example.com
or by passing a path to the file with HTML:
microdata annotate ./path/to/file.html
IMPORTANT: DO NOT format HTML, when saving it to a file, pass it as is.
or by passing HTML directly to the shell command (NOT RECOMMENDED):
microdata annotate <HTML>
IMPORTANT: DO NOT format HTML, when passing it directly to the shell command, pass it as is.
Set output file with --output
option:
microdata annotate ./path/to/file.html --output ./path/to/annotated_file.html
Use --skip <CLASS>,<OTHER_CLASS>
option to skip items that are related to the specified classes:
microdata annotate ./path/to/file.html --skip Product,Book
Various texts may have similar semantic meanings, so for situations where the user already knows that certain classes have a high level of semantic similarity with other classes, or when the classification of a specific class is not required for other reasons, use this flag.
The confusion matrix below can give you the insight of the usage of this flag:
The model can misclassify a lot of entities as products. You can also see that the model struggles with choosing between the book and movie entities. This flag can help to avoid this issue.
You can set confidence threshold with --threshold
option (NOT RECOMMENDED). The default value is 0.75.
You can also pass --save-preprocessed
flag to save the preprocessed HTML to a file.
Following entities are currently supported:
- Product
- Book
- Event
- Hotel
- JobPosting
- Movie
- Recipe
- Restaurant
- Organization
- Place
- Person
- PostalAddress
- Creative Work
- LocalBusiness
- Painting
Examples 📌
Roadmap 📌
- Add HTML validation
See the open issues for a full list of proposed features (and known issues).
Contributing 📌
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License 📌
Distributed under the MIT License. See LICENSE.txt
for more information.
Contact 📌
Timur - [email protected]
Project Link: https://github.com/i-timur/AnnotateWithMicrodata