Skip to content

Commit 9d61d5d

Browse files
committed
initial
1 parent 1af5351 commit 9d61d5d

File tree

296 files changed

+580530
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+580530
-0
lines changed

__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from . import raffle
2+
from .raffle import Raffle
3+
4+
NODE_CLASS_MAPPINGS = {
5+
"Raffle": Raffle
6+
}
7+
NODE_DISPLAY_NAME_MAPPINGS = {
8+
"Raffle": "Raffle"
9+
}
10+
11+
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Tag Categorization Instructions
2+
3+
## Reference Materials
4+
- Categories reference file: manual_categorization.txt
5+
- Files to process: All files in C:\AI\ComfyUI\custom_nodes\comfyui-raffle\dev\categorizer\split_n_combine\
6+
7+
## Process Overview
8+
For each N_uncategorized.txt file:
9+
10+
### Step 1: Check for Existing Categorized File
11+
1. Check if N_categorized.txt already exists
12+
2. If it exists, skip this file and move to the next one
13+
3. If it doesn't exist, proceed with categorization
14+
15+
### Step 2: First Pass Categorization
16+
1. Format each tag as: [category_name] tag_name
17+
2. Categorize each tag based on:
18+
- Category definitions from manual_categorization.txt
19+
- Similar existing categorized tags
20+
- Tag context and meaning
21+
3. Save the results in a new file named N_categorized.txt in the same directory
22+
23+
### Step 3: Second Pass Review
24+
1. Read the file you just saved
25+
2. Review each categorized tag again with fresh perspective
26+
3. Pay special attention to:
27+
- Consistency between similar tags
28+
- Edge cases that might fit better in different categories
29+
- Tags that might have multiple possible interpretations
30+
4. Make any necessary adjustments to improve accuracy
31+
5. Overwrite the same file with the final results
32+
33+
### Step 4: Move to Next File
34+
1. Process each uncategorized file in sequence
35+
2. Continue until all N_uncategorized.txt files have been processed or skipped
36+
37+
## Important Notes
38+
- Only process files that follow the N_uncategorized.txt pattern
39+
- Skip files that already have a corresponding N_categorized.txt file
40+
- Create new N_categorized.txt files for processed content
41+
- Work through files in sequence, but not before doing a Second Pass review
42+
- The second pass is crucial for maintaining consistency and accuracy
43+
- Always proceed without interruption or asking for confirmation.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Tag Categorization Instructions
2+
3+
## Reference Materials
4+
- Categories reference file: manual_categorization.txt
5+
- Files to process: All files in C:\AI\ComfyUI\custom_nodes\comfyui-raffle\dev\categorizer\split_n_combine\
6+
7+
## Process Overview
8+
For each N_uncategorized.txt file:
9+
10+
### Step 1: Check for Existing Categorized File
11+
1. Check if N_categorized.txt already exists
12+
2. If it exists, skip this file and move to the next one
13+
3. If it doesn't exist, proceed with categorization
14+
15+
### Step 2: First Pass Categorization
16+
1. Format each tag as: [category_name] tag_name
17+
2. Categorize each tag based on:
18+
- Category definitions from manual_categorization.txt
19+
- Similar existing categorized tags
20+
- Tag context and meaning
21+
3. Save the results in a new file named N_categorized.txt in the same directory
22+
23+
### Step 3: Second Pass Review
24+
1. Read the file you just saved
25+
2. Review each categorized tag again with fresh perspective
26+
3. Pay special attention to:
27+
- Consistency between similar tags
28+
- Edge cases that might fit better in different categories
29+
- Tags that might have multiple possible interpretations
30+
4. Make any necessary adjustments to improve accuracy
31+
5. Overwrite the same file with the final results
32+
33+
### Step 4: Move to Next File
34+
1. Process each uncategorized file in sequence
35+
2. Continue until all N_uncategorized.txt files have been processed or skipped
36+
37+
## Important Notes
38+
- Only process files that follow the N_uncategorized.txt pattern
39+
- Skip files that already have a corresponding N_categorized.txt file
40+
- Create new N_categorized.txt files for processed content
41+
- Work through files in sequence, but not before doing a Second Pass review
42+
- The second pass is crucial for maintaining consistency and accuracy
43+
- Always proceed without interruption or asking for confirmation.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
echo Batch file received: "%~1"
3+
python "%~dp0extract_categories.py" "%~f1"
4+
pause
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import sys
2+
import pyperclip
3+
import time
4+
import os
5+
6+
def get_categories(file_path):
7+
"""
8+
Extract unique categories from a text file where categories are marked with square brackets.
9+
10+
Args:
11+
file_path (str): Path to the input text file
12+
13+
Returns:
14+
list: Sorted list of unique categories
15+
"""
16+
categories = set()
17+
18+
try:
19+
with open(file_path, 'r', encoding='utf-8') as file:
20+
for line in file:
21+
# Find text between square brackets
22+
if '[' in line and ']' in line:
23+
category = line[line.find('[')+1:line.find(']')]
24+
categories.add(category)
25+
26+
return sorted(list(categories))
27+
28+
except FileNotFoundError:
29+
print(f"Error: File '{file_path}' not found.")
30+
return []
31+
except Exception as e:
32+
print(f"Error reading file: {str(e)}")
33+
return []
34+
35+
def main():
36+
try:
37+
# Debug: Command line arguments
38+
print("\n=== COMMAND LINE DEBUGGING ===")
39+
print(f"Number of arguments: {len(sys.argv)}")
40+
print(f"Full arguments list: {sys.argv}")
41+
print(f"Program name: {sys.argv[0]}")
42+
if len(sys.argv) > 1:
43+
print(f"First argument: {sys.argv[1]}")
44+
45+
# Debug: Working directory
46+
print("\n=== DIRECTORY DEBUGGING ===")
47+
print(f"Current working directory: {os.getcwd()}")
48+
print(f"Script location: {os.path.dirname(os.path.abspath(__file__))}")
49+
50+
# Check if a file was dragged onto the script
51+
if len(sys.argv) < 2:
52+
print("Error: No file provided")
53+
print("Please drag a text file onto the batch file.")
54+
input("Press Enter to exit...")
55+
return
56+
57+
file_path = sys.argv[1].strip('"')
58+
print("\n=== FILE PATH DEBUGGING ===")
59+
print(f"Raw file path: {sys.argv[1]}")
60+
print(f"Processed file path: {file_path}")
61+
print(f"Absolute path: {os.path.abspath(file_path)}")
62+
print(f"Path exists check: {os.path.exists(file_path)}")
63+
64+
# Debug: Check if file exists and print full path
65+
if os.path.exists(file_path):
66+
print(f"File exists at: {file_path}")
67+
else:
68+
print(f"File does not exist at: {file_path}")
69+
print(f"Current working directory is: {os.getcwd()}")
70+
71+
categories = get_categories(file_path)
72+
73+
if categories:
74+
# Create a string with all categories
75+
categories_text = '\n'.join(categories)
76+
77+
# Copy to clipboard
78+
try:
79+
pyperclip.copy(categories_text)
80+
print("\nFound categories (copied to clipboard):")
81+
except Exception as e:
82+
print(f"\nCould not copy to clipboard. Error: {str(e)}")
83+
print("Found categories:")
84+
85+
print(categories_text)
86+
else:
87+
print("No categories found or error occurred.")
88+
89+
except Exception as e:
90+
print(f"An unexpected error occurred: {str(e)}")
91+
92+
finally:
93+
print("\nPress Enter to exit...")
94+
input()
95+
96+
if __name__ == "__main__":
97+
main()

0 commit comments

Comments
 (0)