diff --git a/reasoning_gym/algorithmic/word_sorting.py b/reasoning_gym/algorithmic/word_sorting.py index e0b40da3..51f96140 100644 --- a/reasoning_gym/algorithmic/word_sorting.py +++ b/reasoning_gym/algorithmic/word_sorting.py @@ -95,7 +95,7 @@ class WordSortingDataset(ProceduralDataset): return { "question": f"Sort these words in {direction} order: {', '.join(transformed_words)}", - "answer": str(answer), + "answer": ", ".join(answer), "metadata": { "original_words": original_words, "transformed_words": transformed_words, diff --git a/tests/test_word_sorting.py b/tests/test_word_sorting.py index bb673883..14f44204 100644 --- a/tests/test_word_sorting.py +++ b/tests/test_word_sorting.py @@ -94,7 +94,7 @@ def test_word_sorting_dataset_items(): # Verify sorting direction = item["metadata"]["direction"] - sorted_words = eval(item["answer"]) + sorted_words = item["answer"].split(", ") if direction == "ascending": assert sorted_words == sorted(sorted_words) else: