scribe-eval 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
scribe/charts.py ADDED
@@ -0,0 +1,281 @@
1
+ """
2
+ Chart generation for ASR error analysis.
3
+
4
+ Uses matplotlib for static chart generation (CLI reports, file output).
5
+ For Streamlit, callers can use st.pyplot(fig) with the returned figures.
6
+ """
7
+
8
+ from typing import Optional
9
+
10
+ try:
11
+ import matplotlib
12
+
13
+ matplotlib.use("Agg") # Non-interactive backend for CLI/file output
14
+ import matplotlib.pyplot as plt
15
+ from matplotlib.patches import Rectangle
16
+
17
+ HAS_MATPLOTLIB = True
18
+ except ImportError:
19
+ HAS_MATPLOTLIB = False
20
+
21
+
22
+ def _check_matplotlib():
23
+ if not HAS_MATPLOTLIB:
24
+ raise ImportError(
25
+ "matplotlib is required for chart generation. Install it with: uv add matplotlib"
26
+ )
27
+
28
+
29
+ # Editorial palette — matches the visualizer design system
30
+ # (.streamlit theme + inject_custom_css tokens).
31
+ PAPER = "#F0EFEC" # toned-down canvas so segment colors sit softer
32
+ INK = "#171717"
33
+ INK_MUTED = "#605D53"
34
+ HAIRLINE = "#DEDDD9"
35
+ ACCENT = "#FDB72E" # Adalat marigold — marks only, never text
36
+
37
+ # Outcome colors (identical to the visualizer alignment cells):
38
+ # each outcome renders as a soft wash fill with a strong edge strip,
39
+ # echoing the cell tint + underline motif.
40
+ COLOR_CORRECT = "#3E8E5A" # match green
41
+ COLOR_SUBSTITUTION = "#D64545" # substitution red
42
+ COLOR_DELETION = "#B4551D" # deletion burnt orange
43
+ COLOR_INSERTION = "#3B6FD4" # insertion blue
44
+ WASH_CORRECT = "#D9EBDF"
45
+ WASH_SUBSTITUTION = "#F6D9D9"
46
+ WASH_DELETION = "#F0DCC8"
47
+ WASH_INSERTION = "#D9E4F7"
48
+
49
+ SANS = "sans-serif"
50
+
51
+
52
+ def category_breakdown_chart(
53
+ contributions: dict[str, dict],
54
+ output_path: Optional[str] = None,
55
+ title: str = "ASR Error Analysis by Category",
56
+ cer_scribe: Optional[float] = None,
57
+ ) -> Optional[object]:
58
+ """
59
+ Generate a typographic report-card figure of the category breakdown.
60
+
61
+ One row per category (plus TOTAL): a 100%-normalized outcome bar
62
+ (exact match / substitutions / deletions / insertions — readable
63
+ regardless of how few tokens the category has), a large accuracy
64
+ figure, a token/error stat line, and the category's contribution to
65
+ WER_SCRIBE as a dot-and-stem mark. Left-aligned title block with an
66
+ accent tick, inline color key, and a footnote replace axes, grids
67
+ and legends.
68
+
69
+ Args:
70
+ contributions: From compute_category_contributions(). Each entry has
71
+ correct, substitutions, deletions, insertions, ref_tokens.
72
+ output_path: If provided, save as PNG/PDF. If None, return figure.
73
+ title: Overall figure title
74
+ cer_scribe: Optional CER_SCRIBE rate shown in the header
75
+ subtitle beside WER_SCRIBE
76
+
77
+ Returns:
78
+ matplotlib Figure object, or None if saved to file.
79
+ """
80
+ _check_matplotlib()
81
+
82
+ # Display names for categories
83
+ category_display = {
84
+ "LEXICAL": "Lexical",
85
+ "PUNCT": "Punctuation",
86
+ "NUMERAL": "Numeral",
87
+ }
88
+
89
+ # Fixed display order: Lexical, Domain, Numeral, Punctuation.
90
+ # A single domain category displays as "Domain"; with several
91
+ # (mixed aggregates), each keeps its category name.
92
+ base_cats = {"LEXICAL", "NUMERAL", "PUNCT"}
93
+ domain_cats = [c for c in contributions if c not in base_cats]
94
+ if len(domain_cats) > 1:
95
+ for c in domain_cats:
96
+ category_display[c] = c
97
+ ordered_cats = ["LEXICAL"] + domain_cats + ["NUMERAL", "PUNCT"]
98
+ ordered_cats = [c for c in ordered_cats if c in contributions]
99
+
100
+ rows = [] # (name, correct, sub, del, ins)
101
+ totals = [0, 0, 0, 0]
102
+ total_ref = 0
103
+ for cat in ordered_cats:
104
+ d = contributions[cat]
105
+ rows.append(
106
+ (
107
+ category_display.get(cat, "Domain"),
108
+ d["correct"],
109
+ d["substitutions"],
110
+ d["deletions"],
111
+ d["insertions"],
112
+ )
113
+ )
114
+ for k, key in enumerate(("correct", "substitutions", "deletions", "insertions")):
115
+ totals[k] += d[key]
116
+ total_ref += d["ref_tokens"]
117
+ total_row = ("All tokens", *totals)
118
+ wer_scribe_pct = (totals[1] + totals[2] + totals[3]) / total_ref * 100 if total_ref > 0 else 0.0
119
+
120
+ def contribution_pct(row):
121
+ return ((row[2] + row[3] + row[4]) / total_ref * 100) if total_ref > 0 else 0.0
122
+
123
+ max_contrib = max([contribution_pct(r) for r in rows] + [wer_scribe_pct, 0.1])
124
+
125
+ # ---- Canvas: one axes in 0..1 coordinates, everything hand-placed ----
126
+ n_rows = len(rows) + 1 # + TOTAL
127
+ row_h = 1.05
128
+ header_h = 2.75
129
+ footer_h = 0.7
130
+ fig_h = header_h + n_rows * row_h + footer_h
131
+ fig = plt.figure(figsize=(13, fig_h), dpi=72)
132
+ fig.set_facecolor(PAPER)
133
+ ax = fig.add_axes([0, 0, 1, 1])
134
+ ax.set_xlim(0, 1)
135
+ ax.set_ylim(0, fig_h)
136
+ ax.axis("off")
137
+
138
+ # Column geometry (x, in axes fraction)
139
+ X_NAME = 0.045
140
+ X_BAR0, X_BAR1 = 0.21, 0.60
141
+ X_ACC = 0.665
142
+ X_DOT0, X_DOT1 = 0.735, 0.92
143
+ X_RIGHT = 0.955
144
+
145
+ def txt(x, y, s, size, color=INK, weight="normal", family=SANS, ha="left", va="center"):
146
+ ax.text(x, y, s, fontsize=size, color=color, fontweight=weight, family=family, ha=ha, va=va)
147
+
148
+ # ---- Header block ----
149
+ y = fig_h - 0.42
150
+ ax.add_patch(Rectangle((X_NAME, y + 0.13), 0.045, 0.075, color=ACCENT))
151
+ txt(X_NAME, y - 0.28, title, 21, weight="bold")
152
+ subtitle = f"{total_ref:,} reference tokens · WER_SCRIBE {wer_scribe_pct:.1f}%"
153
+ if cer_scribe is not None:
154
+ subtitle += f" · CER_SCRIBE {cer_scribe * 100:.1f}%"
155
+ txt(X_NAME, y - 0.80, subtitle, 12.5, color=INK_MUTED)
156
+
157
+ # Inline color key (wash swatch with the strong edge, like the bars)
158
+ key_y = y - 1.28
159
+ key_x = X_NAME
160
+ for label, color, wash in (
161
+ ("Match", COLOR_CORRECT, WASH_CORRECT),
162
+ ("Substitutions", COLOR_SUBSTITUTION, WASH_SUBSTITUTION),
163
+ ("Deletions", COLOR_DELETION, WASH_DELETION),
164
+ ("Insertions", COLOR_INSERTION, WASH_INSERTION),
165
+ ):
166
+ ax.add_patch(Rectangle((key_x, key_y - 0.045), 0.011, 0.10, color=wash))
167
+ ax.add_patch(Rectangle((key_x, key_y - 0.045), 0.011, 0.028, color=color))
168
+ txt(key_x + 0.017, key_y, label, 10.5, color=INK)
169
+ key_x += 0.017 + 0.012 * len(label) + 0.025
170
+
171
+ # Column captions
172
+ cap_y = key_y - 0.62
173
+ txt(X_BAR0, cap_y, "OUTCOME SHARE WITHIN CATEGORY", 8.5, color=INK_MUTED)
174
+ txt(X_ACC, cap_y, "ACCURACY", 8.5, color=INK_MUTED)
175
+ txt(X_DOT0, cap_y, "CONTRIBUTION TO WER_SCRIBE", 8.5, color=INK_MUTED)
176
+ ax.plot([X_NAME, X_RIGHT], [cap_y - 0.18, cap_y - 0.18], color=INK, linewidth=1.4)
177
+
178
+ # ---- Category rows ----
179
+ def draw_row(y_mid, row, emphasize=False):
180
+ name, cor, sub, dl, ins = row
181
+ touched = cor + sub + dl + ins
182
+ ref = cor + sub + dl
183
+ acc = (cor / ref * 100) if ref > 0 else None
184
+
185
+ name_size = 13.5 if emphasize else 12.5
186
+ txt(X_NAME, y_mid + 0.10, name, name_size, weight="bold" if emphasize else "600")
187
+ txt(
188
+ X_NAME,
189
+ y_mid - 0.24,
190
+ f"{ref:,} ref tokens" if ref else "no ref tokens",
191
+ 9.5,
192
+ color=INK_MUTED,
193
+ )
194
+
195
+ # Normalized outcome bar: wash fill + strong edge strip per
196
+ # segment — the same tint-and-underline motif as the alignment
197
+ # cells in the visualizer.
198
+ bar_h = 0.30
199
+ edge_h = 0.065
200
+ if touched > 0:
201
+ x = X_BAR0
202
+ for count, color, wash in (
203
+ (cor, COLOR_CORRECT, WASH_CORRECT),
204
+ (sub, COLOR_SUBSTITUTION, WASH_SUBSTITUTION),
205
+ (dl, COLOR_DELETION, WASH_DELETION),
206
+ (ins, COLOR_INSERTION, WASH_INSERTION),
207
+ ):
208
+ w = (count / touched) * (X_BAR1 - X_BAR0)
209
+ if w > 0:
210
+ ax.add_patch(
211
+ Rectangle((x, y_mid - bar_h / 2), w, bar_h, color=wash, linewidth=0)
212
+ )
213
+ ax.add_patch(
214
+ Rectangle(
215
+ (x, y_mid - bar_h / 2), w, edge_h, color=color, linewidth=0
216
+ )
217
+ )
218
+ x += w
219
+ txt(
220
+ X_BAR0,
221
+ y_mid - bar_h / 2 - 0.17,
222
+ f"{cor:,} match · {sub} sub · {dl} del · {ins} ins",
223
+ 8.5,
224
+ color=INK_MUTED,
225
+ va="top",
226
+ )
227
+ else:
228
+ ax.plot(
229
+ [X_BAR0, X_BAR1],
230
+ [y_mid, y_mid],
231
+ color=HAIRLINE,
232
+ linewidth=1.2,
233
+ linestyle=(0, (2, 3)),
234
+ )
235
+ txt(X_BAR0, y_mid - 0.32, "nothing to measure", 8.5, color=INK_MUTED, va="top")
236
+
237
+ # Accuracy figure — the row's headline number, full ink
238
+ txt(X_ACC, y_mid, f"{acc:.0f}%" if acc is not None else "—", 15, weight="bold")
239
+
240
+ # Contribution dot-and-stem
241
+ contrib = contribution_pct(row)
242
+ frac = contrib / max_contrib if max_contrib > 0 else 0
243
+ x_end = X_DOT0 + frac * (X_DOT1 - X_DOT0)
244
+ ax.plot([X_DOT0, X_DOT1], [y_mid, y_mid], color=HAIRLINE, linewidth=1.0)
245
+ ax.plot([X_DOT0, x_end], [y_mid, y_mid], color=INK, linewidth=1.6)
246
+ ax.plot([x_end], [y_mid], marker="o", markersize=8, color=ACCENT,
247
+ markeredgecolor=INK, markeredgewidth=0.8)
248
+ txt(x_end + 0.012, y_mid, f"{contrib:.1f}%", 11.5, weight="600")
249
+
250
+ y_cursor = fig_h - header_h - row_h / 2
251
+ for row in rows:
252
+ draw_row(y_cursor, row)
253
+ y_cursor -= row_h
254
+
255
+ # TOTAL row under a heavier rule
256
+ ax.plot(
257
+ [X_NAME, X_RIGHT],
258
+ [y_cursor + row_h / 2 - 0.02, y_cursor + row_h / 2 - 0.02],
259
+ color=INK,
260
+ linewidth=1.0,
261
+ )
262
+ draw_row(y_cursor, total_row, emphasize=True)
263
+
264
+ # ---- Footer ----
265
+ foot_y = y_cursor - row_h / 2 - 0.18
266
+ ax.plot([X_NAME, X_RIGHT], [foot_y + 0.14, foot_y + 0.14], color=HAIRLINE, linewidth=1.0)
267
+ txt(
268
+ X_NAME,
269
+ foot_y - 0.08,
270
+ "Bars are normalized within each category; error rates use the combined "
271
+ "denominator (all reference tokens). Generated by scribe-eval.",
272
+ 8.5,
273
+ color=INK_MUTED,
274
+ va="top",
275
+ )
276
+
277
+ if output_path:
278
+ fig.savefig(output_path, bbox_inches="tight", dpi=96, facecolor=fig.get_facecolor())
279
+ plt.close(fig)
280
+ return None
281
+ return fig
File without changes
@@ -0,0 +1,369 @@
1
+ # Legal Domain Configuration
2
+ # Indian legal terminology for ASR error analysis
3
+
4
+ # Metadata
5
+ @name: legal
6
+ @category: LEGAL
7
+ @case_sensitive: false
8
+
9
+ # Literal terms - common legal abbreviations
10
+ # These will be automatically escaped for regex safety
11
+
12
+ # Basic abbreviations
13
+ u/s
14
+ U/S
15
+ r/w
16
+ w.p.
17
+ o.s.
18
+ OS
19
+ no.
20
+ v.
21
+ vs.
22
+ art.
23
+ sec.
24
+ a.m.
25
+ am
26
+ p.m.
27
+ pm
28
+
29
+
30
+ # Case types and legal instruments
31
+ FIR
32
+ EP
33
+ CC
34
+ IA
35
+
36
+ # Courts and officials
37
+ JFCM
38
+ CJM
39
+ CBI
40
+ SI
41
+ SHO
42
+ CPO
43
+ KSR
44
+
45
+ # Acts and codes
46
+ IPC
47
+ CrPC
48
+ BNS
49
+ BSA
50
+ BNSS
51
+ NI
52
+ NDPS
53
+ LAR
54
+ MV
55
+ POCSO
56
+ SCST
57
+
58
+ # Evidence and materials
59
+ MO
60
+
61
+ # Legal Vocabulary (single-word terms only)
62
+ # Note: Don't add terms here that are part of multi-word patterns below
63
+ # (e.g., don't add "Police" since it's part of "Police Station")
64
+ Article
65
+ Section
66
+ Crime
67
+
68
+ # Malayalam legal terms (single words)
69
+ ആധാരമെഴുത്തുകാരൻ
70
+ സാക്ഷി
71
+ പ്രതി
72
+ സമൻസ്
73
+ ഹർജിക്കാരൻ
74
+ മഹസർ
75
+ സർട്ടിഫിക്കറ്റ്
76
+ കോർപ്പറേഷൻ
77
+ എഗ്രിമെന്റ്
78
+ പോക്കുവരവ്
79
+ ടിയാൻ
80
+ കുടിശ്ശിക
81
+ മൊഴി
82
+ രജിസ്റ്റർ
83
+ കമ്മിഷൻ
84
+ ഒന്നാംസാക്ഷി
85
+ റിപ്പോർട്ട്
86
+ ശൈശവവിവാഹ
87
+ നിരോധനനിയമം
88
+ വിവാഹപ്രായം
89
+ സിവിൽ
90
+ ബാധ്യത
91
+ ചുമത്താൻ
92
+ നിയമാനുസൃതമായതോ
93
+ കാര്യനിർവ്വഹണപരമായതോ
94
+ അധികാരങ്ങളോ
95
+ പോലീസ്
96
+ ട്രിബ്യൂണലിനു
97
+ ഇടപാടിന്റെ
98
+ കേസിൽ
99
+ അന്വേഷണങ്ങൾ
100
+ രെജിസ്റ്റർ
101
+ നഷ്ടപരിഹാരം
102
+ അതിക്രമിച്ചുകയറിയ
103
+ നടപടിയിൽ
104
+ കരാറിൽ
105
+ പ്രാബല്യത്തിൽ
106
+ എതിർ
107
+ സത്യവാങ്മൂലം
108
+ അധികാരികളുടെ
109
+ ലൈസൻസ്
110
+ എക്‌സൈസ്
111
+ നികുതി
112
+ നിയമത്തിലെ
113
+ അനുബന്ധത്തിന്
114
+ ഫെഡറൽ
115
+ നിയമനിർമ്മാണ
116
+ സഭയുടെ
117
+ അഭിഭാഷകൻ
118
+ കൈമാറുകയും
119
+ വാണിജ്യപരമായി
120
+ വകുപ്പിനെ
121
+ വ്യാഖ്യാനിക്കുമ്പോൾ
122
+ വകുപ്പനുസരിച്ച്
123
+ പിഴ
124
+ പരാതിക്ക്
125
+ ഉപഭോക്താവിന്റെ
126
+ ബാധകമാക്കാനാവില്ലെന്നും
127
+ കരാറെടുത്ത
128
+ കക്ഷി
129
+ കോൺട്രാക്ട്
130
+ ആക്ട്
131
+ കുറ്റാന്വേഷണം
132
+ പരാതിക്കാരി
133
+ നീതിന്യായ
134
+ പ്രവർത്തനങ്ങൾ
135
+ ചേരിപ്രദേശത്താണ്
136
+ വകുപ്പിൽ
137
+ നിരോധനത്തിന്റെ
138
+ ഉത്തരവാദപ്പെട്ട
139
+ അധികാരിയുടെ
140
+ രേഖാമൂലമുള്ള
141
+ അനുമതി
142
+ ഹർജി
143
+ നിലനിൽക്കുന്നതല്ലെന്നും
144
+ അപേക്ഷയിൽ
145
+ മജിസ്‌ട്രേറ്റിന്
146
+ മുമ്പാകെ
147
+ പരിഹാരം
148
+ ശിക്ഷാർഹമായ
149
+ കുറ്റം
150
+ നടപടികളെക്കുറിച്ച്
151
+ സെക്ഷൻ
152
+ നിയമപരമായി
153
+ ഏജൻസികൾക്ക്
154
+ അപ്പീൽ
155
+ കോടതി
156
+ വിചാരണക്കോടതിയുടെ
157
+ കണ്ടെത്തലുകൾ
158
+ അസ്ഥിരപ്പെടുത്തുകയും
159
+ കടന്നുകയറ്റക്കാരിയായതിനാൽ
160
+ വിധിക്കുകയും
161
+ അസ്വാഭാവികമരണമാണോ
162
+ മരണകാരണം
163
+ കൈയേറ്റംചെയ്യപ്പെട്ടു
164
+ ചട്ടത്തിന്റെ
165
+ നടപടിക്രമങ്ങളുടെ
166
+ പരിഗണനാപരിധിക്ക്
167
+ ഉപവകുപ്പ്
168
+ ഉത്തരവുവഴി
169
+ സബ്-സെക്ഷൻ
170
+ വ്യവസ്ഥ
171
+ ബ്രാൻഡിനെയോ
172
+ ട്രേഡ്
173
+ മാർക്കിൽ
174
+ കുറ്റകൃത്യം
175
+ ഭൂവിനിയോഗനയങ്ങൾ
176
+ സ്വത്ത്
177
+ സംരക്ഷിക്കാൻ
178
+ പബ്ലിക്
179
+ ഇന്ററസ്റ്റ്
180
+ ലിറ്റിഗേഷൻ
181
+ ശാരീരികയാതനയ്‌ക്കോ
182
+ സംരക്ഷിതവ്യക്തിക്കു
183
+ ആർട്ടിക്കിൾ
184
+ അവകാശങ്ങൾക്കുള്ള
185
+ കൺവെൻഷന്റെ
186
+ പാർലമെന്റിനും
187
+ നിയമസഭയിലൂടെ
188
+ ശരീരപരിശോധന
189
+ അടിയന്തിര
190
+ ഉത്തരവ്
191
+ ബാർ
192
+ കൗൺസിലിലെ
193
+ ബാരിസ്റ്ററെ
194
+ എൻറോൾ
195
+ വാദിക്കുന്നതിൽനിന്ന്
196
+ നിരോധിക്കപ്പെട്ടു
197
+ ലംഘനമായി
198
+ ഉടമ്പടിക്കായുള്ള
199
+ വധശിക്ഷയ്ക്ക്
200
+ പ്രോസിക്യൂട്ടറായിരുന്ന
201
+ അധിനിവേശം
202
+ കോടതിയലക്ഷ്യത്തിന്
203
+ ശിക്ഷിക്കപ്പെട്ടു
204
+ ജഡ്ജി
205
+ പ്രതികളും
206
+ ഇന്ത്യൻ
207
+ ശിക്ഷാനിയമത്തിലെ
208
+ അഴിമതി
209
+ കുറ്റവിമുക്തനാക്കപ്പെട്ടിരുന്നു
210
+ പൗരന്മാരെ
211
+ നിരീക്ഷണത്തിനു
212
+ സ്വാതന്ത്ര്യം
213
+ മനുഷ്യാവകാശങ്ങൾ
214
+ ഭരണഘടനയുടെ
215
+ ആമുഖത്തിലും
216
+ നീതി
217
+ നടപ്പാക്കുകയാണ്
218
+ ഭേദഗതി
219
+ സുപ്രീം
220
+ കോടതി
221
+ റദ്ദാക്കാൻ
222
+ പൗരത്വത്തിന്
223
+ ജുഡീഷ്യൽ
224
+ വിചാരണ
225
+ പ്രോട്ടോകോളുകളും
226
+ വിധി
227
+ ഉടമ്പടികൾ
228
+ മേൽക്കോടതിക്ക്
229
+ നോമിനിയുടെ
230
+ ഫോറങ്ങൾ
231
+ പ്രമേയങ്ങൾ
232
+ ഇടക്കാല
233
+ നടപടികൾ
234
+ ഹൈക്കോടതി
235
+ ക്രിമിനൽ
236
+ പീനൽ
237
+ ലോക്
238
+ അദാലത്ത്
239
+ ഗ്രാമക്കോടതികൾ
240
+
241
+
242
+
243
+ # Latin legal terms (single words)
244
+ Fiat
245
+ Supra
246
+ Lacuna
247
+ Mandamus
248
+ Certiorari
249
+
250
+
251
+
252
+ # Regex patterns - flexible matching for witness/exhibit designations
253
+ # Prefix with REGEX: to use pattern directly (not escaped)
254
+ REGEX: PW[-\s]*\d+
255
+ REGEX: CW[-\s]*\d+
256
+ REGEX: DW[-\s]*\d+
257
+ REGEX: Ext[.\-][-\s]*[A-Z]\d*
258
+ REGEX: Ext[.\-][-\s]*P\d*
259
+ REGEX: Evidence\s+Act[-\s]*\d+
260
+
261
+ # Multi-word legal entities (must use regex patterns with \s+ for spaces)
262
+ # English terms
263
+ REGEX: Police\s+Station
264
+ REGEX: Supreme\s+Court
265
+ REGEX: High\s+Court
266
+ REGEX: District\s+Court
267
+ REGEX: Sessions\s+Court
268
+ REGEX: Magistrate\s+Court
269
+ REGEX: Trial\s+Court
270
+ REGEX: Civil\s+Court
271
+ REGEX: Criminal\s+Court
272
+ REGEX: Family\s+Court
273
+ REGEX: Labour\s+Court
274
+
275
+ # Malayalam multi-word legal terms
276
+ REGEX: അഴിമതി\s+കേസ്
277
+ REGEX: അന്യായപ്പട്ടിക\s+വസ്തു
278
+ REGEX: ഫോറൻസിക്\s+വിദഗ്ദ്ധൻ
279
+ REGEX: പ്രൂഫ്\s+അഫിഡവിറ്റ്‌
280
+ REGEX: അഡ്വക്കേറ്റ്\s+കമ്മീഷണർ
281
+
282
+ # Latin legal phrases (2 words)
283
+ REGEX: Bona\s+Fide
284
+ REGEX: Ex\s+parte
285
+ REGEX: Inter\s+alia
286
+ REGEX: Locus\s+Standi
287
+ REGEX: Mens\s+rea
288
+ REGEX: Non\s+obstante
289
+ REGEX: Prima\s+facie
290
+ REGEX: Res\s+Judicata
291
+ REGEX: Ultra\s+vires
292
+ REGEX: Ad\s+Hoc
293
+ REGEX: Amicus\s+curiae
294
+ REGEX: De\s+novo
295
+ REGEX: De\s+jure
296
+ REGEX: Habeas\s+corpus
297
+ REGEX: In\s+limine
298
+ REGEX: Mala\s+Fide
299
+ REGEX: Obiter\s+[Dd]icta
300
+ REGEX: Pendente\s+lite
301
+ REGEX: Per\s+incuriam
302
+ REGEX: Suo\s+Motu
303
+ REGEX: De\s+facto
304
+ REGEX: Ejusdem\s+Generis
305
+ REGEX: Ex\s+ante
306
+ REGEX: In\s+Personam
307
+ REGEX: In\s+rem
308
+ REGEX: In\s+Situ
309
+ REGEX: Ipse\s+Dixit
310
+ REGEX: Ipso\s+Facto
311
+ REGEX: Modus\s+Operandi
312
+ REGEX: Mutatis\s+mutandis
313
+ REGEX: Obiter\s+dictum
314
+ REGEX: Onus\s+probandi
315
+ REGEX: Pari\s+Materia
316
+ REGEX: Per\s+curiam
317
+ REGEX: Pro\s+bono
318
+ REGEX: Quasi\s+judicial
319
+ REGEX: Quo\s+Warranto
320
+ REGEX: Ratio\s+decidendi
321
+ REGEX: Res\s+Integra
322
+ REGEX: Sine\s+Die
323
+ REGEX: Stare\s+Decisis
324
+ REGEX: Status\s+quo
325
+ REGEX: Sub\s+judice
326
+ REGEX: Sub\s+Silentio
327
+ REGEX: Ab\s+initio
328
+ REGEX: Audi\s+alteram\s+partem
329
+ REGEX: Functus\s+officio
330
+ REGEX: Ex[-\s]*officio
331
+ REGEX: Fait\s+accompli
332
+ REGEX: Lis\s+pendens
333
+ REGEX: Caveat\s+emptor
334
+ REGEX: Sui\s+generis
335
+ REGEX: Ex\s+Gratia
336
+ REGEX: In\s+Re
337
+ REGEX: Actus\s+Reus
338
+ REGEX: In\s+absentia
339
+ REGEX: Per\s+Contra
340
+ REGEX: Per\s+Capita
341
+ REGEX: Post\s+Mortem
342
+ REGEX: Caveat\s+venditor
343
+
344
+ # Latin legal phrases (3+ words)
345
+ REGEX: Void\s+Ab\s+Initio
346
+ REGEX: Consensus\s+ad\s+idem
347
+ REGEX: Damnum\s+sine\s+injuria
348
+ REGEX: Ex\s+Post\s+Facto
349
+ REGEX: Jus\s+Ad\s+Rem
350
+ REGEX: Jus\s+in\s+rem
351
+ REGEX: Nemo\s+Judex\s+in\s+Causa\s+Sua
352
+ REGEX: Non\s+Est\s+Factum
353
+ REGEX: Noscitur\s+a\s+Sociis
354
+ REGEX: Quid\s+Pro\s+Quo
355
+ REGEX: Res\s+Ipsa\s+Loquitur
356
+ REGEX: Sine\s+qua\s+non
357
+ REGEX: Status\s+quo\s+ante
358
+ REGEX: Ubi\s+Jus\s+Ibi\s+Remedium
359
+ REGEX: Volenti\s+Non\s+Fit\s+Injuria
360
+ REGEX: In\s+Loco\s+Parentis
361
+ REGEX: Injuria\s+sine\s+damno
362
+
363
+ # Pattern explanations:
364
+ # PW[-\s]*\d+ matches: PW1, PW 1, PW-1, PW-123 (prosecution witness)
365
+ # CW[-\s]*\d+ matches: CW1, CW 1, CW-1 (court witness)
366
+ # DW[-\s]*\d+ matches: DW1, DW 1, DW-1 (defence witness)
367
+ # Ext\.[-\s]*[A-Z]\d* matches: Ext.A, Ext. A1, Ext-B2 (exhibits)
368
+ # Ext\.[-\s]*P\d* matches: Ext.P, Ext. P1, Ext-P2 (prosecution exhibits)
369
+ # Evidence\s+Act[-\s]*\d+ matches: Evidence Act 65, Evidence Act-101 (Evidence Act sections)
@@ -0,0 +1,29 @@
1
+ # Medical Domain Configuration
2
+ # Medical units and dosages for healthcare ASR
3
+
4
+ # Metadata
5
+ @name: medical
6
+ @category: MEDICAL
7
+ @case_sensitive: false
8
+
9
+ # Literal terms - common medical units
10
+ mg
11
+ ml
12
+ cc
13
+ mcg
14
+ IU
15
+ kg
16
+ gm
17
+
18
+ # Regex patterns - dosage with optional spacing
19
+ REGEX: \d+\s*mg
20
+ REGEX: \d+\s*ml
21
+ REGEX: \d+\s*cc
22
+ REGEX: \d+\s*mcg
23
+ REGEX: \d+\s*mg/ml
24
+ REGEX: \d+\s*IU
25
+
26
+ # Pattern explanations:
27
+ # \d+\s*mg matches: 500mg, 500 mg (milligrams)
28
+ # \d+\s*ml matches: 10ml, 10 ml (milliliters)
29
+ # \d+\s*mg/ml matches: 50mg/ml, 50 mg/ml (concentration)
@@ -0,0 +1,34 @@
1
+ # Technical Domain Configuration
2
+ # Technical abbreviations and version identifiers
3
+
4
+ # Metadata
5
+ @name: technical
6
+ @category: TECH
7
+ @case_sensitive: true
8
+
9
+ # Literal terms - common technical abbreviations
10
+ # Case-sensitive to distinguish API from "api" (casual usage)
11
+ API
12
+ SDK
13
+ CLI
14
+ JSON
15
+ XML
16
+ HTTP
17
+ HTTPS
18
+ REST
19
+ SOAP
20
+ JWT
21
+ SQL
22
+ NoSQL
23
+ HTML
24
+ CSS
25
+ URL
26
+ URI
27
+
28
+ # Regex patterns - version numbers
29
+ REGEX: v\d+\.\d+(?:\.\d+)?
30
+ REGEX: \d+\.\d+\.\d+
31
+
32
+ # Pattern explanations:
33
+ # v\d+\.\d+(?:\.\d+)? matches: v1.0, v2.3.4, v10.15.2
34
+ # \d+\.\d+\.\d+ matches: 1.0.0, 2.3.4 (semantic versioning)