nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: yamatoiizuka/palt-typesetting
Pull request #80 (2024-02-12 01:48:10)

Update `latinRegex`
記号類はフォント制作ソフト Glyphs の分類を参考に、下記を追加した。
- 通貨記号 ¢¤$€£¥
- 数学的記号 +−×÷=≠><≥≤±≈~¬∅∞∫∏∑√∂%‰
- ¡¿ 等の記号

上付き文字・下付き文字は下記を追加した。
- [“Superscripts and Subscripts”](https://www.compart.com/en/unicode/block/U+2070)ブロックのうち、Latin ブロックに含まれていないもの
- 上記ブロックに含まれていない ¹²³



Patch:
diff --git a/src/util-regex.ts b/src/util-regex.ts
index 7bc366a..d51e812 100644
--- a/src/util-regex.ts
+++ b/src/util-regex.ts
@@ -1,7 +1,8 @@
 /**
  * ラテン文字、数字、基本的な記号類
  */
-export const latinRegex = /[\p{scx=Latin}0-9!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~\s]+/u
+export const latinRegex =
+  /[\p{scx=Latin}0-9⁰¹²³⁴-⁾₀-₎¢¤$€£¥+−×÷=≠><≥≤±≈~¬∅∞∫∏∑√∂%‰@&.,:;!¡?¿'"‘’“”\-(){}[\]|/\\^_`*#\s]+/u
 
 /**
  * 日本語


Test patch:
diff --git a/tests/apply-style.test.ts b/tests/apply-style.test.ts
index 5271726..671cd06 100644
--- a/tests/apply-style.test.ts
+++ b/tests/apply-style.test.ts
@@ -63,6 +63,27 @@ describe('applyStyleToSegment', () => {
     expect(applyStyleToSegment(current, next, options)).toEqual(expected)
   })
 
+  it("applies 'latin' class to currency symbols", () => {
+    const current = '¥1,400'
+    const next = ''
+    const expected = '<span class="typeset-latin">¥1,400</span>'
+    expect(applyStyleToSegment(current, next, options)).toEqual(expected)
+  })
+
+  it("applies 'latin' class to subscript numbers", () => {
+    const current = 'CO₂'
+    const next = ''
+    const expected = '<span class="typeset-latin">CO₂</span>'
+    expect(applyStyleToSegment(current, next, options)).toEqual(expected)
+  })
+
+  it("applies 'latin' class to superscript numbers", () => {
+    const current = '¹³⁷Cs'
+    const next = ''
+    const expected = '<span class="typeset-latin">¹³⁷Cs</span>'
+    expect(applyStyleToSegment(current, next, options)).toEqual(expected)
+  })
+
   it("adds kerning tag after 'で'", () => {
     const current = 'す'
     const next = '。'