Added description table to the ascii output

This commit is contained in:
Nathan Schneider
2025-12-02 15:27:09 -07:00
parent 8edc0df755
commit f123db6faf
2 changed files with 96 additions and 0 deletions

View File

@@ -56,8 +56,10 @@ def generate_bicorder_text(json_data):
lines = [] lines = []
# First pass: calculate maximum widths for left and right terms # First pass: calculate maximum widths for left and right terms
# Also collect all terms for the glossary
max_left_width = 0 max_left_width = 0
max_right_width = 0 max_right_width = 0
glossary_terms = {} # Dictionary to store term: description mappings
# Check diagnostic gradients # Check diagnostic gradients
for diagnostic_set in json_data.get("diagnostic", []): for diagnostic_set in json_data.get("diagnostic", []):
@@ -67,6 +69,12 @@ def generate_bicorder_text(json_data):
max_left_width = max(max_left_width, len(term_left)) max_left_width = max(max_left_width, len(term_left))
max_right_width = max(max_right_width, len(term_right)) max_right_width = max(max_right_width, len(term_right))
# Collect terms for glossary
if term_left:
glossary_terms[term_left] = gradient.get("term_left_description", "")
if term_right:
glossary_terms[term_right] = gradient.get("term_right_description", "")
# Check analysis items # Check analysis items
for analysis_item in json_data.get("analysis", []): for analysis_item in json_data.get("analysis", []):
term_left = analysis_item.get("term_left", "") term_left = analysis_item.get("term_left", "")
@@ -74,6 +82,12 @@ def generate_bicorder_text(json_data):
max_left_width = max(max_left_width, len(term_left)) max_left_width = max(max_left_width, len(term_left))
max_right_width = max(max_right_width, len(term_right)) max_right_width = max(max_right_width, len(term_right))
# Collect terms for glossary
if term_left:
glossary_terms[term_left] = analysis_item.get("term_left_description", "")
if term_right:
glossary_terms[term_right] = analysis_item.get("term_right_description", "")
# Calculate the width needed for centering # Calculate the width needed for centering
# Gradient line format: "{left_term} < [|||||||||] > {right_term}" # Gradient line format: "{left_term} < [|||||||||] > {right_term}"
# That's: max_left_width + 3 + 11 + 3 + max_right_width # That's: max_left_width + 3 + 11 + 3 + max_right_width
@@ -136,6 +150,31 @@ def generate_bicorder_text(json_data):
lines.append("") lines.append("")
# Glossary section
lines.append(center_text("GLOSSARY", center_width))
lines.append("")
# Generate pandoc-compatible table
# Sort terms alphabetically (case-insensitive) for consistent output
sorted_terms = sorted(glossary_terms.items(), key=lambda x: x[0].lower())
if sorted_terms:
# Calculate column widths for the table
max_term_width = max(len(term) for term, _ in sorted_terms)
max_term_width = max(max_term_width, len("Term")) # At least as wide as header
# Build the table
# Header row
lines.append(f"| {'Term'.ljust(max_term_width)} | Description |")
# Separator row
lines.append(f"| {'-' * max_term_width} | {'-' * 11} |")
# Data rows
for term, description in sorted_terms:
lines.append(f"| {term.ljust(max_term_width)} | {description} |")
lines.append("")
return "\n".join(lines) return "\n".join(lines)

View File

@@ -39,3 +39,60 @@ self-enforcing < [|||||||||] > enforced
hardness < [|||||||||] > softness hardness < [|||||||||] > softness
polarized < [|||||||||] > centrist polarized < [|||||||||] > centrist
not useful < [|||||||||] > very useful not useful < [|||||||||] > very useful
GLOSSARY
| Term | Description |
| -------------- | ----------- |
| abstract | Participants learn the protocol by studying it intellectually |
| alive | Actively utilized by relevant participants |
| centrist | The analyst tended toward readings at the middle of the gradients |
| contested | Content and meaning are disputed or under debate |
| crystallized | Content and meaning are settled and widely agreed upon |
| dead | Not actively utilized by relevant participants |
| defensible | Strong boundaries and protections against external influence |
| documenting | The primary purpose is to document or validate activity that is occurring |
| durable | Designed to be persistently available |
| embodied | Participants learn the protocol by physically practicing it |
| emergent | Produces unexpected or novel outcomes |
| enabling | The primary purpose is to enable activity that might not happen otherwise |
| enforced | Rules require external enforcement by authorities or institutions |
| ephemeral | Designed to vanish when no longer needed |
| exclusion | The protocol creates barriers or excludes certain participants |
| explicit | The design is stated explicitly somewhere that is accessible to participants |
| exposed | Weak boundaries and vulnerable to external influence |
| flocking | Coordination occurs through centralized direction or direct mimicry |
| hardness | The protocol tends toward properties characterized by hardness |
| implicit | The design is not stated explicitly but is learned by participants in another way |
| inclusion | The protocol reduces barriers and includes diverse participants |
| institutional | Design occurs through processes that involve powerful institutions and widespread recognition as normative |
| insufficient | Does not, on its own, adequately meet the needs and goals of participants |
| interpretive | The design is ambiguous, allowing participants a wide range of interpretation |
| Kafka | Fosters experiences of absurd complexity, alienation, and powerlessness |
| macro | Operates at large scales involving many participants or broad scope |
| malleable | Designed to be changed by participants according to evolving needs |
| micro | Operates at small scales with few participants or narrow scope |
| monopolistic | Excludes the use of other protocols that might be available to adopt |
| not useful | The bicorder was not useful or relevant for analyzing this protocol |
| obligatory | Participation is compulsory for a certain class of agents |
| particular | Addressed to a specific community |
| pluralistic | Interoperates with other protocols and does not exclude their use |
| polarized | The analyst tended toward more extreme high or low readings |
| precise | The design is specified with a high level of precision that eliminates ambiguity in implementation |
| predictable | Produces expected and consistent outcomes |
| self-enforcing | Rules are automatically enforced through its own mechanisms |
| social | Primarily concerned with interactions among people or groups |
| softness | The protocol tends toward properties characterized by softness |
| sovereign | A distinctive operating logic, not subject to any other entity |
| static | Designed to be as fixed and unchanging as possible |
| subsidiary | An operating logic under the control of a particular entity |
| sufficient | Adequately meets the needs and goals of participants |
| swarming | Coordination occurs through distributed interactions without central direction |
| technical | Primarily concerned with interactions among technologies |
| trust-evading | Minimizes the need for trust among participants |
| trust-inducing | Relies on or cultivates trust among participants |
| universal | Addressed to a global audience |
| vernacular | Design occurs through evolving, peer-to-peer community interactions in order to suit participant-defined goals |
| very useful | The bicorder was very useful and relevant for analyzing this protocol |
| voluntary | Participation in the protocol is optional and not coerced |
| Whitehead | Enables participants to carry out desired activities with less work or thought |