Skip to content

Comments

Sync ELIZA with original Weizenbaum rules#16

Merged
jeremymanning merged 1 commit intomainfrom
fix/eliza-sync-issue-15
Dec 27, 2025
Merged

Sync ELIZA with original Weizenbaum rules#16
jeremymanning merged 1 commit intomainfrom
fix/eliza-sync-issue-15

Conversation

@jeremymanning
Copy link
Member

Summary

  • Syncs ELIZA implementation with the original Weizenbaum rules from cs-for-psych
  • Creates reusable import script for maintaining sync with original source
  • Removes duplicate files and updates tests to match original behavior

Changes

New Scripts

  • scripts/import_eliza_rules.py - Fetches and converts original Weizenbaum rules to JSON
  • scripts/compare_rules.py - Compares rule files and shows differences

Rule Changes

  • Regenerated demos/01-eliza/data/eliza-rules.json from original source
  • Synonym groups no longer include their own name (e.g., @sad = unhappy, depressed, sick)
  • Keywords i and you have no explicit rank (matches original)
  • Pattern spacing matches original (* @synonym * instead of *@synonym*)

Cleanup

  • Removed demos/15-chatbot-evolution/data/eliza-rules.json (duplicate - Demo 15 imports from Demo 01)
  • Removed demos/01-eliza/scripts/test_eliza.py (orphaned - imports non-existent module)

Test Updates

  • Updated test expectations to match original ELIZA behavior
  • "I'm sorry." now matches sorry keyword (not i)
  • "Am I happy" now matches am keyword (not i)

Test Results

  • Demo 01 ELIZA: 144/144 tests passed
  • Demo 15 ELIZA: 12/12 tests passed
  • Total: 156/156 tests passed (100%)

Test plan

  • Run npm run test:eliza locally - all 156 tests pass
  • Verify import script works: python scripts/import_eliza_rules.py --dry-run
  • GitHub Actions CI should pass

Fixes #15

🤖 Generated with Claude Code

Fixes #15

- Add import_eliza_rules.py script to fetch and convert original rules
- Add compare_rules.py to compare rule files
- Regenerate eliza-rules.json from cs-for-psych instructions.txt
- Remove duplicate eliza-rules.json from Demo 15 (uses Demo 01)
- Remove orphaned test_eliza.py (imports non-existent module)
- Update test expectations to match original ELIZA behavior

Key changes to match original Weizenbaum implementation:
- Synonym groups no longer include their own name
- Keywords 'i' and 'you' have no explicit rank (original behavior)
- Pattern spacing matches original ('* @synonym *')
- 'sorry' and 'apologise' match before 'i' in apology statements

All 156 ELIZA tests pass (144 Demo 01 + 12 Demo 15).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jeremymanning jeremymanning merged commit 2dcd213 into main Dec 27, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix ELIZA implementation

1 participant