2025-12-29 13:38:39 +08:00
2025-12-29 13:38:39 +08:00
2025-12-29 13:38:39 +08:00
2025-12-31 16:46:01 +08:00

Comprehensive Tagging System

A Python-based comprehensive tagging system for Obsidian vaults that analyzes files, generates appropriate tags based on directory structure and content analysis, and updates frontmatter while preserving existing data.

Features

  • Directory-based tagging: Automatically generates tags based on vault directory structure
  • Content analysis: Analyzes file content to extract topics, technologies, and entities
  • Hierarchical tag structures: Creates organized tag hierarchies using forward slash notation
  • Language detection: Identifies content language (English, Chinese, mixed, unknown)
  • Frontmatter management: Updates YAML frontmatter while preserving existing data
  • Batch processing: Processes entire vaults efficiently with progress tracking
  • Sensitive content detection: Identifies and appropriately tags sensitive information
  • Obsidian compatibility: Ensures tags work with Obsidian's features and plugins

Installation

pip install -e .

Development Setup

# Install development dependencies
pip install -e ".[dev,test]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=tagging_system

# Format code
black tagging_system tests

# Lint code
flake8 tagging_system tests

# Type checking
mypy tagging_system

Project Structure

tagging_system/
├── __init__.py
├── core/
│   ├── __init__.py
│   ├── models.py          # Core data models
│   └── interfaces.py      # Abstract interfaces and protocols
├── config/
│   ├── __init__.py
│   └── config.py          # Configuration system
└── implementations/       # Concrete implementations (to be added)

tests/
├── __init__.py
├── conftest.py           # Pytest configuration and fixtures
├── test_models.py        # Tests for core models
├── test_config.py        # Tests for configuration system
└── test_interfaces.py    # Tests for interfaces and protocols

Configuration

The system uses a flexible configuration system that supports both YAML and JSON formats. Configuration includes:

  • Directory mappings for tag generation
  • Tag hierarchies and structures
  • Sensitive content detection patterns
  • File processing settings
  • Language detection parameters

Testing

The project uses pytest with hypothesis for property-based testing:

  • Unit tests: Test specific functionality and edge cases
  • Property-based tests: Test universal properties across randomized inputs
  • Integration tests: Test component interactions

Run tests with:

pytest                    # Run all tests
pytest -m unit           # Run only unit tests
pytest -m property       # Run only property-based tests
pytest -v                # Verbose output

Requirements

This implementation addresses the following requirements:

  • 1.1, 1.2, 1.3: Standardized frontmatter structure
  • Directory-based tag mapping
  • Content analysis and classification
  • Tag consistency and validation
  • Batch processing capabilities

License

MIT License

S
Description
No description provided
Readme
15 MiB
Languages
Markdown 100%