A lightweight rule based tech content tagging module for Python
Project description
Tagging Module
A lightweight rule based tech content tagging module for Python
Class Overview
The TaggingService class is designed to provide a tagging service. It uses the tagging_system module to assign tags to content based on predefined rules. The tagging rules are specified in a YAML file.
You may directly use it from this repo or install via Pip.
pip install tagging-module
Constructor
__init__(self, rules_path: str = None)
The constructor initializes a TaggingService object.
Parameters
rules_path(optional): A string representing the path to the YAML file containing the tagging rules. If not provided, the default rules file path (tagging_module/config/rules.yml) is used.
Exceptions
FileNotFoundError: Raised if the providedrules_pathis not a valid file path.
Example
from tagging_module.tagging_service import TaggingService
# Using the default rules file path
service = TaggingService()
# Providing a custom rules file path
service = TaggingService(rules_path="path/to/custom_rules.yml")
Methods
assign_tags(self, content: str) -> List[str]
This method assigns tags to the provided content based on the defined tagging rules.
Parameters
- content: A string representing the content to be tagged.
Returns
A list of strings representing the assigned tags for the content.
Example
from tagging_module.tagging_service import TaggingService
# Assuming the rules file contains rules for tagging different types of content
service = TaggingService()
content = "This is a sample content."
tags = service.assign_tags(content)
print(tags)
# Output: ['sample', 'content']
Note: The output tags may vary based on the specific tagging rules defined in the rules file.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tagging_module-0.0.8.tar.gz.
File metadata
- Download URL: tagging_module-0.0.8.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7129e5d585897f8b8c6ecdd3bed91f7cf82832eddea94e4d936a2dd48706f62f
|
|
| MD5 |
8dc46d64c1f2521529187e5ae54628fd
|
|
| BLAKE2b-256 |
186dbe5cf88e7b9b81704e5ad3f50b239bd3af3310c16bad38e356d0e2f1fbfd
|
File details
Details for the file tagging_module-0.0.8-py3-none-any.whl.
File metadata
- Download URL: tagging_module-0.0.8-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d16060bf63d64f4c6289eb5b0d0b69e10d56ee832aa9e9ab9d42822f1480e768
|
|
| MD5 |
6b254e76f78c32b8e928b268da91556a
|
|
| BLAKE2b-256 |
c6a86a41c16afede71e9bec1e009137c40dfb9ffdb81d2c203dd4c3d19d2db7d
|