{
  "appeals": 1,
  "budgets": {
    "baseline_limit_s": 600,
    "verification_timeout_s": 600,
    "worker": {
      "max_completion_tokens": 96000,
      "max_turns": 60,
      "max_wall_seconds": 1500.0,
      "prompt_token_budget": 160000
    }
  },
  "issue": "bug: Tone detector + syllable sound bug\n### Description\n\nHello, thanks for your work. First and foremost, I am not very skilled in thai, but I think there might be two errors in the functions mentioned above:\r\n\r\n1. for `\u0e1b\u0e23\u0e30`, `sound_syllable` is returning `live`, but afaik it is dead.\r\n2. for `\u0e40\u0e2d`, as in the loanword \u0e27\u0e34\u0e15\u0e32\u0e21\u0e34\u0e19\u0e40\u0e2d, an out of range error is thrown in `tone_detector`. According to http://www.thai-language.com/id/219142 it would be mid tone, so I'd guess middle class consonant, live ending.\r\n\r\n```diff\r\ndiff --git a/tests/core/test_util.py b/tests/core/test_util.py\r\nindex 5d674221..59c647e2 100644\r\n--- a/tests/core/test_util.py\r\n+++ b/tests/core/test_util.py\r\n@@ -680,9 +680,10 @@ class UtilTestCase(unittest.TestCase):\r\n             (\"\u0e40\u0e1e\u0e23\u0e32\u0e30\", \"dead\"),\r\n             (\"\u0e40\u0e01\u0e32\u0e30\", \"dead\"),\r\n             (\"\u0e41\u0e04\u0e30\", \"dead\"),\r\n+            (\"\u0e1b\u0e23\u0e30\", \"dead\"),\r\n         ]\r\n         for i, j in test:\r\n-            self.assertEqual(sound_syllable(i), j)\r\n+            self.assertEqual(sound_syllable(i), j, f\"{i} should be determined to be a '{j}' syllable.\")\r\n \r\n     def test_tone_detector(self):\r\n         data = [\r\n@@ -710,9 +711,10 @@ class UtilTestCase(unittest.TestCase):\r\n             (\"f\", \"\u0e1c\u0e39\u0e49\"),\r\n             (\"h\", \"\u0e04\u0e23\u0e31\u0e1a\"),\r\n             (\"f\", \"\u0e04\u0e48\u0e30\"),\r\n+            (\"m\", \"\u0e40\u0e2d\"), # Pronounciation of the english letter A, as in \u0e27\u0e34\u0e15\u0e32\u0e21\u0e34\u0e19\u0e40\u0e2d (vitamin A)\r\n         ]\r\n         for i, j in data:\r\n-            self.assertEqual(tone_detector(j), i)\r\n+            self.assertEqual(tone_detector(j), i, f\"{j} should be determined to be a '{i}' tone.\")\r\n \r\n     def test_syllable_length(self):\r\n         self.assertEqual(syllable_length(\"\u0e21\u0e32\u0e01\"), \"long\")\r\n```\r\n\r\n```sh\r\npython -m unittest tests/core/test_util.py\r\n....................F............E.\r\n======================================================================\r\nERROR: test_tone_detector (tests.core.test_util.UtilTestCase.test_tone_detector)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/tmp/pythainlp/tests/core/test_util.py\", line 717, in test_tone_detector\r\n    self.assertEqual(tone_detector(j), i, f\"{j} should be determined to be a '{i}' tone.\")\r\n                     ~~~~~~~~~~~~~^^^\r\n  File \"/tmp/pythainlp/pythainlp/util/syllable.py\", line 241, in tone_detector\r\n    s = sound_syllable(syllable)\r\n  File \"/tmp/pythainlp/pythainlp/util/syllable.py\", line 87, in sound_syllable\r\n    spelling_consonant = consonants[-1]\r\n                         ~~~~~~~~~~^^^^\r\nIndexError: list index out of range\r\n\r\n======================================================================\r\nFAIL: test_sound_syllable (tests.core.test_util.UtilTestCase.test_sound_syllable)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/tmp/pythainlp/tests/core/test_util.py\", line 686, in test_sound_syllable\r\n    self.assertEqual(sound_syllable(i), j, f\"{i} should be determined to be a '{j}' syllable.\")\r\n    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nAssertionError: 'live' != 'dead'\r\n- live\r\n+ dead\r\n : \u0e1b\u0e23\u0e30 should be determined to be a 'dead' syllable.\r\n\r\n----------------------------------------------------------------------\r\nRan 35 tests in 1.704s\r\n\r\nFAILED (failures=1, errors=1)\r\n```\n\n### Expected results\n\n* \u0e1b\u0e23\u0e30 is determined as dead syllable\r\n* \u0e40\u0e2d is determined as mid tone\n\n### Current results\n\n* \u0e1b\u0e23\u0e30 is determined as live syllable\r\n* \u0e40\u0e2d throws an error while determining the tone\n\n### Steps to reproduce\n\n`git diff apply` the provided diff and run the unit tests `python -m unittest tests/core/test_util.py`\n\n### PyThaiNLP version\n\ndev\n\n### Python version\n\n3.13.1\n\n### Operating system and version\n\nfedora\n\n### More info\n\n_No response_\n\n### Possible solution\n\nUnfortunately, I don't know.\n\n### Files\n\n_No response_",
  "source": {
    "image": "docker.io/swerebenchv2/pythainlp-pythainlp:1056-37f6ba8",
    "platform": "linux/amd64",
    "python": "python",
    "setup": [
      "python -c 'import base64; from pathlib import Path; Path('\"'\"'/tmp/receipts-pythainlp__pythainlp-1056-test.patch'\"'\"').write_bytes(base64.b64decode('\"'\"'ZGlmZiAtLWdpdCBhL3Rlc3RzL2NvcmUvdGVzdF91dGlsLnB5IGIvdGVzdHMvY29yZS90ZXN0X3V0aWwucHkKaW5kZXggNWQ2NzQyMjEuLmYwYThlMzFiIDEwMDY0NAotLS0gYS90ZXN0cy9jb3JlL3Rlc3RfdXRpbC5weQorKysgYi90ZXN0cy9jb3JlL3Rlc3RfdXRpbC5weQpAQCAtNjgwLDkgKzY4MCwxNCBAQCBjbGFzcyBVdGlsVGVzdENhc2UodW5pdHRlc3QuVGVzdENhc2UpOgogICAgICAgICAgICAgKCLguYDguJ7guKPguLLguLAiLCAiZGVhZCIpLAogICAgICAgICAgICAgKCLguYDguIHguLLguLAiLCAiZGVhZCIpLAogICAgICAgICAgICAgKCLguYHguITguLAiLCAiZGVhZCIpLAorICAgICAgICAgICAgKCLguJvguKPguLAiLCAiZGVhZCIpLAogICAgICAgICBdCiAgICAgICAgIGZvciBpLCBqIGluIHRlc3Q6Ci0gICAgICAgICAgICBzZWxmLmFzc2VydEVxdWFsKHNvdW5kX3N5bGxhYmxlKGkpLCBqKQorICAgICAgICAgICAgc2VsZi5hc3NlcnRFcXVhbCgKKyAgICAgICAgICAgICAgICBzb3VuZF9zeWxsYWJsZShpKSwKKyAgICAgICAgICAgICAgICBqLAorICAgICAgICAgICAgICAgIGYie2l9IHNob3VsZCBiZSBkZXRlcm1pbmVkIHRvIGJlIGEgJ3tqfScgc3lsbGFibGUuIgorICAgICAgICAgICAgKQogCiAgICAgZGVmIHRlc3RfdG9uZV9kZXRlY3RvcihzZWxmKToKICAgICAgICAgZGF0YSA9IFsKQEAgLTcxMCw5ICs3MTUsMTQgQEAgY2xhc3MgVXRpbFRlc3RDYXNlKHVuaXR0ZXN0LlRlc3RDYXNlKToKICAgICAgICAgICAgICgiZiIsICLguJzguLnguYkiKSwKICAgICAgICAgICAgICgiaCIsICLguITguKPguLHguJoiKSwKICAgICAgICAgICAgICgiZiIsICLguITguYjguLAiKSwKKyAgICAgICAgICAgICgibSIsICLguYDguK0iKSwKICAgICAgICAgXQogICAgICAgICBmb3IgaSwgaiBpbiBkYXRhOgotICAgICAgICAgICAgc2VsZi5hc3NlcnRFcXVhbCh0b25lX2RldGVjdG9yKGopLCBpKQorICAgICAgICAgICAgc2VsZi5hc3NlcnRFcXVhbCgKKyAgICAgICAgICAgICAgICB0b25lX2RldGVjdG9yKGopLAorICAgICAgICAgICAgICAgIGksCisgICAgICAgICAgICAgICAgZiJ7an0gc2hvdWxkIGJlIGRldGVybWluZWQgdG8gYmUgYSAne2l9JyB0b25lLiIKKyAgICAgICAgICAgICkKIAogICAgIGRlZiB0ZXN0X3N5bGxhYmxlX2xlbmd0aChzZWxmKToKICAgICAgICAgc2VsZi5hc3NlcnRFcXVhbChzeWxsYWJsZV9sZW5ndGgoIuC4oeC4suC4gSIpLCAibG9uZyIpCg=='\"'\"'))'",
      "git apply /tmp/receipts-pythainlp__pythainlp-1056-test.patch"
    ],
    "workdir": "/pythainlp"
  },
  "spec_paths": [
    "tests/core/test_util.py"
  ],
  "spec_tests": [
    "tests/core/test_util.py::UtilTestCase::test_sound_syllable",
    "tests/core/test_util.py::UtilTestCase::test_tone_detector"
  ],
  "suite_scope": "--no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning tests/core/test_util.py"
}
