A text based decision tree builder
Project description
Python Implementation of Neil Larson's PERM Decision Tree Builder
This project is a Python implementation of Neil Larson's DOS-based PERM Decision Tree Builder, a tool designed to convert three hierarchical input files into a decision tree or search tree. Originally developed for DOS, PERM used text-based input files created with Larson's MaxThink outliner. This implementation preserves that functionality while allowing the use of any ASCII text editor.
Table of Contents
Overview
PERM processes three input files—Attribute File, Category File, and Priority File—to generate a decision tree. These files use a hierarchical structure, with indentation (spaces or tabs) to denote levels. The output is a minimal-path decision tree, useful for decision-making processes like selecting a beverage based on attributes such as cost, color, and taste.
Input Files
Attribute File (A)
The Attribute File defines the items and their properties. Below is an example for selecting a beverage:
TITLE
DRINK COKE
COLOR: BROWN
COST: $0.75
TASTE: TART
DRINK PEPSI
TASTE: TART
COLOR: BROWN
COST: $0.80
DRINK ROOT BEER
COLOR: TAN
COST: $0.75
TASTE: SWEET
- Notes:
- Attribute tags (e.g.,
COLOR
,COST
,TASTE
) are optional but must be consistent across files. - Indentation indicates hierarchy (use spaces or tabs).
- Attribute tags (e.g.,
Category File (B)
The Category File organizes attributes into decision-making categories. It is derived from the Attribute File:
TITLE
How much does it cost?
COST: $0.75
COST: $0.80
What is the color?
COLOR: BROWN
COLOR: TAN
What is the taste?
TASTE: SWEET
TASTE: TART
- Notes:
- Questions group related attributes.
- Must align with attributes defined in the Attribute File.
Priority File (C)
The Priority File defines the order of decision-making criteria for different user types. It is derived from the Category File:
Beverage Decision Tree
PRICE BUYER
How much does it cost?
What is the color?
What is the taste?
COLOR BUYER
What is the color?
What is the taste?
How much does it cost?
TASTE BUYER
What is the taste?
What is the color?
How much does it cost?
- Notes:
- Each buyer type prioritizes categories differently.
- Order of questions determines the decision path.
File Conversion
If using a text editor other than MaxThink, ensure compatibility with indentation:
- Convert tabs to spaces (MaxThink format):
cat a.otl | expand --tabs=1 > a.mt
- Convert spaces to tabs:
cat a.mt | unexpand --tabs=1 > a.otl
Output Example
Running perm A B C > D
generates an output file (D
) with minimal decision paths:
Beverage Decision Tree
PRICE BUYER
COST: $0.75
COLOR: BROWN
DRINK COKE
COLOR: TAN
DRINK ROOT BEER
COST: $0.80
DRINK PEPSI
COLOR BUYER
COLOR: BROWN
COST: $0.75
DRINK COKE
COST: $0.80
DRINK PEPSI
COLOR: TAN
DRINK ROOT BEER
TASTE BUYER
TASTE: SWEET
DRINK ROOT BEER
TASTE: TART
COST: $0.75
DRINK COKE
COST: $0.80
DRINK PEPSI
- Result: A structured tree showing optimal decisions based on buyer priorities.
Usage
- Prepare the three input files (
A
,B
,C
) as described above. - Run the program from the command line:
perm A B C > D
- Check the output file (
D
) for the generated decision tree.
License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
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
File details
Details for the file pyperm_decisiontree-0.1.2.tar.gz
.
File metadata
- Download URL: pyperm_decisiontree-0.1.2.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 412c0c8fd69dc16b7d6f1a9aeaa4dfb2946e6ecd3bdfb4bce4b02602a6f82cd0 |
|
MD5 | e7e6051b0a3b5d78ad9d4ac4fbc3ee3f |
|
BLAKE2b-256 | 9df951229972288bb1d0b7eb2784eb005550dedbdb61b5a264d9388817f45be0 |
File details
Details for the file pyperm_decisiontree-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: pyperm_decisiontree-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4d03639e8b80a522f5bed5d0e2c693ff7dcef9cd954cea5234777c1c255c633 |
|
MD5 | 90e1044b8634945cb359bc516d8acdbf |
|
BLAKE2b-256 | bc3e7f48786e67b1eed0b1fa7b5243d3d87fc6267b656dab4dd9d80bce023052 |