appledict2semantic
appledict2semantic is a Python tool to convert Apple Dictionary HTML files into clean, semantic HTML. It removes the dependency on the custom CSS by mapping span class names to appropriate semantic HTML tags and structural markup, making the output more readable and portable.
Screenshots
Before conversion:
After conversion:
Features
- Span-to-semantic conversion: Converts Apple Dictionary’s
<span class="...">elements into semantic HTML tags like<strong>,<em>,<u>, and more. - Structural transformation: Transforms sense and subsense blocks into nested lists
<ul>,<li>for better readability. - Block conversion: Converts etymology, phrase (verb), derivatives, and usage note blocks into more meaningful HTML structures. This paves way for further processing, e.g. to convert to Markdown.
- Cleanup: Removes unnecessary or empty tags, and replaces bullet spans with proper list items.
- Batch processing: Supports processing single files or entire folders, with optional in-place replacement.
Installation
Make sure that you have Python 3.10 or higher installed.
Then install the package from PyPI:
pip install appledict2semantic
Obtaining and extracting Apple Dictionary HTML files
How to obtain
To obtain the Apple Dictionary data, first you need to have a macOS.
Then, open the Dictionary app, select Dictionary > Settings. Choose the sources you want to download.
The dictionary files are stored in /System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX.
How to extract
Install pyglossary:
pip install pyglossary
Then use pyglossary to point to the Body.data file in the .dictionary folder, and convert to AppleDict Source. This will produce an XML file.
From there, use this script to extract the XML file to HTML files.
For more information about the Apple Dictionary binary format, see here.
Usage
-
Converts a single Apple Dictionary HTML file to semantic HTML:
appledict2semantic --single input.html output.html
-
Processes all .html files in
input_folder, saving results tooutput_folder:appledict2semantic --multiple input_folder output_folder
-
Processes all .html files in
input_folder, replacing the original files:appledict2semantic --multiple input_folder --replace
You will need to confirm the action.
Changelog
See changelog.md for the latest changes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for appledict2semantic 1.3.1
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 |
|---|---|---|---|---|
| appledict2semantic-1.3.1.tar.gz | 328.2 kB | With provenance | Details for appledict2semantic-1.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| appledict2semantic-1.3.1-py3-none-any.whl | Python 3 | none | any | Details for appledict2semantic-1.3.1-py3-none-any.whl |
Total release size: 347.0 kB
Release files / appledict2semantic-1.3.1.tar.gz
| Download URL | appledict2semantic-1.3.1.tar.gz |
|---|---|
| Size | 328.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c32e22582c43710baf8af59a7b48ea59d9b43e1abefa8e025be74949f6a72348
|
|
BLAKE2b-256 checksum How to use checksums |
638b7d76feb1e781658abe17543aa45216eee182bf7d7cb5dae03af718535c51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2025.
Transparency logRelease files / appledict2semantic-1.3.1-py3-none-any.whl
| Download URL | appledict2semantic-1.3.1-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85858402e25fed8b0e05c92bf723fecf4119c8364c3f8c406e1123eb7af6fd25
|
|
BLAKE2b-256 checksum How to use checksums |
a696d5f3f488e8c25941bee588633b14281904a26c2a3bbfb2623ca811ede20a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2025.
Transparency logSecurity for appledict2semantic 1.3.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for appledict2semantic-1.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2025.
Transparency logA 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.