Skip to main content

MoE Document Classification CLI v3.0

Command-line interface for classifying documents using the Mixture of Experts classification system with 13 Type Experts.

Version History:

  • v2.1: 13 Type Experts, autonomous mode, expert mode
  • v3.0: Enhanced frontmatter, threshold, type override, respect-directory

Usage: # Classify a single file python classify.py path/to/file.md

# Classify a directory
python classify.py path/to/docs/ --recursive

# Batch classify with output
python classify.py docs/ -r --output results.json --format json

# Update frontmatter with classifications
python classify.py docs/ -r --update-frontmatter

# Dry run (show what would happen)
python classify.py docs/ -r --dry-run

# V3: ENHANCE FRONTMATTER MODE
# Add explicit type fields to boost low-confidence files
python classify.py docs/ -r --enhance-frontmatter

# V3: With custom threshold (default 95%)
python classify.py docs/ -r --enhance-frontmatter --threshold 90

# V3: Dry run to preview enhancements
python classify.py docs/ -r --enhance-frontmatter --dry-run

# V3: TYPE OVERRIDE MODE
# Force specific type on all files in a directory
python classify.py docs/workflows/ -r --enhance-frontmatter --type-override workflow

# V3: Correct misclassified WF-* files
python classify.py docs/workflows/WF-*.md --enhance-frontmatter --type-override workflow

# V3: RESPECT DIRECTORY MODE
# Use directory path as classification hint
python classify.py docs/ -r --enhance-frontmatter --respect-directory

# V3: Dry run to see where directory hints would be applied
python classify.py docs/ -r --enhance-frontmatter --respect-directory --dry-run --verbose

# V3: SUGGEST ENHANCEMENTS MODE
# Analyze files and suggest specific content additions
python classify.py docs/ -r --suggest-enhancements

# V3: Verbose to see content previews
python classify.py docs/ -r --suggest-enhancements --verbose

# V3: JSON OUTPUT MODE (CI/CD integration)
# Get structured JSON output for any mode
python classify.py docs/ -r --enhance-frontmatter --dry-run --json
python classify.py docs/ -r --suggest-enhancements --json
python classify.py docs/ -r --json # Standard classification

File: classify.py

Classes

BatchResult

Result of batch classification.

ClassificationCLI

Command-line interface for MoE classification.

Functions

check_embeddings_available()

Check if sentence-transformers is available for embeddings.

create_orchestrator(use_embeddings)

Create the appropriate orchestrator based on configuration.

create_parser()

Create argument parser.

get_directory_hint(file_path)

Get type hint from directory path.

enhance_frontmatter_mode(args)

V3 Enhance Frontmatter Mode.

suggest_enhancements_mode(args)

V3 Suggest Enhancements Mode.

main()

Main entry point.

run()

Execute the classification based on CLI arguments.

Usage

python classify.py