Skip to content

Khoirul-Yardan/RasengganSort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rasenggan Sort (Python)

Hybrid-adaptive sorting framework for numbers, words, alphanumeric, and mixed data — plus a demo pipeline for container data classification (commercial vs non-commercial).

Features

  • Bucket detection: number, word, alnum, other.
  • Natural sorting for mixed strings (e.g., A2 < A10).
  • Flexible bucket priority and per-bucket order (asc/desc).
  • Stable (leverages Python's stable sorted()).
  • CLI to sort TXT and CSV by column.
  • Demo script: categorize containers and sort with multi-field keys.

Quick Start

# 1) Run CLI on a txt file
python cli.py samples/mixed_items.txt --output samples/mixed_sorted.txt

# 2) Run CLI on CSV by column (by name)
python cli.py samples/containers_sample.csv --column container_id --output samples/containers_sorted_by_id.csv

# 3) Run demo pipeline (classify + multi-key sort)
python categorize_and_sort_containers.py

Library Usage

from rasengan_sort import rasenggan_sort, RasenganSort

items = ["B12","apple","42","zebra","123","banana","A1","b2","99","Komersial","NonKomersial"]
print(rasenggan_sort(items))
# -> [42, 99, 123, 'apple', 'banana', 'Komersial', 'NonKomersial', 'zebra', 'A1', 'B12', 'b2']

sorter = RasenganSort(priority=["word","number","alnum","other"], order="asc")
print(sorter.sort(items))

Concept & Flow (ASCII)

 ┌──────────────────────────┐
 │        Start             │
 └─────────────┬────────────┘
               ▼
 ┌──────────────────────────┐
 │ Ingest Raw Data          │
 └─────────────┬────────────┘
               ▼
 ┌──────────────────────────┐
 │ Detect Type per Item     │
 │ (number/word/alnum/other)│
 └─────────────┬────────────┘
               ▼
 ┌──────────────────────────┐
 │ Sort per Bucket with     │
 │ best strategy            │
 └─────────────┬────────────┘
               ▼
 ┌──────────────────────────┐
 │ Merge by Priority        │
 └─────────────┬────────────┘
               ▼
 ┌──────────────────────────┐
 │ Optional Categorization  │
 │ (e.g., commercial vs     │
 │ non-commercial)          │
 └─────────────┬────────────┘
               ▼
 ┌──────────────────────────┐
 │ Output Clean & Sorted    │
 └──────────────────────────┘

Notes

  • "Rasenggan Sort" here is a practical prototype, not a new theoretical lower-bound algorithm.
  • You can extend categorize_and_sort_containers.py with better NLP/ML classification.

About

Kombinasi Sorting yang dijadikan satu di RasengganSort dengan akurasi lumayan baik dan cepat

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages