Skip to content

test(corpus): add comprehensive real-world ChatGPT Persian medical bidi test fixtures - #168

Open
CodeinScrubs wants to merge 1 commit into
mainfrom
test/chatgpt-persian-medical-fixtures
Open

CodeinScrubs wants to merge 1 commit into
mainfrom
test/chatgpt-persian-medical-fixtures

Conversation

@CodeinScrubs

Copy link
Copy Markdown
Owner

Summary

Adds 28 comprehensive, schema-validated conformance fixtures in corpus/fixtures/fa/ derived directly from authentic user sessions with OpenAI ChatGPT in Persian and English. These fixtures capture the severe bidirectional layout breakdown observed in state-of-the-art conversational AI platforms when medical, scientific, and technical terminology is mixed into right-to-left prose.

Problem Context

Under standard browser heuristics (HTML dir="auto" or default LTR containers), paragraphs starting with Latin medical terms (e.g., Capsule مثل..., Macrophage برای..., Pyruvate kinase یکی...) have their direction evaluated by UAX #9 rules P2/P3 ("first strong character"). Because the leading character is Latin, browsers assign dir="ltr" to the entire paragraph, scrambling the visual reading order, pushing leading terms to the far left, inverting Persian word flow, and throwing sentence-final punctuation across the screen.

6 Failure Patterns Covered

  1. Leading English Technical Words in Persian Paragraphs: Capsule, Macrophage, Pyruvate kinase, 1) Splenic macrophages, spherocyte, target-cell pattern, Reticulocyteها.
  2. Biochemical Equations & Reaction Arrows: PEP + ADP → Pyruvate + ATP, IgG / IgM + C3b → phagocytosis ↑, glucose → glycolysis → ..., S. pneumoniae ← مهمترین, and pathway chains with arrows (→, ←, ↑, ↓).
  3. Mixed-Script Differential Diagnosis Tables: Markdown tables with Persian column headers (بیماری | سرنخ) and mixed English/Persian diagnostic findings (chronic DAT− hemolysis, spherocytes ولی DAT+, microcytosis شدید).
  4. Leading Emojis & Section Callouts: 🔴 Bottom line:, 🧠 تصویر ذهنی, 🔑 Take-home:, ✅ واقعیت:....
  5. Persian Quotations & Colloquial Dialogue: Medical mnemonics quoting speech inside guillemets («این آشغالِ بیبرق دیگه رد نمیشه.», «پس قبلش چرا مشکل ایجاد نمیکنند؟»).
  6. Persian Affixes on Latin Loanwords: Suffix attachment like macrophageها, enzymeهایی, slitهای, RBCهای, Reticulocyteها.

Included Assets

  • corpus/fixtures/fa/: 28 individual JSON files adhering to corpus/fixture.schema.json.
  • corpus/fixtures/fa/README.md: Fixture documentation and categorization.
  • packages/core/src/conformance-chatgpt-fa.test.ts: Automated conformance test suite (13 passing tests).
  • scripts/generate-chatgpt-fixtures.ts: Deterministic fixture generator.
  • docs/CHATGPT_REAL_WORLD_CASES.md: In-depth analysis of UAX chore(deps-dev): bump globals from 17.7.0 to 17.8.0 in the development-tooling group across 1 directory #9 first-strong breakdowns, breakdown mechanics, and drop-in integration recipes for LLM chat platforms (React, Web Component, Markdown).

Verification

  • pnpm run check: unicode, typecheck, lint, coverage, corpus, docs, build, and action checks all passed cleanly.
  • pnpm test: 23 test files, 613 tests passed, 0 failures.
  • Zero local modifications to outer workspaces; all work conducted in isolated branch.

…di test fixtures

- Add 28 schema-validated conformance fixtures in corpus/fixtures/fa/ derived from authentic OpenAI ChatGPT medical chats in Persian and English.

- Cover 6 real-world failure patterns: leading English terms, reaction arrows, diagnostic tables, leading emojis, Persian quotations, and loanword suffixes.

- Add automated conformance test suite in packages/core/src/conformance-chatgpt-fa.test.ts (13 tests passing).

- Add reproducible generator script scripts/generate-chatgpt-fixtures.ts.

- Add docs/CHATGPT_REAL_WORLD_CASES.md detailing root causes, UAX #9 first-strong defects, and integration guide for LLM chat engines.

This branch has not been deployed

No deployments
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.

1 participant