Skip to main content

SPDX-FileContributor: Arthit Suriyawongkul SPDX-FileCopyrightText: 2024-present Arthit Suriyawongkul suriyawa@tcd.ie SPDX-FileType: DOCUMENTATION SPDX-License-Identifier: CC0-1.0

Sentiment Demo: A Simple AI Application and its AI BOM Example

PyPI - Version GitHub License DOI

A simple text classification application, published solely to demonstrate a software bill of materials (SBOM) in SPDX 3.0 format.

The main content of the package are software bill of materials at bom.spdx3.json (written by hand) and bom-generated.spdx3.json (Pitloom-generated). Other files are given just to complete the illustration.

Not recommended for actual text classification tasks.

Updates:

  • July 2026: Version 0.3.1 - SBOM fragments that were generated during the runs of evaluate/predict/preprocess/train.py are merged into the main SBOM -- shipped with the Python wheel. This gives more data/model provenance.
  • March 2026: Adopted as a development reference for the Pitloom SBOM generator.
  • May 2025: Added to the SPDX Usage Examples repository as ai/example02.

SBOM demonstration design goals:

  • Comprehensible: Small enough for a human to understand easily.
  • Informative: Elaborate enough to showcase the use of various information fields within an SBOM.
  • Testable: Designed to facilitate testing and evaluation against specific use case requirements.

For more information about implementing AI BOM using SPDX specification, see Karen Bennet, Gopi Krishnan Rajbahadur, Arthit Suriyawongkul, and Kate Stewart, “Implementing AI Bill of Materials (AI BOM) with SPDX 3.0: A Comprehensive Guide to Creating AI and Dataset Bill of Materials”, The Linux Foundation, October 2024.

Content

.
├── LICENSE                    License information
├── README.md                  This README file
├── bom-generated.spdx3.json   SBOM in SPDX 3 format (generated)
├── bom.spdx3.json             SBOM in SPDX 3 format (handwritten)
├── data                       Dataset, preprocessed and tokenized
│   ├── test.txt               Testing data
│   ├── train.txt              Training data
│   └── valid.txt              Validation data
├── rawdata                    Raw dataset, before preprocessing
│   ├── test                   Testing data
│   │   ├── neg.txt            Testing samples for label "neg" (negative)
│   │   ├── neu.txt            Testing samples for label "neu" (neutral)
│   │   ├── pos.txt            Testing samples for label "pos" (positive)
│   │   └── q.txt              Testing samples for label "q" (question)
│   ├── train                  Training data
│   │   └── ...
│   └── valid                  Validation data
│       └── ...
├── src
│   ├── evaluate.py            Script to evaluate prediction performance
│   ├── model.bin              Sentiment analysis model
│   ├── predict.py             Script to predict a label of a text
│   ├── preprocess.py          Script to prepare training data
│   └── train.py               Script to build a model
└── techdocs                   Technical documentation
    ├── dataprepare.md         Data preparation
    └── instructions.md        Instruction for use

A diagram showing relationships between elements in the Sentiment Demo package.

Usage

See instruction for use for how to use the application.

Data preparation

See data preparation.

Notes

  • Development is in the main branch.
  • The diagram is generated from a PlantUML file: bom.spdx.puml. The PlantUML file is generated by spdx3ToGraph. To brevity, spdxIds and long strings are shortened by the shortenid.sh script in tools/, and all but one hyperparameter have been manually removed.
  • The energy used by the computer during model training is tracked by energy-tracker. It measures how much energy the computer uses during the training. This means the actual energy used for training the model might be a bit less than the reported amount.
  • The SPDX 3.0.1 SBOM is validated structurally against the JSON Schema at https://spdx.org/schema/3.0.1/spdx-json-schema.json and semantically against the SHACL model at https://spdx.org/rdf/3.0.1/spdx-model.ttl.
  • Next steps:
    • Add external dependency relationships (e.g. dependsOn, hasProvidedDependency)
    • Get tested with an SBOM quality check tool like sbomsq (once it supports SPDX 3.0).
    • Using information requirements and obligations in the EU AI Act as a target, labeling all relevant properties and relationships with corresponding difficulty levels and support levels, based on the BOM Maturity Model.

Licenses

Apart from the data and components listed in the table below, the code and content in this repository are dedicated to the public domain under the terms of Creative Commons Zero ("CC0") 1.0 Universal, which have no copyright and related or neighboring rights worldwide to the extent allowed by law.

Component Name License Notes
Training data Wisesight Sentiment Corpus CC0-1.0 Samples from the corpus are in rawdata/. Preprocessed data is in data/. See data preparation for details.
Text preprocessor th-simple-preprocessor Apache-2.0
Word tokenizer newmm-tokenizer Apache-2.0 Inherited the license from PyThaiNLP.
Text classifier fastText MIT Use fasttext-community, which is a community-maintained fork.
Array package NumPy BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0

The specific version information can be found in pyproject.toml.

Citation

If you use this software, including its software bill of materials (SBOM), please cite it as follows:

Suriyawongkul, Arthit. “Sentiment Demo: A Simple AI Application and Its AI BOM Example”. Zenodo, 8 November 2024. https://doi.org/10.5281/zenodo.14055332.

BibTeX:

@software{Suriyawongkul_Sentiment_Demo_A_2024,
    author = {Suriyawongkul, Arthit},
    doi = {10.5281/zenodo.14055332},
    license = {CC0-1.0},
    month = nov,
    title = {{Sentiment Demo: A Simple AI Application and its AI BOM Example}},
    url = {https://github.com/bact/sentimentdemo/},
    version = {0.1},
    year = {2024}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sentimentdemo-0.3.2.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sentimentdemo-0.3.2-py3-none-any.whl (93.3 kB view details)

Uploaded Python 3

File details

Details for the file sentimentdemo-0.3.2.tar.gz.

File metadata

  • Download URL: sentimentdemo-0.3.2.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sentimentdemo-0.3.2.tar.gz
Algorithm Hash digest
SHA256 9e4db153fbcaffcaabb1c850f654e93993934ebd4b7684325a5e06bc7ade9046
MD5 71bb46558012e33467ee03b511d81c1a
BLAKE2b-256 418b9c59420b935853c265f800eae20eea8b254d2928623d4e40d4f906e4e185

See more details on using hashes here.

Provenance

The following attestation bundles were made for sentimentdemo-0.3.2.tar.gz:

Publisher: pypi-publish.yml on bact/sentimentdemo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sentimentdemo-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: sentimentdemo-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 93.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sentimentdemo-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2e85482c4d9fff2eb9f749b9709d79f5e0e68ee727c2fd4a6458bd18193720e8
MD5 b2d7bf4db5085a563fc6a3e8ae052d54
BLAKE2b-256 f6293304da4671f335e02c501bbea9a2169d4040f9b881e0413ebfcab1e32749

See more details on using hashes here.

Provenance

The following attestation bundles were made for sentimentdemo-0.3.2-py3-none-any.whl:

Publisher: pypi-publish.yml on bact/sentimentdemo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.4

2 files

0.3.3

2 files

This release

0.3.2 This release

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page