Awkweave: 114k execution-verified natural-language-to-awk examples
Browse files- .gitattributes +1 -0
- DATASET_LICENSE.txt +11 -0
- LICENSE +202 -0
- README.md +114 -0
- audit_paraphrases.py +124 -0
- awkweave/__init__.py +3 -0
- awkweave/execution.py +68 -0
- awkweave/prompts.py +12 -0
- challenge_data.py +131 -0
- data/challenge.jsonl +33 -0
- data/test.jsonl +0 -0
- data/train.jsonl +3 -0
- data/validation.jsonl +0 -0
- finalize_dataset.py +45 -0
- generate_data.py +344 -0
- paraphrase-audit.jsonl +420 -0
- paraphrase-audit.summary.json +10 -0
- paraphrase_data.py +210 -0
- validate_dataset.py +104 -0
- validation.json +122 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
data/train.jsonl filter=lfs diff=lfs merge=lfs -text
|
DATASET_LICENSE.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Awkweave dataset rows are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
|
| 2 |
+
|
| 3 |
+
Copyright 2026 Asterbraid.
|
| 4 |
+
|
| 5 |
+
You are free to share and adapt the dataset, including for commercial purposes, provided that you give appropriate credit to Asterbraid, provide a link to the license, and indicate if changes were made. You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
|
| 6 |
+
|
| 7 |
+
The full license and its disclaimer of warranties and limitation of liability are available at:
|
| 8 |
+
https://creativecommons.org/licenses/by/4.0/
|
| 9 |
+
https://creativecommons.org/licenses/by/4.0/legalcode
|
| 10 |
+
|
| 11 |
+
This notice applies to dataset rows, not to the Apache-2.0-licensed code or model weights.
|
LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language: en
|
| 4 |
+
pretty_name: Awkweave Data
|
| 5 |
+
size_categories:
|
| 6 |
+
- 100K<n<1M
|
| 7 |
+
task_categories:
|
| 8 |
+
- text-generation
|
| 9 |
+
tags:
|
| 10 |
+
- awk
|
| 11 |
+
- code-generation
|
| 12 |
+
- text-to-code
|
| 13 |
+
- execution-verified
|
| 14 |
+
- synthetic-data
|
| 15 |
+
configs:
|
| 16 |
+
- config_name: default
|
| 17 |
+
data_files:
|
| 18 |
+
- split: train
|
| 19 |
+
path: data/train.jsonl
|
| 20 |
+
- split: validation
|
| 21 |
+
path: data/validation.jsonl
|
| 22 |
+
- split: test
|
| 23 |
+
path: data/test.jsonl
|
| 24 |
+
- split: challenge
|
| 25 |
+
path: data/challenge.jsonl
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
# Awkweave Data
|
| 29 |
+
|
| 30 |
+
Execution-verified natural-language-to-`awk` examples for training and evaluating small local code models. Each row contains a request, an `awk` program, two input texts, and the exact output produced by real `awk` for each input.
|
| 31 |
+
|
| 32 |
+
## Rows
|
| 33 |
+
|
| 34 |
+
| Split | Rows | Purpose |
|
| 35 |
+
| --- | ---: | --- |
|
| 36 |
+
| train | 107994 | Supervised fine-tuning |
|
| 37 |
+
| validation | 3000 | Training diagnostics |
|
| 38 |
+
| test | 3000 | Held-out grammar-generated evaluation |
|
| 39 |
+
| challenge | 33 | Separately hand-authored tasks; never used for training |
|
| 40 |
+
| **total** | **114027** | |
|
| 41 |
+
|
| 42 |
+
The training split contains original grammar-generated requests and guarded paraphrases. Validation, test, and challenge requests are not paraphrased. A paraphrase row has `paraphrase_of` pointing to its source row and exactly the same program, inputs, outputs, and split.
|
| 43 |
+
|
| 44 |
+
Sources: {"original-grammar": 60000, "openrouter-paraphrase": 52642, "original-grammar-copy": 1352, "original-hand-authored": 33}
|
| 45 |
+
|
| 46 |
+
## Example
|
| 47 |
+
|
| 48 |
+
```json
|
| 49 |
+
{
|
| 50 |
+
"id": "awkweave-0000000",
|
| 51 |
+
"request": "Print column 3 followed by column 1 for every record.",
|
| 52 |
+
"program": "{print $3, $1}",
|
| 53 |
+
"input_text": "bruno kim hana pending ready\neli farah lina paused active\nivan bruno dina failed ready\ngus gus jules closed pending\nbruno kim farah paused pending\ndina gus alice pending pending\ngus gus eli closed failed\ndina lina dina paused paused\n",
|
| 54 |
+
"expected_output": "hana bruno\nlina eli\ndina ivan\njules gus\nfarah bruno\nalice dina\neli gus\ndina dina\n",
|
| 55 |
+
"family": "project_fields",
|
| 56 |
+
"difficulty": 1,
|
| 57 |
+
"split": "train"
|
| 58 |
+
}
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Fields
|
| 62 |
+
|
| 63 |
+
- `id`: stable unique identifier.
|
| 64 |
+
- `request`: English text-processing request.
|
| 65 |
+
- `program`: target `awk` program only, without the `awk` executable or a filename.
|
| 66 |
+
- `input_text` / `expected_output`: primary execution pair.
|
| 67 |
+
- `validation_input` / `validation_output`: a second execution pair with different records.
|
| 68 |
+
- `family` / `difficulty`: generator family and 1–3 difficulty label.
|
| 69 |
+
- `split`: train, validation, test, or challenge.
|
| 70 |
+
- `source`: original grammar, guarded paraphrase, or hand-authored provenance.
|
| 71 |
+
- `license`: `CC-BY-4.0` for every row.
|
| 72 |
+
|
| 73 |
+
## Execution verification
|
| 74 |
+
|
| 75 |
+
Every row in this release was re-executed with `mawk 1.3.4 20200120` on both inputs. Programs passed only when both outputs exactly matched the stored outputs: **228054 successful executions, 0 errors**. `validation.json` contains the release hash and full counts.
|
| 76 |
+
|
| 77 |
+
The generator uses POSIX-style constructs and avoids file input/output, subprocesses, environment access, and pipes. The included `awkweave.execution` module applies the same safety restrictions and runs programs on stdin.
|
| 78 |
+
|
| 79 |
+
## Use
|
| 80 |
+
|
| 81 |
+
```python
|
| 82 |
+
from datasets import load_dataset
|
| 83 |
+
|
| 84 |
+
ds = load_dataset("asterbraid/awkweave-data")
|
| 85 |
+
print(ds["train"][0]["request"])
|
| 86 |
+
print(ds["train"][0]["program"])
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## Paraphrase audit
|
| 90 |
+
|
| 91 |
+
An independent `qwen/qwen3.5-9b` audit targeted 500 accepted paraphrases and completed 420; 80 could not be audited because of API rate limits. It marked 414 semantically equivalent and 6 disputed; disputed paraphrases were excluded before freezing this release. Original grammar rows remain available for every excluded paraphrase.
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
The `awkweave/` directory and generator scripts are included for reproducibility. To combine the files for the supplied training script:
|
| 95 |
+
|
| 96 |
+
```bash
|
| 97 |
+
cat data/train.jsonl data/validation.jsonl data/test.jsonl data/challenge.jsonl > awkweave-release.jsonl
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
## Scope and limitations
|
| 101 |
+
|
| 102 |
+
- English only; output is an `awk` program, not a general shell command.
|
| 103 |
+
- Simple whitespace-, tab-, and comma-separated input. Quoted CSV, multi-file joins, and external pipelines are out of scope.
|
| 104 |
+
- Train, validation, and test cases come from the same 39-family grammar with different random records. Input texts are disjoint, but identical request/program pairs can recur with different input records. Test accuracy is an in-distribution measurement.
|
| 105 |
+
- The 33-row challenge split is separately authored around HTTP logs, passwd-style records, key=value events, sales tables, and general record transformations. It is a useful qualitative check, not a large representative benchmark.
|
| 106 |
+
- Exact execution verifies the reference programs, not that every natural-language request is unambiguous or that generated model programs will be correct.
|
| 107 |
+
|
| 108 |
+
## Provenance and license
|
| 109 |
+
|
| 110 |
+
All programs, inputs, and reference outputs are original synthetic artifacts. No scraped text or personal data is included. Selected training requests were paraphrased with `qwen/qwen3.7-plus` through OpenRouter; numeric and literal guards rejected semantic changes. The challenge requests and programs were separately authored for this project.
|
| 111 |
+
|
| 112 |
+
Dataset rows are **CC-BY-4.0**. Attribute **Asterbraid** when redistributing or adapting them. Included code is Apache-2.0.
|
| 113 |
+
|
| 114 |
+
Release data SHA-256 (concatenated split order train/validation/test/challenge): `3e66b6bc053b380342d8f654400030f5c5f2aeab8482762fcfda44d3dae2bc5b`
|
audit_paraphrases.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import concurrent.futures
|
| 5 |
+
import json
|
| 6 |
+
import os
|
| 7 |
+
import random
|
| 8 |
+
import time
|
| 9 |
+
import urllib.request
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
MODEL = "qwen/qwen3.5-9b"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def audit_batch(rows: list[dict]) -> list[bool]:
|
| 16 |
+
pairs = [{"original": row["original_request"], "paraphrase": row["request"]} for row in rows]
|
| 17 |
+
payload = {
|
| 18 |
+
"model": MODEL,
|
| 19 |
+
"messages": [
|
| 20 |
+
{
|
| 21 |
+
"role": "system",
|
| 22 |
+
"content": (
|
| 23 |
+
"You audit technical paraphrases. Return only valid JSON. Mark equivalence true "
|
| 24 |
+
"only when both requests describe exactly the same text-processing operation, "
|
| 25 |
+
"including field positions and names, literal values, inclusion and exclusion, "
|
| 26 |
+
"input separators, output formatting, ordering, and tie-breaking. Wording may differ. "
|
| 27 |
+
"If either request adds, removes, or changes a constraint, mark false."
|
| 28 |
+
),
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"role": "user",
|
| 32 |
+
"content": "Return {\"equivalent\": [true or false, ...]} with one boolean per pair.\n"
|
| 33 |
+
+ json.dumps(pairs, ensure_ascii=False),
|
| 34 |
+
},
|
| 35 |
+
],
|
| 36 |
+
"response_format": {"type": "json_object"},
|
| 37 |
+
"temperature": 0,
|
| 38 |
+
"max_tokens": 2000,
|
| 39 |
+
"reasoning": {"enabled": False},
|
| 40 |
+
}
|
| 41 |
+
request = urllib.request.Request(
|
| 42 |
+
os.environ["OPENROUTER_BASE_URL"].rstrip("/") + "/chat/completions",
|
| 43 |
+
data=json.dumps(payload).encode("utf-8"),
|
| 44 |
+
headers={
|
| 45 |
+
"Authorization": "Bearer " + os.environ["OPENROUTER_API_KEY"],
|
| 46 |
+
"Content-Type": "application/json",
|
| 47 |
+
},
|
| 48 |
+
)
|
| 49 |
+
for attempt in range(6):
|
| 50 |
+
try:
|
| 51 |
+
with urllib.request.urlopen(request, timeout=120) as response:
|
| 52 |
+
data = json.load(response)
|
| 53 |
+
result = json.loads(data["choices"][0]["message"]["content"])["equivalent"]
|
| 54 |
+
if not isinstance(result, list) or len(result) != len(rows) or not all(isinstance(value, bool) for value in result):
|
| 55 |
+
raise ValueError("Invalid equivalence response")
|
| 56 |
+
return result
|
| 57 |
+
except Exception:
|
| 58 |
+
if attempt == 5:
|
| 59 |
+
raise
|
| 60 |
+
time.sleep(min(30, 2 ** attempt))
|
| 61 |
+
raise AssertionError("unreachable")
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def main() -> None:
|
| 65 |
+
parser = argparse.ArgumentParser()
|
| 66 |
+
parser.add_argument("data", type=Path)
|
| 67 |
+
parser.add_argument("output", type=Path)
|
| 68 |
+
parser.add_argument("--rows", type=int, default=500)
|
| 69 |
+
parser.add_argument("--batch-size", type=int, default=10)
|
| 70 |
+
parser.add_argument("--workers", type=int, default=8)
|
| 71 |
+
parser.add_argument("--seed", type=int, default=20261128)
|
| 72 |
+
args = parser.parse_args()
|
| 73 |
+
all_rows = [json.loads(line) for line in args.data.open(encoding="utf-8")]
|
| 74 |
+
originals = {row["id"]: row for row in all_rows if not row.get("paraphrase_of")}
|
| 75 |
+
candidates = [row for row in all_rows if row["source"] == "openrouter-paraphrase"]
|
| 76 |
+
random.Random(args.seed).shuffle(candidates)
|
| 77 |
+
selected = candidates[: args.rows]
|
| 78 |
+
for row in selected:
|
| 79 |
+
row["original_request"] = originals[row["paraphrase_of"]]["request"]
|
| 80 |
+
existing = {}
|
| 81 |
+
if args.output.exists():
|
| 82 |
+
for line in args.output.open(encoding="utf-8"):
|
| 83 |
+
row = json.loads(line)
|
| 84 |
+
existing[row["id"]] = row
|
| 85 |
+
pending = [row for row in selected if row["id"] not in existing]
|
| 86 |
+
batches = [pending[index:index + args.batch_size] for index in range(0, len(pending), args.batch_size)]
|
| 87 |
+
failures = 0
|
| 88 |
+
completed = len(selected) - len(pending)
|
| 89 |
+
with concurrent.futures.ThreadPoolExecutor(max_workers=args.workers) as executor:
|
| 90 |
+
futures = {executor.submit(audit_batch, batch): batch for batch in batches}
|
| 91 |
+
for future in concurrent.futures.as_completed(futures):
|
| 92 |
+
batch = futures[future]
|
| 93 |
+
try:
|
| 94 |
+
verdicts = future.result()
|
| 95 |
+
except Exception as error:
|
| 96 |
+
failures += len(batch)
|
| 97 |
+
print(f"Audit batch failed; rerun to resume: {error}", flush=True)
|
| 98 |
+
continue
|
| 99 |
+
with args.output.open("a", encoding="utf-8") as handle:
|
| 100 |
+
for row, equivalent in zip(batch, verdicts):
|
| 101 |
+
handle.write(json.dumps({
|
| 102 |
+
"id": row["id"], "original": row["original_request"],
|
| 103 |
+
"paraphrase": row["request"], "equivalent": equivalent,
|
| 104 |
+
}, ensure_ascii=False, separators=(",", ":")) + "\n")
|
| 105 |
+
completed += len(batch)
|
| 106 |
+
print(f"audited {completed}/{len(selected)}", flush=True)
|
| 107 |
+
results = list(existing.values())
|
| 108 |
+
if args.output.exists():
|
| 109 |
+
results = [json.loads(line) for line in args.output.open(encoding="utf-8")]
|
| 110 |
+
results.sort(key=lambda row: row["id"])
|
| 111 |
+
summary = {
|
| 112 |
+
"model": MODEL, "seed": args.seed, "rows": len(results), "requested": len(selected),
|
| 113 |
+
"missing": len(selected) - len(results), "equivalent": sum(row["equivalent"] for row in results),
|
| 114 |
+
"disputed": sum(not row["equivalent"] for row in results),
|
| 115 |
+
"audit_file": str(args.output),
|
| 116 |
+
}
|
| 117 |
+
args.output.with_suffix(".summary.json").write_text(json.dumps(summary, indent=2), encoding="utf-8")
|
| 118 |
+
print(json.dumps(summary, indent=2))
|
| 119 |
+
if failures or len(results) != len(selected):
|
| 120 |
+
raise SystemExit(1)
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
if __name__ == "__main__":
|
| 124 |
+
main()
|
awkweave/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Awkweave: execution-verified natural-language-to-awk tools."""
|
| 2 |
+
|
| 3 |
+
__version__ = "0.1.0"
|
awkweave/execution.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import re
|
| 4 |
+
import resource
|
| 5 |
+
import shutil
|
| 6 |
+
import subprocess
|
| 7 |
+
|
| 8 |
+
MAX_INPUT_BYTES = 1_000_000
|
| 9 |
+
MAX_PROGRAM_CHARS = 8_000
|
| 10 |
+
FORBIDDEN_PATTERN = re.compile(
|
| 11 |
+
r"\b(?:system|getline|ARGV|ARGC|ENVIRON|FILENAME|FNR|nextfile|close)\b",
|
| 12 |
+
re.IGNORECASE,
|
| 13 |
+
)
|
| 14 |
+
OUTPUT_REDIRECT_PATTERN = re.compile(
|
| 15 |
+
r"\bprintf?\b[^;\n}]*(?:>\s*(?:[\"/]|[A-Za-z_$])|(?<!\|)\|(?!\|))",
|
| 16 |
+
re.IGNORECASE,
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class UnsafeProgramError(ValueError):
|
| 21 |
+
pass
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def check_program(program: str) -> str:
|
| 25 |
+
program = program.strip()
|
| 26 |
+
if not program:
|
| 27 |
+
raise UnsafeProgramError("The awk program is empty.")
|
| 28 |
+
if len(program) > MAX_PROGRAM_CHARS:
|
| 29 |
+
raise UnsafeProgramError("The awk program is too long.")
|
| 30 |
+
if "\x00" in program:
|
| 31 |
+
raise UnsafeProgramError("The awk program contains a null byte.")
|
| 32 |
+
match = FORBIDDEN_PATTERN.search(program)
|
| 33 |
+
if match:
|
| 34 |
+
raise UnsafeProgramError(f"File, environment, and process access are not allowed: {match.group()}")
|
| 35 |
+
if OUTPUT_REDIRECT_PATTERN.search(program):
|
| 36 |
+
raise UnsafeProgramError("Output redirection and pipes are not allowed.")
|
| 37 |
+
return program
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def limit_resources() -> None:
|
| 41 |
+
resource.setrlimit(resource.RLIMIT_CPU, (2, 2))
|
| 42 |
+
resource.setrlimit(resource.RLIMIT_AS, (256_000_000, 256_000_000))
|
| 43 |
+
resource.setrlimit(resource.RLIMIT_FSIZE, (1_000_000, 1_000_000))
|
| 44 |
+
resource.setrlimit(resource.RLIMIT_CORE, (0, 0))
|
| 45 |
+
resource.setrlimit(resource.RLIMIT_NOFILE, (16, 16))
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def run_awk(program: str, input_text: str, timeout: float = 3.0) -> str:
|
| 49 |
+
program = check_program(program)
|
| 50 |
+
if len(input_text.encode("utf-8")) > MAX_INPUT_BYTES:
|
| 51 |
+
raise ValueError("Input text exceeds the 1 MB limit.")
|
| 52 |
+
executable = shutil.which("awk")
|
| 53 |
+
if executable is None:
|
| 54 |
+
raise RuntimeError("No awk executable is available on PATH.")
|
| 55 |
+
result = subprocess.run(
|
| 56 |
+
[executable, program],
|
| 57 |
+
input=input_text,
|
| 58 |
+
text=True,
|
| 59 |
+
capture_output=True,
|
| 60 |
+
timeout=timeout,
|
| 61 |
+
env={"LC_ALL": "C", "PATH": "/usr/bin:/bin"},
|
| 62 |
+
preexec_fn=limit_resources,
|
| 63 |
+
start_new_session=True,
|
| 64 |
+
check=False,
|
| 65 |
+
)
|
| 66 |
+
if result.returncode != 0:
|
| 67 |
+
raise ValueError(result.stderr.strip() or f"awk exited with status {result.returncode}")
|
| 68 |
+
return result.stdout
|
awkweave/prompts.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SYSTEM_PROMPT = """You write POSIX awk programs for text-processing requests. Given a request and sample input, return only the awk program, not the awk command or Markdown. Do not read or write files, invoke commands, or explain."""
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
def user_prompt(request: str, input_text: str) -> str:
|
| 5 |
+
return f"Request:\n{request.strip()}\n\nSample input:\n```text\n{input_text.rstrip()}\n```"
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def messages(request: str, input_text: str) -> list[dict[str, str]]:
|
| 9 |
+
return [
|
| 10 |
+
{"role": "system", "content": SYSTEM_PROMPT},
|
| 11 |
+
{"role": "user", "content": user_prompt(request, input_text)},
|
| 12 |
+
]
|
challenge_data.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
from awkweave.execution import run_awk
|
| 7 |
+
|
| 8 |
+
LOGS_1 = """192.0.2.10 - - [28/Nov/2026:10:00:00 +0000] \"GET /index.html HTTP/1.1\" 200 512
|
| 9 |
+
192.0.2.11 - - [28/Nov/2026:10:00:01 +0000] \"POST /api/orders HTTP/1.1\" 201 128
|
| 10 |
+
192.0.2.10 - - [28/Nov/2026:10:00:02 +0000] \"GET /missing HTTP/1.1\" 404 64
|
| 11 |
+
192.0.2.12 - - [28/Nov/2026:10:00:03 +0000] \"GET /api/orders HTTP/1.1\" 500 32
|
| 12 |
+
192.0.2.13 - - [28/Nov/2026:10:00:04 +0000] \"GET /index.html HTTP/1.1\" 200 256
|
| 13 |
+
"""
|
| 14 |
+
LOGS_2 = """198.51.100.20 - - [28/Nov/2026:11:00:00 +0000] \"GET /health HTTP/1.1\" 200 10
|
| 15 |
+
198.51.100.21 - - [28/Nov/2026:11:00:01 +0000] \"GET /api/items HTTP/1.1\" 503 0
|
| 16 |
+
198.51.100.20 - - [28/Nov/2026:11:00:02 +0000] \"POST /api/items HTTP/1.1\" 201 99
|
| 17 |
+
198.51.100.22 - - [28/Nov/2026:11:00:03 +0000] \"GET /health HTTP/1.1\" 200 20
|
| 18 |
+
"""
|
| 19 |
+
SALES_1 = """order_id region amount status
|
| 20 |
+
r001 east 12.50 paid
|
| 21 |
+
r002 west 20.00 pending
|
| 22 |
+
r003 east 7.50 paid
|
| 23 |
+
r004 north 10.00 paid
|
| 24 |
+
r005 west 5.00 paid
|
| 25 |
+
"""
|
| 26 |
+
SALES_2 = """order_id region amount status
|
| 27 |
+
r101 south 8.00 paid
|
| 28 |
+
r102 east 14.00 paid
|
| 29 |
+
r103 south 6.00 pending
|
| 30 |
+
r104 west 22.00 paid
|
| 31 |
+
"""
|
| 32 |
+
PASSWD_1 = """root:x:0:0:root:/root:/bin/bash
|
| 33 |
+
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
|
| 34 |
+
alice:x:1000:1000:Alice:/home/alice:/bin/bash
|
| 35 |
+
bruno:x:1001:1001:Bruno:/home/bruno:/bin/zsh
|
| 36 |
+
chen:x:1002:1002:Chen:/home/chen:/bin/bash
|
| 37 |
+
"""
|
| 38 |
+
PASSWD_2 = """root:x:0:0:root:/root:/bin/bash
|
| 39 |
+
dina:x:1000:1000:Dina:/home/dina:/bin/sh
|
| 40 |
+
eli:x:1001:1001:Eli:/home/eli:/bin/bash
|
| 41 |
+
"""
|
| 42 |
+
EVENTS_1 = """2026-11-28T09:00:00Z level=info service=web latency=12
|
| 43 |
+
2026-11-28T09:01:00Z level=error service=db latency=40
|
| 44 |
+
2026-11-28T09:02:00Z level=INFO service=web latency=18
|
| 45 |
+
2026-11-28T09:03:00Z level=warn service=db latency=25
|
| 46 |
+
"""
|
| 47 |
+
EVENTS_2 = """2026-11-28T12:00:00Z level=error service=api latency=33
|
| 48 |
+
2026-11-28T12:01:00Z level=info service=api latency=9
|
| 49 |
+
2026-11-28T12:02:00Z level=ERROR service=worker latency=51
|
| 50 |
+
"""
|
| 51 |
+
ROWS_1 = """alpha 10 4
|
| 52 |
+
beta 20 0
|
| 53 |
+
alpha 30 8
|
| 54 |
+
gamma 5 2
|
| 55 |
+
beta 15 3
|
| 56 |
+
"""
|
| 57 |
+
ROWS_2 = """red 8 2
|
| 58 |
+
red 12 4
|
| 59 |
+
blue 7 0
|
| 60 |
+
green 20 5
|
| 61 |
+
blue 9 3
|
| 62 |
+
"""
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def main() -> None:
|
| 66 |
+
output = Path("challenge.jsonl")
|
| 67 |
+
cases = []
|
| 68 |
+
|
| 69 |
+
def add(family: str, request: str, program: str, input_text: str, validation_input: str, difficulty: int = 3):
|
| 70 |
+
expected = run_awk(program, input_text)
|
| 71 |
+
validation_expected = run_awk(program, validation_input)
|
| 72 |
+
if not expected.strip():
|
| 73 |
+
raise ValueError(f"Empty challenge output: {family}")
|
| 74 |
+
index = len(cases) + 1
|
| 75 |
+
cases.append({
|
| 76 |
+
"id": f"awkweave-challenge-{index:04d}", "request": request, "program": program,
|
| 77 |
+
"input_text": input_text, "expected_output": expected,
|
| 78 |
+
"validation_input": validation_input, "validation_output": validation_expected,
|
| 79 |
+
"family": family, "difficulty": difficulty, "split": "challenge",
|
| 80 |
+
"source": "original-hand-authored", "license": "CC-BY-4.0",
|
| 81 |
+
})
|
| 82 |
+
|
| 83 |
+
add("http_5xx_count", "Count server-error responses with HTTP status from 500 through 599; print 0 when none occur.", '$9 >= 500 && $9 < 600{n++}END{print n+0}', LOGS_1, LOGS_2)
|
| 84 |
+
add("http_bytes_sum", "What is the total number of response bytes? Sum the final field and print one integer.", '{bytes+=$NF}END{print bytes+0}', LOGS_1, LOGS_2)
|
| 85 |
+
add("http_unique_clients", "Count distinct client IP addresses, which appear in field 1.", '{if(!seen[$1]++)n++}END{print n+0}', LOGS_1, LOGS_2)
|
| 86 |
+
add("http_api_errors", "Print the request path (field 7) for API routes with a 500 response.", '$7 ~ /^\/api\// && $9 == 500{print $7}', LOGS_1, LOGS_2)
|
| 87 |
+
add("http_success_bytes", "For responses with status 200 only, print the average number of bytes to two decimal places.", '$9==200{bytes+=$10;n++}END{printf "%.2f\\n",bytes/n}', LOGS_1, LOGS_2)
|
| 88 |
+
add("http_non_get", "Print complete request records for methods other than GET.", '$6 !~ /^"GET$/{print $0}', LOGS_1, LOGS_2)
|
| 89 |
+
add("http_url_counts", "Count each request path from field 7 and print path then count in first-appearance order.", '{if(!($7 in counts))order[++n]=$7;counts[$7]++}END{for(i=1;i<=n;i++)print order[i],counts[order[i]]}', LOGS_1, LOGS_2)
|
| 90 |
+
|
| 91 |
+
add("header_region_totals", "Use the header to find the region and amount columns. Print total paid amount per region in first-appearance order.", 'NR==1{for(i=1;i<=NF;i++)h[$i]=i;next}$h["status"]=="paid"{key=$h["region"];if(!(key in sums))order[++n]=key;sums[key]+=$h["amount"]}END{for(i=1;i<=n;i++)print order[i],sums[order[i]]}', SALES_1, SALES_2)
|
| 92 |
+
add("header_pending_ids", "The first line is a header. Print order_id values for pending orders only.", 'NR==1{for(i=1;i<=NF;i++)h[$i]=i;next}$h["status"]=="pending"{print $h["order_id"]}', SALES_1, SALES_2)
|
| 93 |
+
add("header_amount_average", "Read the amount column by its header name and print its mean over all data rows to two decimal places.", 'NR==1{for(i=1;i<=NF;i++)h[$i]=i;next}{s+=$h["amount"];n++}END{printf "%.2f\\n",s/n}', SALES_1, SALES_2)
|
| 94 |
+
add("top_two_amounts", "The first row is a header. Print the two complete orders with the largest amounts, highest first. Keep file order for ties.", 'NR==1{next}{n++;v[n]=$3+0;line[n]=$0}END{for(i=2;i<=n;i++){x=v[i];s=line[i];j=i-1;while(j>=1&&v[j]<x){v[j+1]=v[j];line[j+1]=line[j];j--}v[j+1]=x;line[j+1]=s}for(i=1;i<=2&&i<=n;i++)print line[i]}', SALES_1, SALES_2)
|
| 95 |
+
add("region_average", "The first row is a header. Print each region and its average order amount to two decimals, grouping in first-appearance order and including every status.", 'NR==1{next}{if(!($2 in sums))order[++n]=$2;sums[$2]+=$3;counts[$2]++}END{for(i=1;i<=n;i++)printf "%s %.2f\\n",order[i],sums[order[i]]/counts[order[i]]}', SALES_1, SALES_2)
|
| 96 |
+
add("amount_percentage", "The first row is a header. For every order, print order_id and its amount as a percentage of the grand total, with two decimals and a percent sign.", 'NR==1{next}{n++;id[n]=$1;v[n]=$3;total+=$3}END{for(i=1;i<=n;i++)printf "%s %.2f%%\\n",id[i],100*v[i]/total}', SALES_1, SALES_2)
|
| 97 |
+
|
| 98 |
+
add("passwd_shell", "This is colon-delimited passwd data. Print usernames whose login shell is /bin/bash.", 'BEGIN{FS=":"}$7=="/bin/bash"{print $1}', PASSWD_1, PASSWD_2)
|
| 99 |
+
add("passwd_uid_range", "Using colon separators, print username and UID for accounts with UID at least 1000 and below 1002.", 'BEGIN{FS=":";OFS=":"}$3>=1000&&$3<1002{print $1,$3}', PASSWD_1, PASSWD_2)
|
| 100 |
+
add("passwd_shell_counts", "For colon-delimited passwd records, count users per login shell in order of first appearance.", 'BEGIN{FS=":"}{if(!($7 in counts))order[++n]=$7;counts[$7]++}END{for(i=1;i<=n;i++)print order[i],counts[order[i]]}', PASSWD_1, PASSWD_2)
|
| 101 |
+
|
| 102 |
+
add("keyvalue_errors", "Extract the service value from each record whose level value is error, ignoring level letter case.", '{service="";level="";for(i=1;i<=NF;i++){split($i,parts,"=");if(parts[1]=="service")service=parts[2];if(parts[1]=="level")level=tolower(parts[2])}if(level=="error")print service}', EVENTS_1, EVENTS_2)
|
| 103 |
+
add("keyvalue_latency", "Print timestamps with latency above 20. The timestamp is field 1 and latency is stored as latency=N in the final field.", '{split($NF,parts,"=");if(parts[2]+0>20)print $1}', EVENTS_1, EVENTS_2)
|
| 104 |
+
add("event_window", "Print only events with timestamps from 2026-11-28T09:01:00Z through 2026-11-28T09:02:00Z inclusive.", '$1>="2026-11-28T09:01:00Z"&&$1<="2026-11-28T09:02:00Z"', EVENTS_1, EVENTS_2)
|
| 105 |
+
|
| 106 |
+
add("running_delta", "For each row after the first, print the group name and the change in column 2 from the previous row; for the first row print 0 as the change.", '{delta=$2-previous;if(NR==1)delta=0;print $1,delta;previous=$2}', ROWS_1, ROWS_2)
|
| 107 |
+
add("group_maximum", "For each group in column 1, print its largest value from column 2 in first-appearance order.", '{if(!($1 in max)||$2>max[$1])max[$1]=$2;if(!($1 in seen)){order[++n]=$1;seen[$1]=1}}END{for(i=1;i<=n;i++)print order[i],max[order[i]]}', ROWS_1, ROWS_2)
|
| 108 |
+
add("first_last_group", "Print each group from column 1 with its first and last value from column 2, in first-appearance order.", '{if(!($1 in first)){first[$1]=$2;order[++n]=$1}last[$1]=$2}END{for(i=1;i<=n;i++)print order[i],first[order[i]],last[order[i]]}', ROWS_1, ROWS_2)
|
| 109 |
+
add("positive_ratio", "Print group and the ratio of column 3 to column 2 as a percentage with one decimal; skip zero denominators.", '$2!=0{printf "%s %.1f%%\\n",$1,100*$3/$2}', ROWS_1, ROWS_2)
|
| 110 |
+
add("clamp_values", "Print every row with column 2 clamped to the inclusive range 8 through 18; leave other fields unchanged.", '{if($2<8)$2=8;else if($2>18)$2=18;print}', ROWS_1, ROWS_2)
|
| 111 |
+
add("consecutive_dedup", "Suppress only consecutive duplicate group names in column 1, printing one complete row per run.", '$1!=previous{print}{previous=$1}', ROWS_1, ROWS_2)
|
| 112 |
+
|
| 113 |
+
blank_1 = "alpha 1\n\nbeta 2\n \nalpha 3\n"
|
| 114 |
+
blank_2 = "red 4\n\n\nblue 5\n"
|
| 115 |
+
add("blank_filter", "Remove blank and whitespace-only lines, leaving all other lines unchanged.", '$0 ~ /[^[:space:]]/', blank_1, blank_2)
|
| 116 |
+
add("blank_count", "Count blank or whitespace-only lines and print the count.", '$0 !~ /[^[:space:]]/{n++}END{print n+0}', blank_1, blank_2)
|
| 117 |
+
add("line_numbers", "Prefix each non-empty line with its original line number, a colon, and one space.", '$0 ~ /[^[:space:]]/{print NR ": " $0}', blank_1, blank_2)
|
| 118 |
+
add("character_count", "Print the total number of characters in the input, excluding newline characters.", '{total+=length($0)}END{print total+0}', blank_1, blank_2)
|
| 119 |
+
add("comma_to_tab", "Convert simple comma-separated rows to tab-separated rows, preserving every field in order.", 'BEGIN{FS=",";OFS="\\t"}{$1=$1;print}', "a,1,x\nb,2,y\n", "c,3,z\nd,4,w\n")
|
| 120 |
+
add("fixed_width", "Print column 1 right-aligned in a width of 8, followed by column 2 with no extra separator beyond the padding.", '{printf "%8s%s\\n",$1,$2}', ROWS_1, ROWS_2)
|
| 121 |
+
add("absolute_difference", "For every record, print group and the absolute difference between columns 2 and 3.", '{difference=$2-$3;if(difference<0)difference=-difference;print $1,difference}', ROWS_1, ROWS_2)
|
| 122 |
+
add("sorted_unique_words", "Print each distinct word from column 1 once, sorted in ascending lexical order.", '{seen[$1]=1}END{for(word in seen){value[++n]=word}for(i=2;i<=n;i++){x=value[i];j=i-1;while(j>=1&&value[j]>x){value[j+1]=value[j];j--}value[j+1]=x}for(i=1;i<=n;i++)print value[i]}', ROWS_1, ROWS_2)
|
| 123 |
+
|
| 124 |
+
with output.open("w", encoding="utf-8") as handle:
|
| 125 |
+
for case in cases:
|
| 126 |
+
handle.write(json.dumps(case, ensure_ascii=False, separators=(",", ":")) + "\n")
|
| 127 |
+
print(f"wrote {len(cases)} hand-authored challenge cases to {output}")
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
if __name__ == "__main__":
|
| 131 |
+
main()
|
data/challenge.jsonl
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"id":"awkweave-challenge-0001","request":"Count server-error responses with HTTP status from 500 through 599; print 0 when none occur.","program":"$9 >= 500 && $9 < 600{n++}END{print n+0}","input_text":"192.0.2.10 - - [28/Nov/2026:10:00:00 +0000] \"GET /index.html HTTP/1.1\" 200 512\n192.0.2.11 - - [28/Nov/2026:10:00:01 +0000] \"POST /api/orders HTTP/1.1\" 201 128\n192.0.2.10 - - [28/Nov/2026:10:00:02 +0000] \"GET /missing HTTP/1.1\" 404 64\n192.0.2.12 - - [28/Nov/2026:10:00:03 +0000] \"GET /api/orders HTTP/1.1\" 500 32\n192.0.2.13 - - [28/Nov/2026:10:00:04 +0000] \"GET /index.html HTTP/1.1\" 200 256\n","expected_output":"1\n","validation_input":"198.51.100.20 - - [28/Nov/2026:11:00:00 +0000] \"GET /health HTTP/1.1\" 200 10\n198.51.100.21 - - [28/Nov/2026:11:00:01 +0000] \"GET /api/items HTTP/1.1\" 503 0\n198.51.100.20 - - [28/Nov/2026:11:00:02 +0000] \"POST /api/items HTTP/1.1\" 201 99\n198.51.100.22 - - [28/Nov/2026:11:00:03 +0000] \"GET /health HTTP/1.1\" 200 20\n","validation_output":"1\n","family":"http_5xx_count","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 2 |
+
{"id":"awkweave-challenge-0002","request":"What is the total number of response bytes? Sum the final field and print one integer.","program":"{bytes+=$NF}END{print bytes+0}","input_text":"192.0.2.10 - - [28/Nov/2026:10:00:00 +0000] \"GET /index.html HTTP/1.1\" 200 512\n192.0.2.11 - - [28/Nov/2026:10:00:01 +0000] \"POST /api/orders HTTP/1.1\" 201 128\n192.0.2.10 - - [28/Nov/2026:10:00:02 +0000] \"GET /missing HTTP/1.1\" 404 64\n192.0.2.12 - - [28/Nov/2026:10:00:03 +0000] \"GET /api/orders HTTP/1.1\" 500 32\n192.0.2.13 - - [28/Nov/2026:10:00:04 +0000] \"GET /index.html HTTP/1.1\" 200 256\n","expected_output":"992\n","validation_input":"198.51.100.20 - - [28/Nov/2026:11:00:00 +0000] \"GET /health HTTP/1.1\" 200 10\n198.51.100.21 - - [28/Nov/2026:11:00:01 +0000] \"GET /api/items HTTP/1.1\" 503 0\n198.51.100.20 - - [28/Nov/2026:11:00:02 +0000] \"POST /api/items HTTP/1.1\" 201 99\n198.51.100.22 - - [28/Nov/2026:11:00:03 +0000] \"GET /health HTTP/1.1\" 200 20\n","validation_output":"129\n","family":"http_bytes_sum","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 3 |
+
{"id":"awkweave-challenge-0003","request":"Count distinct client IP addresses, which appear in field 1.","program":"{if(!seen[$1]++)n++}END{print n+0}","input_text":"192.0.2.10 - - [28/Nov/2026:10:00:00 +0000] \"GET /index.html HTTP/1.1\" 200 512\n192.0.2.11 - - [28/Nov/2026:10:00:01 +0000] \"POST /api/orders HTTP/1.1\" 201 128\n192.0.2.10 - - [28/Nov/2026:10:00:02 +0000] \"GET /missing HTTP/1.1\" 404 64\n192.0.2.12 - - [28/Nov/2026:10:00:03 +0000] \"GET /api/orders HTTP/1.1\" 500 32\n192.0.2.13 - - [28/Nov/2026:10:00:04 +0000] \"GET /index.html HTTP/1.1\" 200 256\n","expected_output":"4\n","validation_input":"198.51.100.20 - - [28/Nov/2026:11:00:00 +0000] \"GET /health HTTP/1.1\" 200 10\n198.51.100.21 - - [28/Nov/2026:11:00:01 +0000] \"GET /api/items HTTP/1.1\" 503 0\n198.51.100.20 - - [28/Nov/2026:11:00:02 +0000] \"POST /api/items HTTP/1.1\" 201 99\n198.51.100.22 - - [28/Nov/2026:11:00:03 +0000] \"GET /health HTTP/1.1\" 200 20\n","validation_output":"3\n","family":"http_unique_clients","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 4 |
+
{"id":"awkweave-challenge-0004","request":"Print the request path (field 7) for API routes with a 500 response.","program":"$7 ~ /^\\/api\\// && $9 == 500{print $7}","input_text":"192.0.2.10 - - [28/Nov/2026:10:00:00 +0000] \"GET /index.html HTTP/1.1\" 200 512\n192.0.2.11 - - [28/Nov/2026:10:00:01 +0000] \"POST /api/orders HTTP/1.1\" 201 128\n192.0.2.10 - - [28/Nov/2026:10:00:02 +0000] \"GET /missing HTTP/1.1\" 404 64\n192.0.2.12 - - [28/Nov/2026:10:00:03 +0000] \"GET /api/orders HTTP/1.1\" 500 32\n192.0.2.13 - - [28/Nov/2026:10:00:04 +0000] \"GET /index.html HTTP/1.1\" 200 256\n","expected_output":"/api/orders\n","validation_input":"198.51.100.20 - - [28/Nov/2026:11:00:00 +0000] \"GET /health HTTP/1.1\" 200 10\n198.51.100.21 - - [28/Nov/2026:11:00:01 +0000] \"GET /api/items HTTP/1.1\" 503 0\n198.51.100.20 - - [28/Nov/2026:11:00:02 +0000] \"POST /api/items HTTP/1.1\" 201 99\n198.51.100.22 - - [28/Nov/2026:11:00:03 +0000] \"GET /health HTTP/1.1\" 200 20\n","validation_output":"","family":"http_api_errors","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 5 |
+
{"id":"awkweave-challenge-0005","request":"For responses with status 200 only, print the average number of bytes to two decimal places.","program":"$9==200{bytes+=$10;n++}END{printf \"%.2f\\n\",bytes/n}","input_text":"192.0.2.10 - - [28/Nov/2026:10:00:00 +0000] \"GET /index.html HTTP/1.1\" 200 512\n192.0.2.11 - - [28/Nov/2026:10:00:01 +0000] \"POST /api/orders HTTP/1.1\" 201 128\n192.0.2.10 - - [28/Nov/2026:10:00:02 +0000] \"GET /missing HTTP/1.1\" 404 64\n192.0.2.12 - - [28/Nov/2026:10:00:03 +0000] \"GET /api/orders HTTP/1.1\" 500 32\n192.0.2.13 - - [28/Nov/2026:10:00:04 +0000] \"GET /index.html HTTP/1.1\" 200 256\n","expected_output":"384.00\n","validation_input":"198.51.100.20 - - [28/Nov/2026:11:00:00 +0000] \"GET /health HTTP/1.1\" 200 10\n198.51.100.21 - - [28/Nov/2026:11:00:01 +0000] \"GET /api/items HTTP/1.1\" 503 0\n198.51.100.20 - - [28/Nov/2026:11:00:02 +0000] \"POST /api/items HTTP/1.1\" 201 99\n198.51.100.22 - - [28/Nov/2026:11:00:03 +0000] \"GET /health HTTP/1.1\" 200 20\n","validation_output":"15.00\n","family":"http_success_bytes","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 6 |
+
{"id":"awkweave-challenge-0006","request":"Print complete request records for methods other than GET.","program":"$6 !~ /^\"GET$/{print $0}","input_text":"192.0.2.10 - - [28/Nov/2026:10:00:00 +0000] \"GET /index.html HTTP/1.1\" 200 512\n192.0.2.11 - - [28/Nov/2026:10:00:01 +0000] \"POST /api/orders HTTP/1.1\" 201 128\n192.0.2.10 - - [28/Nov/2026:10:00:02 +0000] \"GET /missing HTTP/1.1\" 404 64\n192.0.2.12 - - [28/Nov/2026:10:00:03 +0000] \"GET /api/orders HTTP/1.1\" 500 32\n192.0.2.13 - - [28/Nov/2026:10:00:04 +0000] \"GET /index.html HTTP/1.1\" 200 256\n","expected_output":"192.0.2.11 - - [28/Nov/2026:10:00:01 +0000] \"POST /api/orders HTTP/1.1\" 201 128\n","validation_input":"198.51.100.20 - - [28/Nov/2026:11:00:00 +0000] \"GET /health HTTP/1.1\" 200 10\n198.51.100.21 - - [28/Nov/2026:11:00:01 +0000] \"GET /api/items HTTP/1.1\" 503 0\n198.51.100.20 - - [28/Nov/2026:11:00:02 +0000] \"POST /api/items HTTP/1.1\" 201 99\n198.51.100.22 - - [28/Nov/2026:11:00:03 +0000] \"GET /health HTTP/1.1\" 200 20\n","validation_output":"198.51.100.20 - - [28/Nov/2026:11:00:02 +0000] \"POST /api/items HTTP/1.1\" 201 99\n","family":"http_non_get","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 7 |
+
{"id":"awkweave-challenge-0007","request":"Count each request path from field 7 and print path then count in first-appearance order.","program":"{if(!($7 in counts))order[++n]=$7;counts[$7]++}END{for(i=1;i<=n;i++)print order[i],counts[order[i]]}","input_text":"192.0.2.10 - - [28/Nov/2026:10:00:00 +0000] \"GET /index.html HTTP/1.1\" 200 512\n192.0.2.11 - - [28/Nov/2026:10:00:01 +0000] \"POST /api/orders HTTP/1.1\" 201 128\n192.0.2.10 - - [28/Nov/2026:10:00:02 +0000] \"GET /missing HTTP/1.1\" 404 64\n192.0.2.12 - - [28/Nov/2026:10:00:03 +0000] \"GET /api/orders HTTP/1.1\" 500 32\n192.0.2.13 - - [28/Nov/2026:10:00:04 +0000] \"GET /index.html HTTP/1.1\" 200 256\n","expected_output":"/index.html 2\n/api/orders 2\n/missing 1\n","validation_input":"198.51.100.20 - - [28/Nov/2026:11:00:00 +0000] \"GET /health HTTP/1.1\" 200 10\n198.51.100.21 - - [28/Nov/2026:11:00:01 +0000] \"GET /api/items HTTP/1.1\" 503 0\n198.51.100.20 - - [28/Nov/2026:11:00:02 +0000] \"POST /api/items HTTP/1.1\" 201 99\n198.51.100.22 - - [28/Nov/2026:11:00:03 +0000] \"GET /health HTTP/1.1\" 200 20\n","validation_output":"/health 2\n/api/items 2\n","family":"http_url_counts","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 8 |
+
{"id":"awkweave-challenge-0008","request":"Use the header to find the region and amount columns. Print total paid amount per region in first-appearance order.","program":"NR==1{for(i=1;i<=NF;i++)h[$i]=i;next}$h[\"status\"]==\"paid\"{key=$h[\"region\"];if(!(key in sums))order[++n]=key;sums[key]+=$h[\"amount\"]}END{for(i=1;i<=n;i++)print order[i],sums[order[i]]}","input_text":"order_id region amount status\nr001 east 12.50 paid\nr002 west 20.00 pending\nr003 east 7.50 paid\nr004 north 10.00 paid\nr005 west 5.00 paid\n","expected_output":"east 20\nnorth 10\nwest 5\n","validation_input":"order_id region amount status\nr101 south 8.00 paid\nr102 east 14.00 paid\nr103 south 6.00 pending\nr104 west 22.00 paid\n","validation_output":"south 8\neast 14\nwest 22\n","family":"header_region_totals","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 9 |
+
{"id":"awkweave-challenge-0009","request":"The first line is a header. Print order_id values for pending orders only.","program":"NR==1{for(i=1;i<=NF;i++)h[$i]=i;next}$h[\"status\"]==\"pending\"{print $h[\"order_id\"]}","input_text":"order_id region amount status\nr001 east 12.50 paid\nr002 west 20.00 pending\nr003 east 7.50 paid\nr004 north 10.00 paid\nr005 west 5.00 paid\n","expected_output":"r002\n","validation_input":"order_id region amount status\nr101 south 8.00 paid\nr102 east 14.00 paid\nr103 south 6.00 pending\nr104 west 22.00 paid\n","validation_output":"r103\n","family":"header_pending_ids","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 10 |
+
{"id":"awkweave-challenge-0010","request":"Read the amount column by its header name and print its mean over all data rows to two decimal places.","program":"NR==1{for(i=1;i<=NF;i++)h[$i]=i;next}{s+=$h[\"amount\"];n++}END{printf \"%.2f\\n\",s/n}","input_text":"order_id region amount status\nr001 east 12.50 paid\nr002 west 20.00 pending\nr003 east 7.50 paid\nr004 north 10.00 paid\nr005 west 5.00 paid\n","expected_output":"11.00\n","validation_input":"order_id region amount status\nr101 south 8.00 paid\nr102 east 14.00 paid\nr103 south 6.00 pending\nr104 west 22.00 paid\n","validation_output":"12.50\n","family":"header_amount_average","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 11 |
+
{"id":"awkweave-challenge-0011","request":"The first row is a header. Print the two complete orders with the largest amounts, highest first. Keep file order for ties.","program":"NR==1{next}{n++;v[n]=$3+0;line[n]=$0}END{for(i=2;i<=n;i++){x=v[i];s=line[i];j=i-1;while(j>=1&&v[j]<x){v[j+1]=v[j];line[j+1]=line[j];j--}v[j+1]=x;line[j+1]=s}for(i=1;i<=2&&i<=n;i++)print line[i]}","input_text":"order_id region amount status\nr001 east 12.50 paid\nr002 west 20.00 pending\nr003 east 7.50 paid\nr004 north 10.00 paid\nr005 west 5.00 paid\n","expected_output":"r002 west 20.00 pending\nr001 east 12.50 paid\n","validation_input":"order_id region amount status\nr101 south 8.00 paid\nr102 east 14.00 paid\nr103 south 6.00 pending\nr104 west 22.00 paid\n","validation_output":"r104 west 22.00 paid\nr102 east 14.00 paid\n","family":"top_two_amounts","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 12 |
+
{"id":"awkweave-challenge-0012","request":"The first row is a header. Print each region and its average order amount to two decimals, grouping in first-appearance order and including every status.","program":"NR==1{next}{if(!($2 in sums))order[++n]=$2;sums[$2]+=$3;counts[$2]++}END{for(i=1;i<=n;i++)printf \"%s %.2f\\n\",order[i],sums[order[i]]/counts[order[i]]}","input_text":"order_id region amount status\nr001 east 12.50 paid\nr002 west 20.00 pending\nr003 east 7.50 paid\nr004 north 10.00 paid\nr005 west 5.00 paid\n","expected_output":"east 10.00\nwest 12.50\nnorth 10.00\n","validation_input":"order_id region amount status\nr101 south 8.00 paid\nr102 east 14.00 paid\nr103 south 6.00 pending\nr104 west 22.00 paid\n","validation_output":"south 7.00\neast 14.00\nwest 22.00\n","family":"region_average","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 13 |
+
{"id":"awkweave-challenge-0013","request":"The first row is a header. For every order, print order_id and its amount as a percentage of the grand total, with two decimals and a percent sign.","program":"NR==1{next}{n++;id[n]=$1;v[n]=$3;total+=$3}END{for(i=1;i<=n;i++)printf \"%s %.2f%%\\n\",id[i],100*v[i]/total}","input_text":"order_id region amount status\nr001 east 12.50 paid\nr002 west 20.00 pending\nr003 east 7.50 paid\nr004 north 10.00 paid\nr005 west 5.00 paid\n","expected_output":"r001 22.73%\nr002 36.36%\nr003 13.64%\nr004 18.18%\nr005 9.09%\n","validation_input":"order_id region amount status\nr101 south 8.00 paid\nr102 east 14.00 paid\nr103 south 6.00 pending\nr104 west 22.00 paid\n","validation_output":"r101 16.00%\nr102 28.00%\nr103 12.00%\nr104 44.00%\n","family":"amount_percentage","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 14 |
+
{"id":"awkweave-challenge-0014","request":"This is colon-delimited passwd data. Print usernames whose login shell is /bin/bash.","program":"BEGIN{FS=\":\"}$7==\"/bin/bash\"{print $1}","input_text":"root:x:0:0:root:/root:/bin/bash\ndaemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\nalice:x:1000:1000:Alice:/home/alice:/bin/bash\nbruno:x:1001:1001:Bruno:/home/bruno:/bin/zsh\nchen:x:1002:1002:Chen:/home/chen:/bin/bash\n","expected_output":"root\nalice\nchen\n","validation_input":"root:x:0:0:root:/root:/bin/bash\ndina:x:1000:1000:Dina:/home/dina:/bin/sh\neli:x:1001:1001:Eli:/home/eli:/bin/bash\n","validation_output":"root\neli\n","family":"passwd_shell","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 15 |
+
{"id":"awkweave-challenge-0015","request":"Using colon separators, print username and UID for accounts with UID at least 1000 and below 1002.","program":"BEGIN{FS=\":\";OFS=\":\"}$3>=1000&&$3<1002{print $1,$3}","input_text":"root:x:0:0:root:/root:/bin/bash\ndaemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\nalice:x:1000:1000:Alice:/home/alice:/bin/bash\nbruno:x:1001:1001:Bruno:/home/bruno:/bin/zsh\nchen:x:1002:1002:Chen:/home/chen:/bin/bash\n","expected_output":"alice:1000\nbruno:1001\n","validation_input":"root:x:0:0:root:/root:/bin/bash\ndina:x:1000:1000:Dina:/home/dina:/bin/sh\neli:x:1001:1001:Eli:/home/eli:/bin/bash\n","validation_output":"dina:1000\neli:1001\n","family":"passwd_uid_range","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 16 |
+
{"id":"awkweave-challenge-0016","request":"For colon-delimited passwd records, count users per login shell in order of first appearance.","program":"BEGIN{FS=\":\"}{if(!($7 in counts))order[++n]=$7;counts[$7]++}END{for(i=1;i<=n;i++)print order[i],counts[order[i]]}","input_text":"root:x:0:0:root:/root:/bin/bash\ndaemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\nalice:x:1000:1000:Alice:/home/alice:/bin/bash\nbruno:x:1001:1001:Bruno:/home/bruno:/bin/zsh\nchen:x:1002:1002:Chen:/home/chen:/bin/bash\n","expected_output":"/bin/bash 3\n/usr/sbin/nologin 1\n/bin/zsh 1\n","validation_input":"root:x:0:0:root:/root:/bin/bash\ndina:x:1000:1000:Dina:/home/dina:/bin/sh\neli:x:1001:1001:Eli:/home/eli:/bin/bash\n","validation_output":"/bin/bash 2\n/bin/sh 1\n","family":"passwd_shell_counts","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 17 |
+
{"id":"awkweave-challenge-0017","request":"Extract the service value from each record whose level value is error, ignoring level letter case.","program":"{service=\"\";level=\"\";for(i=1;i<=NF;i++){split($i,parts,\"=\");if(parts[1]==\"service\")service=parts[2];if(parts[1]==\"level\")level=tolower(parts[2])}if(level==\"error\")print service}","input_text":"2026-11-28T09:00:00Z level=info service=web latency=12\n2026-11-28T09:01:00Z level=error service=db latency=40\n2026-11-28T09:02:00Z level=INFO service=web latency=18\n2026-11-28T09:03:00Z level=warn service=db latency=25\n","expected_output":"db\n","validation_input":"2026-11-28T12:00:00Z level=error service=api latency=33\n2026-11-28T12:01:00Z level=info service=api latency=9\n2026-11-28T12:02:00Z level=ERROR service=worker latency=51\n","validation_output":"api\nworker\n","family":"keyvalue_errors","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 18 |
+
{"id":"awkweave-challenge-0018","request":"Print timestamps with latency above 20. The timestamp is field 1 and latency is stored as latency=N in the final field.","program":"{split($NF,parts,\"=\");if(parts[2]+0>20)print $1}","input_text":"2026-11-28T09:00:00Z level=info service=web latency=12\n2026-11-28T09:01:00Z level=error service=db latency=40\n2026-11-28T09:02:00Z level=INFO service=web latency=18\n2026-11-28T09:03:00Z level=warn service=db latency=25\n","expected_output":"2026-11-28T09:01:00Z\n2026-11-28T09:03:00Z\n","validation_input":"2026-11-28T12:00:00Z level=error service=api latency=33\n2026-11-28T12:01:00Z level=info service=api latency=9\n2026-11-28T12:02:00Z level=ERROR service=worker latency=51\n","validation_output":"2026-11-28T12:00:00Z\n2026-11-28T12:02:00Z\n","family":"keyvalue_latency","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 19 |
+
{"id":"awkweave-challenge-0019","request":"Print only events with timestamps from 2026-11-28T09:01:00Z through 2026-11-28T09:02:00Z inclusive.","program":"$1>=\"2026-11-28T09:01:00Z\"&&$1<=\"2026-11-28T09:02:00Z\"","input_text":"2026-11-28T09:00:00Z level=info service=web latency=12\n2026-11-28T09:01:00Z level=error service=db latency=40\n2026-11-28T09:02:00Z level=INFO service=web latency=18\n2026-11-28T09:03:00Z level=warn service=db latency=25\n","expected_output":"2026-11-28T09:01:00Z level=error service=db latency=40\n2026-11-28T09:02:00Z level=INFO service=web latency=18\n","validation_input":"2026-11-28T12:00:00Z level=error service=api latency=33\n2026-11-28T12:01:00Z level=info service=api latency=9\n2026-11-28T12:02:00Z level=ERROR service=worker latency=51\n","validation_output":"","family":"event_window","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 20 |
+
{"id":"awkweave-challenge-0020","request":"For each row after the first, print the group name and the change in column 2 from the previous row; for the first row print 0 as the change.","program":"{delta=$2-previous;if(NR==1)delta=0;print $1,delta;previous=$2}","input_text":"alpha 10 4\nbeta 20 0\nalpha 30 8\ngamma 5 2\nbeta 15 3\n","expected_output":"alpha 0\nbeta 10\nalpha 10\ngamma -25\nbeta 10\n","validation_input":"red 8 2\nred 12 4\nblue 7 0\ngreen 20 5\nblue 9 3\n","validation_output":"red 0\nred 4\nblue -5\ngreen 13\nblue -11\n","family":"running_delta","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 21 |
+
{"id":"awkweave-challenge-0021","request":"For each group in column 1, print its largest value from column 2 in first-appearance order.","program":"{if(!($1 in max)||$2>max[$1])max[$1]=$2;if(!($1 in seen)){order[++n]=$1;seen[$1]=1}}END{for(i=1;i<=n;i++)print order[i],max[order[i]]}","input_text":"alpha 10 4\nbeta 20 0\nalpha 30 8\ngamma 5 2\nbeta 15 3\n","expected_output":"alpha 30\nbeta 20\ngamma 5\n","validation_input":"red 8 2\nred 12 4\nblue 7 0\ngreen 20 5\nblue 9 3\n","validation_output":"red 12\nblue 9\ngreen 20\n","family":"group_maximum","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 22 |
+
{"id":"awkweave-challenge-0022","request":"Print each group from column 1 with its first and last value from column 2, in first-appearance order.","program":"{if(!($1 in first)){first[$1]=$2;order[++n]=$1}last[$1]=$2}END{for(i=1;i<=n;i++)print order[i],first[order[i]],last[order[i]]}","input_text":"alpha 10 4\nbeta 20 0\nalpha 30 8\ngamma 5 2\nbeta 15 3\n","expected_output":"alpha 10 30\nbeta 20 15\ngamma 5 5\n","validation_input":"red 8 2\nred 12 4\nblue 7 0\ngreen 20 5\nblue 9 3\n","validation_output":"red 8 12\nblue 7 9\ngreen 20 20\n","family":"first_last_group","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 23 |
+
{"id":"awkweave-challenge-0023","request":"Print group and the ratio of column 3 to column 2 as a percentage with one decimal; skip zero denominators.","program":"$2!=0{printf \"%s %.1f%%\\n\",$1,100*$3/$2}","input_text":"alpha 10 4\nbeta 20 0\nalpha 30 8\ngamma 5 2\nbeta 15 3\n","expected_output":"alpha 40.0%\nbeta 0.0%\nalpha 26.7%\ngamma 40.0%\nbeta 20.0%\n","validation_input":"red 8 2\nred 12 4\nblue 7 0\ngreen 20 5\nblue 9 3\n","validation_output":"red 25.0%\nred 33.3%\nblue 0.0%\ngreen 25.0%\nblue 33.3%\n","family":"positive_ratio","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 24 |
+
{"id":"awkweave-challenge-0024","request":"Print every row with column 2 clamped to the inclusive range 8 through 18; leave other fields unchanged.","program":"{if($2<8)$2=8;else if($2>18)$2=18;print}","input_text":"alpha 10 4\nbeta 20 0\nalpha 30 8\ngamma 5 2\nbeta 15 3\n","expected_output":"alpha 10 4\nbeta 18 0\nalpha 18 8\ngamma 8 2\nbeta 15 3\n","validation_input":"red 8 2\nred 12 4\nblue 7 0\ngreen 20 5\nblue 9 3\n","validation_output":"red 8 2\nred 12 4\nblue 8 0\ngreen 18 5\nblue 9 3\n","family":"clamp_values","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 25 |
+
{"id":"awkweave-challenge-0025","request":"Suppress only consecutive duplicate group names in column 1, printing one complete row per run.","program":"$1!=previous{print}{previous=$1}","input_text":"alpha 10 4\nbeta 20 0\nalpha 30 8\ngamma 5 2\nbeta 15 3\n","expected_output":"alpha 10 4\nbeta 20 0\nalpha 30 8\ngamma 5 2\nbeta 15 3\n","validation_input":"red 8 2\nred 12 4\nblue 7 0\ngreen 20 5\nblue 9 3\n","validation_output":"red 8 2\nblue 7 0\ngreen 20 5\nblue 9 3\n","family":"consecutive_dedup","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 26 |
+
{"id":"awkweave-challenge-0026","request":"Remove blank and whitespace-only lines, leaving all other lines unchanged.","program":"$0 ~ /[^[:space:]]/","input_text":"alpha 1\n\nbeta 2\n \nalpha 3\n","expected_output":"alpha 1\nbeta 2\nalpha 3\n","validation_input":"red 4\n\n\nblue 5\n","validation_output":"red 4\nblue 5\n","family":"blank_filter","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 27 |
+
{"id":"awkweave-challenge-0027","request":"Count blank or whitespace-only lines and print the count.","program":"$0 !~ /[^[:space:]]/{n++}END{print n+0}","input_text":"alpha 1\n\nbeta 2\n \nalpha 3\n","expected_output":"2\n","validation_input":"red 4\n\n\nblue 5\n","validation_output":"2\n","family":"blank_count","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 28 |
+
{"id":"awkweave-challenge-0028","request":"Prefix each non-empty line with its original line number, a colon, and one space.","program":"$0 ~ /[^[:space:]]/{print NR \": \" $0}","input_text":"alpha 1\n\nbeta 2\n \nalpha 3\n","expected_output":"1: alpha 1\n3: beta 2\n5: alpha 3\n","validation_input":"red 4\n\n\nblue 5\n","validation_output":"1: red 4\n4: blue 5\n","family":"line_numbers","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 29 |
+
{"id":"awkweave-challenge-0029","request":"Print the total number of characters in the input, excluding newline characters.","program":"{total+=length($0)}END{print total+0}","input_text":"alpha 1\n\nbeta 2\n \nalpha 3\n","expected_output":"23\n","validation_input":"red 4\n\n\nblue 5\n","validation_output":"11\n","family":"character_count","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 30 |
+
{"id":"awkweave-challenge-0030","request":"Convert simple comma-separated rows to tab-separated rows, preserving every field in order.","program":"BEGIN{FS=\",\";OFS=\"\\t\"}{$1=$1;print}","input_text":"a,1,x\nb,2,y\n","expected_output":"a\t1\tx\nb\t2\ty\n","validation_input":"c,3,z\nd,4,w\n","validation_output":"c\t3\tz\nd\t4\tw\n","family":"comma_to_tab","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 31 |
+
{"id":"awkweave-challenge-0031","request":"Print column 1 right-aligned in a width of 8, followed by column 2 with no extra separator beyond the padding.","program":"{printf \"%8s%s\\n\",$1,$2}","input_text":"alpha 10 4\nbeta 20 0\nalpha 30 8\ngamma 5 2\nbeta 15 3\n","expected_output":" alpha10\n beta20\n alpha30\n gamma5\n beta15\n","validation_input":"red 8 2\nred 12 4\nblue 7 0\ngreen 20 5\nblue 9 3\n","validation_output":" red8\n red12\n blue7\n green20\n blue9\n","family":"fixed_width","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 32 |
+
{"id":"awkweave-challenge-0032","request":"For every record, print group and the absolute difference between columns 2 and 3.","program":"{difference=$2-$3;if(difference<0)difference=-difference;print $1,difference}","input_text":"alpha 10 4\nbeta 20 0\nalpha 30 8\ngamma 5 2\nbeta 15 3\n","expected_output":"alpha 6\nbeta 20\nalpha 22\ngamma 3\nbeta 12\n","validation_input":"red 8 2\nred 12 4\nblue 7 0\ngreen 20 5\nblue 9 3\n","validation_output":"red 6\nred 8\nblue 7\ngreen 15\nblue 6\n","family":"absolute_difference","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
| 33 |
+
{"id":"awkweave-challenge-0033","request":"Print each distinct word from column 1 once, sorted in ascending lexical order.","program":"{seen[$1]=1}END{for(word in seen){value[++n]=word}for(i=2;i<=n;i++){x=value[i];j=i-1;while(j>=1&&value[j]>x){value[j+1]=value[j];j--}value[j+1]=x}for(i=1;i<=n;i++)print value[i]}","input_text":"alpha 10 4\nbeta 20 0\nalpha 30 8\ngamma 5 2\nbeta 15 3\n","expected_output":"alpha\nbeta\ngamma\n","validation_input":"red 8 2\nred 12 4\nblue 7 0\ngreen 20 5\nblue 9 3\n","validation_output":"blue\ngreen\nred\n","family":"sorted_unique_words","difficulty":3,"split":"challenge","source":"original-hand-authored","license":"CC-BY-4.0"}
|
data/test.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/train.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:01271f03ccb8c53a2f38ef3a1a1cbacf92c39f5b6f66ce3848b674b0e2c9b5f0
|
| 3 |
+
size 84915825
|
data/validation.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
finalize_dataset.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import json
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def main() -> None:
|
| 9 |
+
parser = argparse.ArgumentParser()
|
| 10 |
+
parser.add_argument("paraphrased", type=Path)
|
| 11 |
+
parser.add_argument("challenge", type=Path)
|
| 12 |
+
parser.add_argument("output", type=Path)
|
| 13 |
+
parser.add_argument("--audit", type=Path, help="Optional paraphrase audit JSONL; disputed paraphrases are excluded.")
|
| 14 |
+
args = parser.parse_args()
|
| 15 |
+
paraphrased = [json.loads(line) for line in args.paraphrased.open(encoding="utf-8")]
|
| 16 |
+
challenge = [json.loads(line) for line in args.challenge.open(encoding="utf-8")]
|
| 17 |
+
if any(row["split"] == "challenge" for row in paraphrased):
|
| 18 |
+
raise ValueError("Challenge rows found in the paraphrased input")
|
| 19 |
+
if not challenge or any(row["split"] != "challenge" for row in challenge):
|
| 20 |
+
raise ValueError("Unexpected challenge split")
|
| 21 |
+
excluded = set()
|
| 22 |
+
if args.audit:
|
| 23 |
+
for line in args.audit.open(encoding="utf-8"):
|
| 24 |
+
row = json.loads(line)
|
| 25 |
+
if not row["equivalent"]:
|
| 26 |
+
excluded.add(row["id"])
|
| 27 |
+
before = len(paraphrased)
|
| 28 |
+
paraphrased = [row for row in paraphrased if row["id"] not in excluded]
|
| 29 |
+
print(f"Excluded {before - len(paraphrased)} disputed paraphrases")
|
| 30 |
+
rows = paraphrased + challenge
|
| 31 |
+
ids = [row["id"] for row in rows]
|
| 32 |
+
if len(ids) != len(set(ids)):
|
| 33 |
+
raise ValueError("Duplicate row IDs")
|
| 34 |
+
rows.sort(key=lambda row: row["id"])
|
| 35 |
+
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 36 |
+
temporary = args.output.with_suffix(args.output.suffix + ".tmp")
|
| 37 |
+
with temporary.open("w", encoding="utf-8") as handle:
|
| 38 |
+
for row in rows:
|
| 39 |
+
handle.write(json.dumps(row, ensure_ascii=False, separators=(",", ":")) + "\n")
|
| 40 |
+
temporary.replace(args.output)
|
| 41 |
+
print(f"Wrote {len(rows)} frozen rows to {args.output}")
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
if __name__ == "__main__":
|
| 45 |
+
main()
|
generate_data.py
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import concurrent.futures
|
| 5 |
+
import json
|
| 6 |
+
import random
|
| 7 |
+
import re
|
| 8 |
+
from dataclasses import dataclass
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
from awkweave.execution import run_awk
|
| 12 |
+
|
| 13 |
+
NAMES = ["alice", "bruno", "chen", "dina", "eli", "farah", "gus", "hana", "ivan", "jules", "kim", "lina"]
|
| 14 |
+
WORDS = ["amber", "birch", "cobalt", "delta", "ember", "fable", "grove", "harbor", "indigo", "juniper"]
|
| 15 |
+
STATUSES = ["active", "pending", "closed", "ready", "paused", "failed"]
|
| 16 |
+
CATEGORIES = ["alpha", "beta", "gamma", "delta"]
|
| 17 |
+
LEVELS = ["INFO", "WARN", "ERROR", "DEBUG"]
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
@dataclass
|
| 21 |
+
class Case:
|
| 22 |
+
request: str
|
| 23 |
+
program: str
|
| 24 |
+
inputs: list[str]
|
| 25 |
+
family: str
|
| 26 |
+
difficulty: int
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def rows(rng: random.Random, kinds: list[str], count: int | None = None) -> list[list[str]]:
|
| 30 |
+
result = []
|
| 31 |
+
for row_index in range(count or rng.randint(6, 10)):
|
| 32 |
+
row = []
|
| 33 |
+
for column_index, kind in enumerate(kinds):
|
| 34 |
+
if kind == "name":
|
| 35 |
+
value = rng.choice(NAMES)
|
| 36 |
+
elif kind == "word":
|
| 37 |
+
value = rng.choice(WORDS)
|
| 38 |
+
elif kind == "status":
|
| 39 |
+
value = rng.choice(STATUSES)
|
| 40 |
+
elif kind == "category":
|
| 41 |
+
value = rng.choice(CATEGORIES)
|
| 42 |
+
elif kind == "level":
|
| 43 |
+
value = rng.choice(LEVELS)
|
| 44 |
+
elif kind == "int":
|
| 45 |
+
value = str(rng.randint(0, 120))
|
| 46 |
+
elif kind == "smallint":
|
| 47 |
+
value = str(rng.randint(1, 30))
|
| 48 |
+
elif kind == "float":
|
| 49 |
+
value = f"{rng.uniform(0.5, 99.5):.2f}"
|
| 50 |
+
elif kind == "underscore":
|
| 51 |
+
value = f"{rng.choice(WORDS)}_{rng.choice(WORDS)}"
|
| 52 |
+
elif kind == "id":
|
| 53 |
+
value = f"r{row_index + 1:03d}"
|
| 54 |
+
else:
|
| 55 |
+
raise ValueError(kind)
|
| 56 |
+
row.append(value)
|
| 57 |
+
result.append(row)
|
| 58 |
+
return result
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def render(rows_: list[list[str]], separator: str = " ", header: list[str] | None = None) -> str:
|
| 62 |
+
all_rows = ([header] if header else []) + rows_
|
| 63 |
+
return "\n".join(separator.join(row) for row in all_rows) + "\n"
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def pair(rng: random.Random, kinds: list[str], separator: str = " ", header: list[str] | None = None) -> list[str]:
|
| 67 |
+
return [render(rows(rng, kinds), separator, header), render(rows(rng, kinds), separator, header)]
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def ordinal(number: int) -> str:
|
| 71 |
+
suffix = "th" if 10 <= number % 100 <= 20 else {1: "st", 2: "nd", 3: "rd"}.get(number % 10, "th")
|
| 72 |
+
return f"{number}{suffix}"
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def make_case(family: str, seed: int) -> Case:
|
| 76 |
+
rng = random.Random(seed)
|
| 77 |
+
if family == "project_fields":
|
| 78 |
+
kinds = [rng.choice(["name", "word", "int", "status"]) for _ in range(rng.randint(4, 6))]
|
| 79 |
+
first, second = sorted(rng.sample(range(1, len(kinds) + 1), 2))
|
| 80 |
+
request = rng.choice([
|
| 81 |
+
f"Print column {second} followed by column {first} for every record.",
|
| 82 |
+
f"For each line, output fields {second} and {first}, in that order.",
|
| 83 |
+
f"Select the {ordinal(second)} and {ordinal(first)} fields in that order.",
|
| 84 |
+
])
|
| 85 |
+
return Case(request, f"{{print ${second}, ${first}}}", pair(rng, kinds), family, 1)
|
| 86 |
+
if family == "last_field":
|
| 87 |
+
kinds = [rng.choice(["name", "word", "int", "status"]) for _ in range(rng.randint(3, 7))]
|
| 88 |
+
return Case("Print the last field of every input line.", "{print $NF}", pair(rng, kinds), family, 1)
|
| 89 |
+
if family == "numeric_filter":
|
| 90 |
+
kinds = [rng.choice(["name", "word", "status"]) for _ in range(rng.randint(2, 4))]
|
| 91 |
+
position = rng.randrange(len(kinds))
|
| 92 |
+
kinds.insert(position, "int")
|
| 93 |
+
column = position + 1
|
| 94 |
+
threshold = rng.randint(20, 80)
|
| 95 |
+
operator = rng.choice([">", ">=", "<", "<="])
|
| 96 |
+
phrase = {">": "greater than", ">=": "at least", "<": "less than", "<=": "at most"}[operator]
|
| 97 |
+
request = f"Print the complete records where column {column} is {phrase} {threshold}."
|
| 98 |
+
return Case(request, f"${column} {operator} {threshold}", pair(rng, kinds), family, 1)
|
| 99 |
+
if family == "numeric_range":
|
| 100 |
+
kinds = [rng.choice(["name", "word", "status"]) for _ in range(3)]
|
| 101 |
+
position = rng.randrange(3)
|
| 102 |
+
kinds.insert(position, "smallint")
|
| 103 |
+
column = position + 1
|
| 104 |
+
low = rng.randint(3, 12)
|
| 105 |
+
high = rng.randint(18, 29)
|
| 106 |
+
request = f"Show whole lines whose {ordinal(column)} field is between {low} and {high}, inclusive."
|
| 107 |
+
return Case(request, f"${column} >= {low} && ${column} <= {high}", pair(rng, kinds), family, 1)
|
| 108 |
+
if family == "string_filter":
|
| 109 |
+
kinds = ["name", "status", "word", "int"]
|
| 110 |
+
rng.shuffle(kinds)
|
| 111 |
+
status_column = kinds.index("status") + 1
|
| 112 |
+
id_column = kinds.index("name") + 1
|
| 113 |
+
value = rng.choice(STATUSES)
|
| 114 |
+
request = f"Print column {id_column} only for rows where column {status_column} is exactly {value}."
|
| 115 |
+
program = f'${status_column} == "{value}"{{print ${id_column}}}'
|
| 116 |
+
return Case(request, program, pair(rng, kinds), family, 1)
|
| 117 |
+
if family == "regex_filter":
|
| 118 |
+
kinds = ["level", "word", "int"]
|
| 119 |
+
rng.shuffle(kinds)
|
| 120 |
+
column = kinds.index("level") + 1
|
| 121 |
+
level = rng.choice(["INFO", "WARN", "ERROR"])
|
| 122 |
+
request = f"Print all fields from lines where field {column} begins with {level}."
|
| 123 |
+
return Case(request, f'${column} ~ /^{level}/', pair(rng, kinds), family, 1)
|
| 124 |
+
if family == "exclude_regex":
|
| 125 |
+
kinds = ["word", "int", "status"]
|
| 126 |
+
excluded = rng.choice(WORDS)
|
| 127 |
+
inputs = pair(rng, kinds)
|
| 128 |
+
inputs = [text + f"{excluded} 999 active\n" for text in inputs]
|
| 129 |
+
request = f"Print every line except those containing the exact text {excluded}."
|
| 130 |
+
return Case(request, f'$0 !~ /{excluded}/', inputs, family, 1)
|
| 131 |
+
if family == "line_range":
|
| 132 |
+
inputs = pair(rng, ["name", "word", "int"])
|
| 133 |
+
start = rng.randint(2, 4)
|
| 134 |
+
end = start + rng.randint(1, 3)
|
| 135 |
+
request = f"Print lines {start} through {end}, including both endpoints."
|
| 136 |
+
return Case(request, f"NR >= {start} && NR <= {end}", inputs, family, 1)
|
| 137 |
+
if family == "first_n":
|
| 138 |
+
count = rng.randint(2, 5)
|
| 139 |
+
return Case(f"Output only the first {count} records.", f"NR <= {count}", pair(rng, ["name", "int", "word"]), family, 1)
|
| 140 |
+
if family == "skip_header":
|
| 141 |
+
return Case("Skip the first line and print every remaining line unchanged.", "NR > 1", pair(rng, ["name", "int", "word"]), family, 1)
|
| 142 |
+
if family == "count_matches":
|
| 143 |
+
kinds = ["name", "status", "int"]
|
| 144 |
+
value = rng.choice(STATUSES)
|
| 145 |
+
request = f"Count how many records have {value} in column 2. Print 0 if there are none."
|
| 146 |
+
program = f'$2 == "{value}"{{n++}}END{{print n+0}}'
|
| 147 |
+
return Case(request, program, pair(rng, kinds), family, 1)
|
| 148 |
+
if family == "sum_field":
|
| 149 |
+
kinds = ["name", "smallint", "word"]
|
| 150 |
+
rng.shuffle(kinds)
|
| 151 |
+
column = kinds.index("smallint") + 1
|
| 152 |
+
request = f"Calculate and print the sum of the integers in column {column}."
|
| 153 |
+
return Case(request, f"{{s+=${column}}}END{{print s+0}}", pair(rng, kinds), family, 1)
|
| 154 |
+
if family == "average_field":
|
| 155 |
+
kinds = ["name", "smallint", "word"]
|
| 156 |
+
rng.shuffle(kinds)
|
| 157 |
+
column = kinds.index("smallint") + 1
|
| 158 |
+
request = f"Print the arithmetic mean of column {column}, rounded to exactly two decimal places."
|
| 159 |
+
program = f'{{s+=${column};n++}}END{{printf "%.2f\\n",s/n}}'
|
| 160 |
+
return Case(request, program, pair(rng, kinds), family, 2)
|
| 161 |
+
if family in {"min_field", "max_field"}:
|
| 162 |
+
kinds = ["name", "smallint", "word"]
|
| 163 |
+
rng.shuffle(kinds)
|
| 164 |
+
column = kinds.index("smallint") + 1
|
| 165 |
+
is_min = family == "min_field"
|
| 166 |
+
request = f"Find and print the {'smallest' if is_min else 'largest'} numeric value in column {column}."
|
| 167 |
+
comparison = "<" if is_min else ">"
|
| 168 |
+
program = f"NR==1||${column}{comparison}extreme{{extreme=${column}}}END{{print extreme}}"
|
| 169 |
+
return Case(request, program, pair(rng, kinds), family, 1)
|
| 170 |
+
if family == "count_records":
|
| 171 |
+
return Case("Count all input records and print the total.", "END{print NR}", pair(rng, ["name", "int"]), family, 1)
|
| 172 |
+
if family == "dedup_lines":
|
| 173 |
+
inputs = pair(rng, ["name", "word", "int"])
|
| 174 |
+
enriched = []
|
| 175 |
+
for text in inputs:
|
| 176 |
+
lines = text.splitlines()
|
| 177 |
+
lines.insert(rng.randrange(len(lines)), rng.choice(lines))
|
| 178 |
+
enriched.append("\n".join(lines) + "\n")
|
| 179 |
+
return Case("Remove exact duplicate lines, preserving the first occurrence and original order.", "!seen[$0]++", enriched, family, 2)
|
| 180 |
+
if family == "dedup_field":
|
| 181 |
+
kinds = ["name", "word", "int"]
|
| 182 |
+
column = rng.randint(1, 3)
|
| 183 |
+
request = f"Keep only the first line for each distinct value in column {column}; preserve input order."
|
| 184 |
+
return Case(request, f"!seen[${column}]++", pair(rng, kinds), family, 2)
|
| 185 |
+
if family == "running_total":
|
| 186 |
+
kinds = ["name", "smallint", "word"]
|
| 187 |
+
request = "For each record, print column 1 and the running sum of column 2, separated by a space."
|
| 188 |
+
return Case(request, "{s+=$2;print $1,s}", pair(rng, kinds), family, 2)
|
| 189 |
+
if family == "computed_field":
|
| 190 |
+
kinds = ["name", "smallint", "smallint", "word"]
|
| 191 |
+
request = "For every row, print field 1 followed by the sum of fields 2 and 3."
|
| 192 |
+
return Case(request, "{print $1,$2+$3}", pair(rng, kinds), family, 1)
|
| 193 |
+
if family == "conditional_label":
|
| 194 |
+
threshold = rng.randint(20, 27)
|
| 195 |
+
kinds = ["name", "smallint"]
|
| 196 |
+
request = f"Print column 1 and pass when column 2 is at least {threshold}; otherwise print fail."
|
| 197 |
+
program = f'{{print $1,($2>={threshold}?"pass":"fail")}}'
|
| 198 |
+
return Case(request, program, pair(rng, kinds), family, 2)
|
| 199 |
+
if family == "uppercase":
|
| 200 |
+
column = rng.choice([1, 2])
|
| 201 |
+
request = f"Convert column {column} to uppercase and print only that column."
|
| 202 |
+
return Case(request, f"{{print toupper(${column})}}", pair(rng, ["name", "word", "int"]), family, 1)
|
| 203 |
+
if family == "substring":
|
| 204 |
+
start = rng.randint(1, 3)
|
| 205 |
+
length = rng.randint(2, 4)
|
| 206 |
+
request = f"From column 1, print {length} characters starting at character {start}."
|
| 207 |
+
return Case(request, f"{{print substr($1,{start},{length})}}", pair(rng, ["word", "int"]), family, 1)
|
| 208 |
+
if family == "replace_underscores":
|
| 209 |
+
request = "Replace every underscore in column 1 with a space and print the resulting values."
|
| 210 |
+
return Case(request, '{gsub(/_/," ",$1);print $1}', pair(rng, ["underscore", "int"]), family, 1)
|
| 211 |
+
if family == "reverse_fields":
|
| 212 |
+
program = '{for(i=NF;i>=1;i--)printf "%s%s",$i,(i>1?OFS:ORS)}'
|
| 213 |
+
return Case("Reverse the order of fields on every line and print all fields.", program, pair(rng, ["name", "word", "int", "status"]), family, 2)
|
| 214 |
+
if family == "field_count":
|
| 215 |
+
return Case("Print the number of whitespace-separated fields on each line.", "{print NF}", pair(rng, ["name", "word", "int", "status"]), family, 1)
|
| 216 |
+
if family == "count_by_key":
|
| 217 |
+
program = "{if(!($2 in counts))order[++n]=$2;counts[$2]++}END{for(i=1;i<=n;i++)print order[i],counts[order[i]]}"
|
| 218 |
+
request = "Count records for each value in column 2. Print each value and its count in order of first appearance."
|
| 219 |
+
return Case(request, program, pair(rng, ["name", "category", "int"]), family, 2)
|
| 220 |
+
if family == "sum_by_key":
|
| 221 |
+
program = "{if(!($2 in sums))order[++n]=$2;sums[$2]+=$3}END{for(i=1;i<=n;i++)print order[i],sums[order[i]]}"
|
| 222 |
+
request = "Sum column 3 for each category in column 2, printing groups in order of first appearance."
|
| 223 |
+
return Case(request, program, pair(rng, ["name", "category", "smallint"]), family, 2)
|
| 224 |
+
if family == "duplicates_only":
|
| 225 |
+
program = "{if(!($1 in counts))order[++n]=$1;counts[$1]++}END{for(i=1;i<=n;i++)if(counts[order[i]]>1)print order[i],counts[order[i]]}"
|
| 226 |
+
request = "Print each repeated value from column 1 with its number of occurrences, in first-appearance order."
|
| 227 |
+
return Case(request, program, pair(rng, ["category", "word", "int"]), family, 2)
|
| 228 |
+
if family == "header_projection":
|
| 229 |
+
headers = rng.sample(["record_id", "display_name", "score", "state", "region", "note"], 4)
|
| 230 |
+
kinds = ["id", "name", "smallint", "status"]
|
| 231 |
+
wanted = rng.randrange(1, 4)
|
| 232 |
+
request = f"The first row is a header. Print the {headers[wanted]} column for every data row."
|
| 233 |
+
program = f'NR==1{{for(i=1;i<=NF;i++)h[$i]=i;next}}{{print $h["{headers[wanted]}"]}}'
|
| 234 |
+
return Case(request, program, pair(rng, kinds, header=headers), family, 2)
|
| 235 |
+
if family == "header_filter":
|
| 236 |
+
headers = ["record_id", "display_name", "score", "state"]
|
| 237 |
+
kinds = ["id", "name", "smallint", "status"]
|
| 238 |
+
threshold = rng.randint(8, 24)
|
| 239 |
+
request = f"The first row is a header. Print display_name for data rows whose score is greater than {threshold}."
|
| 240 |
+
program = f'NR==1{{for(i=1;i<=NF;i++)h[$i]=i;next}}$h["score"]>{threshold}{{print $h["display_name"]}}'
|
| 241 |
+
return Case(request, program, pair(rng, kinds, header=headers), family, 2)
|
| 242 |
+
if family == "tsv_projection":
|
| 243 |
+
kinds = ["name", "smallint", "status"]
|
| 244 |
+
column = rng.randint(1, 3)
|
| 245 |
+
request = f"The input is tab-separated. Print column {column} from every record."
|
| 246 |
+
return Case(request, f'BEGIN{{FS=OFS="\\t"}}{{print ${column}}}', pair(rng, kinds, "\t"), family, 1)
|
| 247 |
+
if family == "csv_filter":
|
| 248 |
+
kinds = ["name", "smallint", "status"]
|
| 249 |
+
threshold = rng.randint(8, 24)
|
| 250 |
+
request = f"The input is simple comma-separated data with no quoted commas. Print column 1 when column 2 exceeds {threshold}."
|
| 251 |
+
return Case(request, f'BEGIN{{FS=OFS=","}}$2>{threshold}{{print $1}}', pair(rng, kinds, ","), family, 2)
|
| 252 |
+
if family == "normalize_whitespace":
|
| 253 |
+
inputs = []
|
| 254 |
+
for rows_ in (rows(rng, ["name", "word", "int"]), rows(rng, ["name", "word", "int"])):
|
| 255 |
+
inputs.append("\n".join((" " if rng.random() < 0.5 else "") + rng.choice([" ", " ", "\t"]).join(row) + (" " if rng.random() < 0.5 else "") for row in rows_) + "\n")
|
| 256 |
+
return Case("Trim leading and trailing whitespace and collapse internal whitespace to single spaces.", "{$1=$1;print}", inputs, family, 2)
|
| 257 |
+
if family == "longest_line":
|
| 258 |
+
return Case("Find and print the longest input line; if tied, keep the earliest.", "{if(length($0)>length(best))best=$0}END{print best}", pair(rng, ["name", "word", "int", "status"]), family, 2)
|
| 259 |
+
if family == "every_nth":
|
| 260 |
+
step = rng.randint(2, 4)
|
| 261 |
+
offset = rng.randint(1, step)
|
| 262 |
+
request = f"Print every {step}{'nd' if step == 2 else 'rd' if step == 3 else 'th'} line starting at line {offset} (then line {offset + step}, and so on)."
|
| 263 |
+
return Case(request, f"NR%{step}=={offset % step}", pair(rng, ["name", "int"]), family, 1)
|
| 264 |
+
if family == "distinct_count":
|
| 265 |
+
column = rng.randint(1, 2)
|
| 266 |
+
request = f"Count the distinct values in column {column} and print only the count."
|
| 267 |
+
return Case(request, f"{{if(!seen[${column}]++)n++}}END{{print n+0}}", pair(rng, ["category", "word", "int"]), family, 2)
|
| 268 |
+
if family == "ratio":
|
| 269 |
+
request = "For each row, print column 1 and column 2 divided by column 3 to two decimal places; skip rows where column 3 is zero."
|
| 270 |
+
inputs = pair(rng, ["name", "smallint", "smallint"])
|
| 271 |
+
inputs = [re.sub(r"^(\w+ \d+ )\d+", r"\g<1>0", text, count=1, flags=re.MULTILINE) for text in inputs]
|
| 272 |
+
return Case(request, '{if($3!=0)printf "%s %.2f\\n",$1,$2/$3}', inputs, family, 2)
|
| 273 |
+
if family == "top_three":
|
| 274 |
+
program = "{value[NR]=$3;line[NR]=$0}END{for(i=2;i<=NR;i++){v=value[i];text=line[i];j=i-1;while(j>=1&&value[j]<v){value[j+1]=value[j];line[j+1]=line[j];j--}value[j+1]=v;line[j+1]=text}for(i=1;i<=3&&i<=NR;i++)print line[i]}"
|
| 275 |
+
request = "Print the three complete records with the highest numeric values in column 3, sorted descending. Preserve input order for ties."
|
| 276 |
+
return Case(request, program, pair(rng, ["name", "word", "smallint"]), family, 3)
|
| 277 |
+
raise ValueError(family)
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
FAMILIES = [
|
| 281 |
+
"project_fields", "last_field", "numeric_filter", "numeric_range", "string_filter",
|
| 282 |
+
"regex_filter", "exclude_regex", "line_range", "first_n", "skip_header",
|
| 283 |
+
"count_matches", "sum_field", "average_field", "min_field", "max_field",
|
| 284 |
+
"count_records", "dedup_lines", "dedup_field", "running_total", "computed_field",
|
| 285 |
+
"conditional_label", "uppercase", "substring", "replace_underscores", "reverse_fields",
|
| 286 |
+
"field_count", "count_by_key", "sum_by_key", "duplicates_only", "header_projection",
|
| 287 |
+
"header_filter", "tsv_projection", "csv_filter", "normalize_whitespace", "longest_line",
|
| 288 |
+
"every_nth", "distinct_count", "ratio", "top_three",
|
| 289 |
+
]
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
def generate_row(index: int, base_seed: int) -> dict:
|
| 293 |
+
family = FAMILIES[index % len(FAMILIES)]
|
| 294 |
+
for attempt in range(100):
|
| 295 |
+
case = make_case(family, base_seed + index * 1009 + attempt * 1_000_003)
|
| 296 |
+
try:
|
| 297 |
+
outputs = [run_awk(case.program, text) for text in case.inputs]
|
| 298 |
+
except ValueError:
|
| 299 |
+
continue
|
| 300 |
+
if not outputs[0].strip():
|
| 301 |
+
continue
|
| 302 |
+
split = "train" if index % 100 < 90 else "validation" if index % 100 < 95 else "test"
|
| 303 |
+
return {
|
| 304 |
+
"id": f"awkweave-{index:07d}",
|
| 305 |
+
"request": case.request,
|
| 306 |
+
"program": case.program,
|
| 307 |
+
"input_text": case.inputs[0],
|
| 308 |
+
"expected_output": outputs[0],
|
| 309 |
+
"validation_input": case.inputs[1],
|
| 310 |
+
"validation_output": outputs[1],
|
| 311 |
+
"family": case.family,
|
| 312 |
+
"difficulty": case.difficulty,
|
| 313 |
+
"split": split,
|
| 314 |
+
"source": "original-grammar",
|
| 315 |
+
"license": "CC-BY-4.0",
|
| 316 |
+
}
|
| 317 |
+
raise RuntimeError(f"Could not generate a non-empty case for {family} at index {index}")
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
def main() -> None:
|
| 321 |
+
parser = argparse.ArgumentParser()
|
| 322 |
+
parser.add_argument("--count", type=int, default=60_000)
|
| 323 |
+
parser.add_argument("--seed", type=int, default=20261128)
|
| 324 |
+
parser.add_argument("--workers", type=int, default=8)
|
| 325 |
+
parser.add_argument("--output", type=Path, default=Path("awkweave-seed.jsonl"))
|
| 326 |
+
args = parser.parse_args()
|
| 327 |
+
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 328 |
+
with args.output.open("w", encoding="utf-8") as handle:
|
| 329 |
+
with concurrent.futures.ProcessPoolExecutor(max_workers=args.workers) as executor:
|
| 330 |
+
futures = {executor.submit(generate_row, index, args.seed): index for index in range(args.count)}
|
| 331 |
+
completed = 0
|
| 332 |
+
for future in concurrent.futures.as_completed(futures):
|
| 333 |
+
index = futures[future]
|
| 334 |
+
row = future.result()
|
| 335 |
+
handle.write(json.dumps(row, ensure_ascii=False, separators=(",", ":")) + "\n")
|
| 336 |
+
completed += 1
|
| 337 |
+
if completed % 1000 == 0:
|
| 338 |
+
handle.flush()
|
| 339 |
+
print(f"generated {completed}/{args.count}", flush=True)
|
| 340 |
+
print(f"wrote {args.count} rows to {args.output}")
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
if __name__ == "__main__":
|
| 344 |
+
main()
|
paraphrase-audit.jsonl
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"id":"awkweave-0032176-p1","original":"Print the last field of every input line.","paraphrase":"Extract and print the last field from every line of input.","equivalent":true}
|
| 2 |
+
{"id":"awkweave-0029851-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate duplicate lines by keeping only the first instance of each, maintaining the original sequence.","equivalent":true}
|
| 3 |
+
{"id":"awkweave-0037161-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace from each line and replace any sequence of internal whitespace characters with a single space.","equivalent":true}
|
| 4 |
+
{"id":"awkweave-0014550-p1","original":"Show whole lines whose 2nd field is between 3 and 24, inclusive.","paraphrase":"Display complete lines where the second field has a value between 3 and 24, inclusive.","equivalent":true}
|
| 5 |
+
{"id":"awkweave-0055712-p1","original":"Print column 1 and pass when column 2 is at least 27; otherwise print fail.","paraphrase":"Output the first column along with 'pass' if the second column is 27 or greater; otherwise, output 'fail'.","equivalent":true}
|
| 6 |
+
{"id":"awkweave-0021634-p1","original":"Print each repeated value from column 1 with its number of occurrences, in first-appearance order.","paraphrase":"List each duplicate value from the first column along with its occurrence count, ordered by first appearance.","equivalent":true}
|
| 7 |
+
{"id":"awkweave-0011685-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the sequence of fields for each line and display every field.","equivalent":true}
|
| 8 |
+
{"id":"awkweave-0026141-p1","original":"Calculate and print the sum of the integers in column 3.","paraphrase":"Compute and display the sum of integer values found in the third column.","equivalent":true}
|
| 9 |
+
{"id":"awkweave-0057701-p1","original":"Print column 1 and pass when column 2 is at least 20; otherwise print fail.","paraphrase":"Print the first column along with pass if the second column is 20 or greater; otherwise, print fail.","equivalent":true}
|
| 10 |
+
{"id":"awkweave-0024921-p1","original":"Print column 4 followed by column 3 for every record.","paraphrase":"Display column 4 followed by column 3 for each record.","equivalent":true}
|
| 11 |
+
{"id":"awkweave-0022926-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace, and replace sequences of internal whitespace with a single space.","equivalent":true}
|
| 12 |
+
{"id":"awkweave-0027040-p1","original":"Find and print the smallest numeric value in column 2.","paraphrase":"Identify and display the minimum numeric value present in the second column.","equivalent":true}
|
| 13 |
+
{"id":"awkweave-0014545-p1","original":"For each row, print column 1 and column 2 divided by column 3 to two decimal places; skip rows where column 3 is zero.","paraphrase":"For each row where the third column is not zero, output the first column and the result of dividing the second column by the third, formatted to two decimal places.","equivalent":true}
|
| 14 |
+
{"id":"awkweave-0042418-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Output the count of whitespace-delimited fields for each line.","equivalent":true}
|
| 15 |
+
{"id":"awkweave-0025002-p1","original":"Show whole lines whose 3rd field is between 10 and 25, inclusive.","paraphrase":"Show entire lines where the third field falls within the range 10 to 25, inclusive.","equivalent":true}
|
| 16 |
+
{"id":"awkweave-0020976-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace, and reduce any internal whitespace sequences to a single space.","equivalent":true}
|
| 17 |
+
{"id":"awkweave-0042943-p1","original":"Print column 4 only for rows where column 3 is exactly ready.","paraphrase":"Output only the fourth column for rows where the third column is exactly 'ready'.","equivalent":true}
|
| 18 |
+
{"id":"awkweave-0026741-p1","original":"Count records for each value in column 2. Print each value and its count in order of first appearance.","paraphrase":"Tally the number of records for each distinct value in column 2, printing the value and its count in the order of first appearance.","equivalent":true}
|
| 19 |
+
{"id":"awkweave-0044313-p1","original":"Skip the first line and print every remaining line unchanged.","paraphrase":"Ignore the first line and print all subsequent lines exactly as they appear.","equivalent":true}
|
| 20 |
+
{"id":"awkweave-0028970-p1","original":"The input is simple comma-separated data with no quoted commas. Print column 1 when column 2 exceeds 9.","paraphrase":"For comma-separated data without quoted commas, output the first field if the second field is greater than 9.","equivalent":true}
|
| 21 |
+
{"id":"awkweave-0025303-p1","original":"The input is tab-separated. Print column 3 from every record.","paraphrase":"Given tab-separated input, output the third column for every record.","equivalent":true}
|
| 22 |
+
{"id":"awkweave-0020452-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate duplicate lines while keeping the first instance and maintaining the original sequence.","equivalent":true}
|
| 23 |
+
{"id":"awkweave-0057837-p1","original":"For each line, output fields 4 and 1, in that order.","paraphrase":"For every line, print fields 4 and 1 sequentially.","equivalent":true}
|
| 24 |
+
{"id":"awkweave-0021551-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores in the first column with spaces and print the modified values.","equivalent":true}
|
| 25 |
+
{"id":"awkweave-0023585-p1","original":"The first row is a header. Print the note column for every data row.","paraphrase":"Treating the initial row as a header, output the contents of the note column for all subsequent data rows.","equivalent":true}
|
| 26 |
+
{"id":"awkweave-0043766-p1","original":"Output only the first 2 records.","paraphrase":"Display only the initial two records.","equivalent":true}
|
| 27 |
+
{"id":"awkweave-0017950-p1","original":"Count how many records have pending in column 2. Print 0 if there are none.","paraphrase":"Count the number of records containing pending in the second column, outputting 0 if none exist.","equivalent":true}
|
| 28 |
+
{"id":"awkweave-0031520-p1","original":"Output only the first 4 records.","paraphrase":"Show only the initial 4 records from the input.","equivalent":true}
|
| 29 |
+
{"id":"awkweave-0020941-p1","original":"For each row, print column 1 and column 2 divided by column 3 to two decimal places; skip rows where column 3 is zero.","paraphrase":"For each row where the third column is non-zero, print the first column followed by the result of dividing the second column by the third, formatted to two decimal places.","equivalent":true}
|
| 30 |
+
{"id":"awkweave-0011049-p1","original":"Print the arithmetic mean of column 1, rounded to exactly two decimal places.","paraphrase":"Output the average of the values in the first column, ensuring the result is rounded to precisely two decimal places.","equivalent":true}
|
| 31 |
+
{"id":"awkweave-0017170-p1","original":"Count how many records have failed in column 2. Print 0 if there are none.","paraphrase":"Tally the records where column 2 is 'failed' and print the count, defaulting to 0 if none exist.","equivalent":true}
|
| 32 |
+
{"id":"awkweave-0030380-p1","original":"Print the three complete records with the highest numeric values in column 3, sorted descending. Preserve input order for ties.","paraphrase":"Display the full rows with the top three highest numeric values in column 3, sorted in descending order, while maintaining the original input sequence for any ties.","equivalent":true}
|
| 33 |
+
{"id":"awkweave-0021267-p1","original":"Print the arithmetic mean of column 1, rounded to exactly two decimal places.","paraphrase":"Print the average of column 1, formatted to exactly two decimal places.","equivalent":true}
|
| 34 |
+
{"id":"awkweave-0006331-p1","original":"Find and print the smallest numeric value in column 1.","paraphrase":"Identify and output the minimum numeric value found in the first column.","equivalent":true}
|
| 35 |
+
{"id":"awkweave-0027611-p1","original":"Print the three complete records with the highest numeric values in column 3, sorted descending. Preserve input order for ties.","paraphrase":"Select the top three records with the highest numeric values in column 3, sorted in descending order; maintain the original input order for any ties.","equivalent":true}
|
| 36 |
+
{"id":"awkweave-0010334-p1","original":"Print the three complete records with the highest numeric values in column 3, sorted descending. Preserve input order for ties.","paraphrase":"Display the top three records with the highest numeric values in column 3, sorted in descending order; maintain the original input order for any ties.","equivalent":true}
|
| 37 |
+
{"id":"awkweave-0057376-p1","original":"Print lines 4 through 7, including both endpoints.","paraphrase":"Print lines 4 through 7, inclusive of both the start and end lines.","equivalent":true}
|
| 38 |
+
{"id":"awkweave-0054067-p1","original":"Find and print the smallest numeric value in column 1.","paraphrase":"Identify and output the minimum numeric value present in column 1.","equivalent":true}
|
| 39 |
+
{"id":"awkweave-0054474-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 9.","paraphrase":"Ignoring the header, display the display_name field for any record where the score is above 9.","equivalent":true}
|
| 40 |
+
{"id":"awkweave-0004808-p1","original":"Calculate and print the sum of the integers in column 1.","paraphrase":"Compute and display the sum of all integer values found in column 1.","equivalent":true}
|
| 41 |
+
{"id":"awkweave-0025039-p1","original":"Print the last field of every input line.","paraphrase":"Print the final field from each input line.","equivalent":true}
|
| 42 |
+
{"id":"awkweave-0029686-p1","original":"Print lines 3 through 4, including both endpoints.","paraphrase":"Extract and print lines 3 to 4, inclusive.","equivalent":true}
|
| 43 |
+
{"id":"awkweave-0007621-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate exact duplicate lines while keeping the first instance and maintaining original order.","equivalent":true}
|
| 44 |
+
{"id":"awkweave-0017800-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate exact duplicate lines while maintaining the original sequence and keeping the first instance.","equivalent":true}
|
| 45 |
+
{"id":"awkweave-0021761-p1","original":"Print the three complete records with the highest numeric values in column 3, sorted descending. Preserve input order for ties.","paraphrase":"Display the top three records with the highest numeric values in column 3, sorted in descending order, maintaining input order for ties.","equivalent":true}
|
| 46 |
+
{"id":"awkweave-0048384-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the sequence of fields in each line and print the entire line.","equivalent":true}
|
| 47 |
+
{"id":"awkweave-0014723-p1","original":"Print column 1 and pass when column 2 is at least 26; otherwise print fail.","paraphrase":"Output the first column and print 'pass' if the second column is 26 or greater; otherwise, print 'fail'.","equivalent":true}
|
| 48 |
+
{"id":"awkweave-0004589-p1","original":"Count records for each value in column 2. Print each value and its count in order of first appearance.","paraphrase":"Tally the occurrences of each value in the second column and print each value with its count, ordered by first appearance.","equivalent":true}
|
| 49 |
+
{"id":"awkweave-0039830-p1","original":"Calculate and print the sum of the integers in column 3.","paraphrase":"Compute and display the sum of integer values in column 3.","equivalent":true}
|
| 50 |
+
{"id":"awkweave-0024823-p1","original":"For every row, print field 1 followed by the sum of fields 2 and 3.","paraphrase":"For each row, output field 1 followed by the sum of fields 2 and 3.","equivalent":true}
|
| 51 |
+
{"id":"awkweave-0048683-p1","original":"Calculate and print the sum of the integers in column 1.","paraphrase":"Compute and display the sum of all integer values in column 1.","equivalent":true}
|
| 52 |
+
{"id":"awkweave-0045274-p1","original":"Find and print the longest input line; if tied, keep the earliest.","paraphrase":"Identify and output the longest line from the input; in case of a tie in length, select the line that appears first.","equivalent":true}
|
| 53 |
+
{"id":"awkweave-0006502-p1","original":"Print each repeated value from column 1 with its number of occurrences, in first-appearance order.","paraphrase":"List each value from column 1 that appears more than once, along with its frequency, sorted by first appearance.","equivalent":true}
|
| 54 |
+
{"id":"awkweave-0047324-p1","original":"Keep only the first line for each distinct value in column 3; preserve input order.","paraphrase":"Retain only the initial line for every unique value in the third column, ensuring the original input order is preserved.","equivalent":true}
|
| 55 |
+
{"id":"awkweave-0029504-p1","original":"Print column 1 and pass when column 2 is at least 23; otherwise print fail.","paraphrase":"Output the first column along with 'pass' if the second column is 23 or higher; otherwise, output 'fail'.","equivalent":true}
|
| 56 |
+
{"id":"awkweave-0056751-p1","original":"Print every line except those containing the exact text ember.","paraphrase":"Output every line that does not contain the exact substring 'ember'.","equivalent":true}
|
| 57 |
+
{"id":"awkweave-0036800-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores with spaces in the first column and output the modified values.","equivalent":true}
|
| 58 |
+
{"id":"awkweave-0004469-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores in the first column with spaces and print the modified values.","equivalent":true}
|
| 59 |
+
{"id":"awkweave-0040116-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the sequence of fields on each line and output all fields.","equivalent":true}
|
| 60 |
+
{"id":"awkweave-0041724-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace, and replace sequences of internal whitespace with a single space.","equivalent":true}
|
| 61 |
+
{"id":"awkweave-0001509-p1","original":"Sum column 3 for each category in column 2, printing groups in order of first appearance.","paraphrase":"Calculate the sum of column 3 for each distinct category in column 2, displaying the results in the order groups first appear.","equivalent":true}
|
| 62 |
+
{"id":"awkweave-0036062-p1","original":"Count records for each value in column 2. Print each value and its count in order of first appearance.","paraphrase":"Tally records by the value in column 2, then list each value with its total count in the order they first appear.","equivalent":true}
|
| 63 |
+
{"id":"awkweave-0036842-p1","original":"Count records for each value in column 2. Print each value and its count in order of first appearance.","paraphrase":"Tally records per value in column 2. Output each value and its total, ordered by first appearance.","equivalent":true}
|
| 64 |
+
{"id":"awkweave-0027753-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the field order for each line and print all fields.","equivalent":true}
|
| 65 |
+
{"id":"awkweave-0010542-p1","original":"Print the arithmetic mean of column 2, rounded to exactly two decimal places.","paraphrase":"Output the average of the values in column 2, formatted to two decimal places.","equivalent":true}
|
| 66 |
+
{"id":"awkweave-0011656-p1","original":"Find and print the longest input line; if tied, keep the earliest.","paraphrase":"Identify and output the longest line from the input; in the event of a tie in length, select the line that appears earliest.","equivalent":true}
|
| 67 |
+
{"id":"awkweave-0020008-p1","original":"Print the last field of every input line.","paraphrase":"Print the final field from every line of input.","equivalent":true}
|
| 68 |
+
{"id":"awkweave-0042756-p1","original":"Print the arithmetic mean of column 2, rounded to exactly two decimal places.","paraphrase":"Display the average of column 2, formatted to exactly two decimal places.","equivalent":true}
|
| 69 |
+
{"id":"awkweave-0017145-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the sequence of fields on each line and output all fields.","equivalent":true}
|
| 70 |
+
{"id":"awkweave-0043939-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Output the count of whitespace-delimited fields present on each line.","equivalent":true}
|
| 71 |
+
{"id":"awkweave-0017121-p1","original":"Select the 4th and 3rd fields in that order.","paraphrase":"Extract the fourth field followed by the third field.","equivalent":true}
|
| 72 |
+
{"id":"awkweave-0031824-p1","original":"For each line, output fields 5 and 1, in that order.","paraphrase":"For every line, display the fifth field followed by the first field.","equivalent":true}
|
| 73 |
+
{"id":"awkweave-0012749-p1","original":"Print every 4th line starting at line 2 (then line 6, and so on).","paraphrase":"Print lines 2, 6, 10, and so on, effectively selecting every fourth line starting from the second.","equivalent":true}
|
| 74 |
+
{"id":"awkweave-0014950-p1","original":"Find and print the smallest numeric value in column 3.","paraphrase":"Identify and output the minimum numeric value found in column 3.","equivalent":true}
|
| 75 |
+
{"id":"awkweave-0035512-p1","original":"From column 1, print 3 characters starting at character 2.","paraphrase":"Extract and print a substring of length 3 from the first column, beginning at the second character.","equivalent":true}
|
| 76 |
+
{"id":"awkweave-0030162-p1","original":"Count all input records and print the total.","paraphrase":"Count the total number of input records and print the result.","equivalent":true}
|
| 77 |
+
{"id":"awkweave-0002866-p1","original":"For every row, print field 1 followed by the sum of fields 2 and 3.","paraphrase":"For each row, output the first field followed by the sum of the second and third fields.","equivalent":true}
|
| 78 |
+
{"id":"awkweave-0017256-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"For each record, output column 1 alongside the cumulative sum of column 2, with a space separating them.","equivalent":true}
|
| 79 |
+
{"id":"awkweave-0040673-p1","original":"Print every 3rd line starting at line 3 (then line 6, and so on).","paraphrase":"Print lines 3, 6, 9, and so on, effectively outputting every third line starting from the third.","equivalent":true}
|
| 80 |
+
{"id":"awkweave-0012152-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores in the first column with spaces and print the modified values.","equivalent":true}
|
| 81 |
+
{"id":"awkweave-0017557-p1","original":"Print lines 4 through 6, including both endpoints.","paraphrase":"Output lines 4 to 6, inclusive of both endpoints.","equivalent":true}
|
| 82 |
+
{"id":"awkweave-0037644-p1","original":"Skip the first line and print every remaining line unchanged.","paraphrase":"Ignore the first line and print all subsequent lines as they are.","equivalent":true}
|
| 83 |
+
{"id":"awkweave-0047047-p1","original":"Find and print the smallest numeric value in column 3.","paraphrase":"Identify and print the minimum numeric value present in the third column.","equivalent":true}
|
| 84 |
+
{"id":"awkweave-0015120-p1","original":"Sum column 3 for each category in column 2, printing groups in order of first appearance.","paraphrase":"Calculate the sum of values in column 3 grouped by column 2, listing the results in the order of the group's first appearance.","equivalent":true}
|
| 85 |
+
{"id":"awkweave-0029524-p1","original":"Print the last field of every input line.","paraphrase":"Output the final field from each input line.","equivalent":true}
|
| 86 |
+
{"id":"awkweave-0042100-p1","original":"For every row, print field 1 followed by the sum of fields 2 and 3.","paraphrase":"For each row, output field 1 followed by the sum of fields 2 and 3.","equivalent":true}
|
| 87 |
+
{"id":"awkweave-0032230-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate exact duplicate lines while maintaining the original order and keeping the first instance.","equivalent":true}
|
| 88 |
+
{"id":"awkweave-0051603-p1","original":"Print every line except those containing the exact text juniper.","paraphrase":"Print every line that does not contain the exact string 'juniper'.","equivalent":true}
|
| 89 |
+
{"id":"awkweave-0000752-p1","original":"Calculate and print the sum of the integers in column 2.","paraphrase":"Compute and display the sum of all integer values found in the second column.","equivalent":true}
|
| 90 |
+
{"id":"awkweave-0030026-p1","original":"Print every 2nd line starting at line 2 (then line 4, and so on).","paraphrase":"Output every second line of the input, beginning with line 2 (i.e., lines 2, 4, 6, etc.).","equivalent":true}
|
| 91 |
+
{"id":"awkweave-0042107-p1","original":"Count records for each value in column 2. Print each value and its count in order of first appearance.","paraphrase":"Tally the occurrences of each unique value in the second column and display the value alongside its count, maintaining the order in which they first appear.","equivalent":true}
|
| 92 |
+
{"id":"awkweave-0033669-p1","original":"Print the arithmetic mean of column 2, rounded to exactly two decimal places.","paraphrase":"Print the arithmetic mean of the second column, rounded to exactly two decimal places.","equivalent":true}
|
| 93 |
+
{"id":"awkweave-0043054-p1","original":"For each row, print column 1 and column 2 divided by column 3 to two decimal places; skip rows where column 3 is zero.","paraphrase":"For each row where the third column is non-zero, print the first column followed by the result of dividing the second column by the third, formatted to two decimal places.","equivalent":true}
|
| 94 |
+
{"id":"awkweave-0025947-p1","original":"Print the arithmetic mean of column 2, rounded to exactly two decimal places.","paraphrase":"Print the average of column 2, formatted to exactly two decimal places.","equivalent":true}
|
| 95 |
+
{"id":"awkweave-0059115-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 11.","paraphrase":"Ignoring the header, print the display_name for rows where the score is greater than 11.","equivalent":true}
|
| 96 |
+
{"id":"awkweave-0020013-p1","original":"Print every line except those containing the exact text grove.","paraphrase":"Output every line that does not contain the exact string grove.","equivalent":true}
|
| 97 |
+
{"id":"awkweave-0056142-p1","original":"Convert column 2 to uppercase and print only that column.","paraphrase":"Transform the second field to uppercase and output only that field.","equivalent":true}
|
| 98 |
+
{"id":"awkweave-0006832-p1","original":"Print lines 4 through 6, including both endpoints.","paraphrase":"Output lines 4 through 6, inclusive.","equivalent":true}
|
| 99 |
+
{"id":"awkweave-0041264-p1","original":"Print the complete records where column 3 is less than 42.","paraphrase":"Display the entire records for which the value in column 3 is less than 42.","equivalent":true}
|
| 100 |
+
{"id":"awkweave-0003105-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the order of fields on each line and print all fields.","equivalent":true}
|
| 101 |
+
{"id":"awkweave-0038884-p1","original":"Print the last field of every input line.","paraphrase":"Output the final field from each line of input.","equivalent":true}
|
| 102 |
+
{"id":"awkweave-0017263-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Output the count of whitespace-delimited fields for each line.","equivalent":true}
|
| 103 |
+
{"id":"awkweave-0003066-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the sequence of all fields on each line and print the result.","equivalent":true}
|
| 104 |
+
{"id":"awkweave-0011023-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Display the count of whitespace-delimited fields for each line.","equivalent":true}
|
| 105 |
+
{"id":"awkweave-0043118-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"In column 1, substitute all underscores with spaces and output the modified values.","equivalent":true}
|
| 106 |
+
{"id":"awkweave-0032664-p1","original":"Convert column 1 to uppercase and print only that column.","paraphrase":"Transform column 1 to uppercase letters and print exclusively that column.","equivalent":true}
|
| 107 |
+
{"id":"awkweave-0042538-p1","original":"Print each repeated value from column 1 with its number of occurrences, in first-appearance order.","paraphrase":"List each duplicate value from column 1 alongside its frequency, sorted by the order of first appearance.","equivalent":true}
|
| 108 |
+
{"id":"awkweave-0054877-p1","original":"Print column 1 only for rows where column 3 is exactly pending.","paraphrase":"Output only the first column for rows where the third column contains exactly 'pending'.","equivalent":true}
|
| 109 |
+
{"id":"awkweave-0011346-p1","original":"Count the distinct values in column 1 and print only the count.","paraphrase":"Calculate the number of unique values present in the first column and output only that total count.","equivalent":true}
|
| 110 |
+
{"id":"awkweave-0056112-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 10.","paraphrase":"With the first row as a header, output the display_name for data rows where the score is greater than 10.","equivalent":true}
|
| 111 |
+
{"id":"awkweave-0019134-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the sequence of all fields in each line and output them.","equivalent":true}
|
| 112 |
+
{"id":"awkweave-0011631-p1","original":"Skip the first line and print every remaining line unchanged.","paraphrase":"Ignore the first line and print all subsequent lines without modification.","equivalent":true}
|
| 113 |
+
{"id":"awkweave-0019934-p1","original":"Print all fields from lines where field 2 begins with INFO.","paraphrase":"Output all fields from lines where the second field starts with INFO.","equivalent":true}
|
| 114 |
+
{"id":"awkweave-0013630-p1","original":"For every row, print field 1 followed by the sum of fields 2 and 3.","paraphrase":"For each row, display the first field followed by the sum of the second and third fields.","equivalent":true}
|
| 115 |
+
{"id":"awkweave-0018080-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores in the first column with spaces and output the modified values.","equivalent":true}
|
| 116 |
+
{"id":"awkweave-0019332-p1","original":"Sum column 3 for each category in column 2, printing groups in order of first appearance.","paraphrase":"Calculate the sum of column 3 for each unique value in column 2, listing results in order of first appearance.","equivalent":true}
|
| 117 |
+
{"id":"awkweave-0042442-p1","original":"Count how many records have failed in column 2. Print 0 if there are none.","paraphrase":"Count the number of records with 'failed' in the second column, printing 0 if none exist.","equivalent":false}
|
| 118 |
+
{"id":"awkweave-0041625-p1","original":"Print the arithmetic mean of column 2, rounded to exactly two decimal places.","paraphrase":"Output the average of the values in the second column, formatted to precisely two decimal places.","equivalent":true}
|
| 119 |
+
{"id":"awkweave-0034131-p1","original":"Print every line except those containing the exact text indigo.","paraphrase":"Display all lines that do not contain the exact string indigo.","equivalent":true}
|
| 120 |
+
{"id":"awkweave-0014467-p1","original":"For each row, print column 1 and column 2 divided by column 3 to two decimal places; skip rows where column 3 is zero.","paraphrase":"For each row, output the first column and the result of dividing the second column by the third column formatted to two decimal places, omitting any rows where the third column is zero.","equivalent":true}
|
| 121 |
+
{"id":"awkweave-0056733-p1","original":"Sum column 3 for each category in column 2, printing groups in order of first appearance.","paraphrase":"Calculate the sum of column 3 grouped by column 2 values, displaying the results in the order groups first appear.","equivalent":true}
|
| 122 |
+
{"id":"awkweave-0007630-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Output the count of whitespace-delimited fields for each line.","equivalent":true}
|
| 123 |
+
{"id":"awkweave-0048715-p1","original":"Print column 3 only for rows where column 4 is exactly pending.","paraphrase":"Print only the third column for rows where the fourth column contains exactly the text pending.","equivalent":true}
|
| 124 |
+
{"id":"awkweave-0049980-p1","original":"Convert column 2 to uppercase and print only that column.","paraphrase":"Transform the second column to uppercase and display only that column.","equivalent":true}
|
| 125 |
+
{"id":"awkweave-0045800-p1","original":"Find and print the largest numeric value in column 1.","paraphrase":"Identify and output the maximum numerical value found in the first column.","equivalent":true}
|
| 126 |
+
{"id":"awkweave-0022905-p1","original":"Print the arithmetic mean of column 1, rounded to exactly two decimal places.","paraphrase":"Calculate the average of values in column 1 and print the result rounded to exactly two decimal places.","equivalent":true}
|
| 127 |
+
{"id":"awkweave-0024584-p1","original":"Find and print the largest numeric value in column 3.","paraphrase":"Identify and print the maximum numeric value present in column 3.","equivalent":true}
|
| 128 |
+
{"id":"awkweave-0048221-p1","original":"Keep only the first line for each distinct value in column 2; preserve input order.","paraphrase":"Retain only the first occurrence for each unique value in column 2, preserving the original sequence.","equivalent":true}
|
| 129 |
+
{"id":"awkweave-0055227-p1","original":"Show whole lines whose 3rd field is between 8 and 18, inclusive.","paraphrase":"Show entire lines where the third field falls within the inclusive range of 8 to 18.","equivalent":true}
|
| 130 |
+
{"id":"awkweave-0059374-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate exact duplicate lines while maintaining the original order and keeping the first instance of each.","equivalent":true}
|
| 131 |
+
{"id":"awkweave-0059837-p1","original":"Calculate and print the sum of the integers in column 2.","paraphrase":"Compute and display the total sum of all integer values located in the second column.","equivalent":true}
|
| 132 |
+
{"id":"awkweave-0016159-p1","original":"Find and print the smallest numeric value in column 2.","paraphrase":"Identify and print the minimum numeric value present in column 2.","equivalent":true}
|
| 133 |
+
{"id":"awkweave-0004630-p1","original":"Print each repeated value from column 1 with its number of occurrences, in first-appearance order.","paraphrase":"List each duplicate value from column 1 along with its frequency, sorted by the order of first occurrence.","equivalent":true}
|
| 134 |
+
{"id":"awkweave-0055487-p1","original":"The first row is a header. Print the display_name column for every data row.","paraphrase":"Skip the header row and output the contents of the display_name column for all remaining data rows.","equivalent":true}
|
| 135 |
+
{"id":"awkweave-0029830-p1","original":"Find and print the longest input line; if tied, keep the earliest.","paraphrase":"Identify and output the longest line in the input; if multiple lines share the maximum length, select the first one encountered.","equivalent":true}
|
| 136 |
+
{"id":"awkweave-0043063-p1","original":"Print lines 4 through 7, including both endpoints.","paraphrase":"Output lines 4 to 7, inclusive of both endpoints.","equivalent":true}
|
| 137 |
+
{"id":"awkweave-0022764-p1","original":"Sum column 3 for each category in column 2, printing groups in order of first appearance.","paraphrase":"Calculate the sum of column 3 for each group defined by column 2, presenting the results in the order groups first appear.","equivalent":true}
|
| 138 |
+
{"id":"awkweave-0022860-p1","original":"Print every line except those containing the exact text grove.","paraphrase":"Output all lines that do not contain the exact string grove.","equivalent":true}
|
| 139 |
+
{"id":"awkweave-0019775-p1","original":"Print the complete records where column 1 is less than 39.","paraphrase":"Output the full records for which the value in the first column is less than 39.","equivalent":true}
|
| 140 |
+
{"id":"awkweave-0043359-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 15.","paraphrase":"Ignoring the header, print the display_name field for any record where the score is strictly greater than 15.","equivalent":true}
|
| 141 |
+
{"id":"awkweave-0041537-p1","original":"Print the complete records where column 1 is greater than 50.","paraphrase":"Output the full records for which the value in column 1 exceeds 50.","equivalent":true}
|
| 142 |
+
{"id":"awkweave-0002327-p1","original":"Count records for each value in column 2. Print each value and its count in order of first appearance.","paraphrase":"Tally the number of records for each distinct value in column 2 and print the value with its count, ordered by first appearance.","equivalent":true}
|
| 143 |
+
{"id":"awkweave-0032481-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace and replace internal whitespace sequences with a single space.","equivalent":true}
|
| 144 |
+
{"id":"awkweave-0040087-p1","original":"Find and print the longest input line; if tied, keep the earliest.","paraphrase":"Identify and print the longest line from the input; in case of a tie in length, select the first occurrence.","equivalent":true}
|
| 145 |
+
{"id":"awkweave-0055518-p1","original":"Convert column 1 to uppercase and print only that column.","paraphrase":"Transform the first column to uppercase and output only that column.","equivalent":true}
|
| 146 |
+
{"id":"awkweave-0040676-p1","original":"Print the three complete records with the highest numeric values in column 3, sorted descending. Preserve input order for ties.","paraphrase":"Display the full records corresponding to the top three highest numeric values in column 3, sorted in descending order, while maintaining the original input order for any ties.","equivalent":true}
|
| 147 |
+
{"id":"awkweave-0033052-p1","original":"For every row, print field 1 followed by the sum of fields 2 and 3.","paraphrase":"For each row, output field 1 followed by the total of fields 2 and 3.","equivalent":true}
|
| 148 |
+
{"id":"awkweave-0023932-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Display the count of whitespace-delimited fields for every line.","equivalent":true}
|
| 149 |
+
{"id":"awkweave-0023819-p1","original":"The first row is a header. Print the region column for every data row.","paraphrase":"Treating the first row as a header, output the region column for all subsequent data rows.","equivalent":true}
|
| 150 |
+
{"id":"awkweave-0008440-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate duplicate lines by keeping only the first instance of each, maintaining the original sequence.","equivalent":true}
|
| 151 |
+
{"id":"awkweave-0046551-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the sequence of fields for each line and print all fields.","equivalent":true}
|
| 152 |
+
{"id":"awkweave-0022087-p1","original":"Find and print the smallest numeric value in column 3.","paraphrase":"Identify and print the minimum numeric value present in the third column.","equivalent":true}
|
| 153 |
+
{"id":"awkweave-0004101-p1","original":"Print every line except those containing the exact text amber.","paraphrase":"Print every line that does not contain the exact substring amber.","equivalent":true}
|
| 154 |
+
{"id":"awkweave-0029438-p1","original":"The input is simple comma-separated data with no quoted commas. Print column 1 when column 2 exceeds 20.","paraphrase":"For simple comma-separated data without quoted commas, output the first column whenever the second column is greater than 20.","equivalent":true}
|
| 155 |
+
{"id":"awkweave-0001888-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate duplicate lines while maintaining the original order and keeping only the first instance of each line.","equivalent":true}
|
| 156 |
+
{"id":"awkweave-0006806-p1","original":"Print column 1 and pass when column 2 is at least 24; otherwise print fail.","paraphrase":"Output the first column and print 'pass' if the second column is 24 or greater; otherwise, print 'fail'.","equivalent":true}
|
| 157 |
+
{"id":"awkweave-0037933-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Output the count of whitespace-delimited fields for each line.","equivalent":true}
|
| 158 |
+
{"id":"awkweave-0009969-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the sequence of fields in each line and output all fields.","equivalent":true}
|
| 159 |
+
{"id":"awkweave-0057816-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"Output the first column alongside the cumulative sum of the second column for each record, using a space as the delimiter.","equivalent":true}
|
| 160 |
+
{"id":"awkweave-0034106-p1","original":"Print column 1 and pass when column 2 is at least 23; otherwise print fail.","paraphrase":"Output column 1; if column 2 is 23 or higher, print pass, otherwise print fail.","equivalent":true}
|
| 161 |
+
{"id":"awkweave-0014486-p1","original":"Keep only the first line for each distinct value in column 2; preserve input order.","paraphrase":"Retain only the initial row for every unique value in the second column, preserving the input order.","equivalent":true}
|
| 162 |
+
{"id":"awkweave-0012732-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"Output the first column alongside the cumulative total of the second column for each record, using a space as the delimiter.","equivalent":true}
|
| 163 |
+
{"id":"awkweave-0014474-p1","original":"Print all fields from lines where field 1 begins with ERROR.","paraphrase":"Print all fields from lines where the first field starts with 'ERROR'.","equivalent":true}
|
| 164 |
+
{"id":"awkweave-0008833-p1","original":"For every row, print field 1 followed by the sum of fields 2 and 3.","paraphrase":"For every row, output field 1 followed by the sum of fields 2 and 3.","equivalent":true}
|
| 165 |
+
{"id":"awkweave-0048240-p1","original":"Count the distinct values in column 2 and print only the count.","paraphrase":"Calculate the number of unique values present in the second column and print only that total count.","equivalent":true}
|
| 166 |
+
{"id":"awkweave-0058825-p1","original":"Find and print the smallest numeric value in column 3.","paraphrase":"Identify and display the minimum number found in column 3.","equivalent":true}
|
| 167 |
+
{"id":"awkweave-0033852-p1","original":"Print column 3 followed by column 1 for every record.","paraphrase":"Output the third column followed by the first column for all records.","equivalent":true}
|
| 168 |
+
{"id":"awkweave-0022913-p1","original":"Print column 1 and pass when column 2 is at least 22; otherwise print fail.","paraphrase":"Print the first column along with 'pass' if the second column is 22 or greater; otherwise, print 'fail'.","equivalent":true}
|
| 169 |
+
{"id":"awkweave-0009882-p1","original":"Count all input records and print the total.","paraphrase":"Count the total number of input records and print the result.","equivalent":true}
|
| 170 |
+
{"id":"awkweave-0030879-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 23.","paraphrase":"With the first row as a header, print the display_name for any data row where the score is above 23.","equivalent":true}
|
| 171 |
+
{"id":"awkweave-0021282-p1","original":"Sum column 3 for each category in column 2, printing groups in order of first appearance.","paraphrase":"Calculate the sum of column 3 grouped by each category in column 2, displaying the results in the order of the category's first appearance.","equivalent":true}
|
| 172 |
+
{"id":"awkweave-0003433-p1","original":"Print the last field of every input line.","paraphrase":"Print the final field of every line in the input.","equivalent":true}
|
| 173 |
+
{"id":"awkweave-0045568-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate duplicate lines while keeping the first instance and maintaining the original sequence.","equivalent":true}
|
| 174 |
+
{"id":"awkweave-0030215-p1","original":"The first row is a header. Print the record_id column for every data row.","paraphrase":"Treating the first line as a header, extract and print the record_id field from all subsequent data rows.","equivalent":true}
|
| 175 |
+
{"id":"awkweave-0049649-p1","original":"Print the complete records where column 4 is at most 75.","paraphrase":"Display full records where the value in the fourth column is less than or equal to 75.","equivalent":true}
|
| 176 |
+
{"id":"awkweave-0027362-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores in column 1 with spaces and print the modified values.","equivalent":true}
|
| 177 |
+
{"id":"awkweave-0054122-p1","original":"The first row is a header. Print the state column for every data row.","paraphrase":"Skip the header row and output the content of the state column for all remaining rows.","equivalent":true}
|
| 178 |
+
{"id":"awkweave-0025320-p1","original":"Skip the first line and print every remaining line unchanged.","paraphrase":"Omit the first line and output all subsequent lines as they are.","equivalent":true}
|
| 179 |
+
{"id":"awkweave-0054835-p1","original":"Print the last field of every input line.","paraphrase":"Print the final field from every line of input.","equivalent":true}
|
| 180 |
+
{"id":"awkweave-0021018-p1","original":"Count the distinct values in column 1 and print only the count.","paraphrase":"Calculate the number of unique values in the first column and print only that total count.","equivalent":true}
|
| 181 |
+
{"id":"awkweave-0029857-p1","original":"From column 1, print 3 characters starting at character 3.","paraphrase":"Extract and output a substring of length 3 from the first column, starting at the third character.","equivalent":true}
|
| 182 |
+
{"id":"awkweave-0022686-p1","original":"Sum column 3 for each category in column 2, printing groups in order of first appearance.","paraphrase":"Calculate the sum of values in column 3 grouped by the categories in column 2, listing the results in the order the groups first appear.","equivalent":true}
|
| 183 |
+
{"id":"awkweave-0058347-p1","original":"Show whole lines whose 1st field is between 10 and 27, inclusive.","paraphrase":"Display entire lines where the first field falls within the inclusive range of 10 to 27.","equivalent":true}
|
| 184 |
+
{"id":"awkweave-0040700-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores with spaces in column 1 and print the modified values.","equivalent":true}
|
| 185 |
+
{"id":"awkweave-0045174-p1","original":"Print the arithmetic mean of column 3, rounded to exactly two decimal places.","paraphrase":"Print the average of column 3, rounded to two decimal places.","equivalent":true}
|
| 186 |
+
{"id":"awkweave-0043866-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 14.","paraphrase":"Ignoring the header, print the display_name for rows where the score is above 14.","equivalent":true}
|
| 187 |
+
{"id":"awkweave-0031843-p1","original":"For every row, print field 1 followed by the sum of fields 2 and 3.","paraphrase":"For each row, print field 1 followed by the sum of fields 2 and 3.","equivalent":true}
|
| 188 |
+
{"id":"awkweave-0003267-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 16.","paraphrase":"With the first row as a header, print the display_name for data rows where the score is strictly greater than 16.","equivalent":true}
|
| 189 |
+
{"id":"awkweave-0040323-p1","original":"Count the distinct values in column 2 and print only the count.","paraphrase":"Calculate and output only the total number of unique values found in the second column.","equivalent":true}
|
| 190 |
+
{"id":"awkweave-0051170-p1","original":"Print the complete records where column 1 is greater than 20.","paraphrase":"Print the entire records where the value in column 1 exceeds 20.","equivalent":true}
|
| 191 |
+
{"id":"awkweave-0054778-p1","original":"From column 1, print 2 characters starting at character 3.","paraphrase":"Extract and display the substring of length 2 starting at index 3 from the first column.","equivalent":true}
|
| 192 |
+
{"id":"awkweave-0044333-p1","original":"The first row is a header. Print the note column for every data row.","paraphrase":"Treating the first line as a header, output the content of the note column for all subsequent data rows.","equivalent":true}
|
| 193 |
+
{"id":"awkweave-0004265-p1","original":"Find and print the largest numeric value in column 1.","paraphrase":"Identify and display the maximum numerical value present in the first column.","equivalent":true}
|
| 194 |
+
{"id":"awkweave-0016943-p1","original":"Keep only the first line for each distinct value in column 2; preserve input order.","paraphrase":"Retain only the initial row for every unique entry in the second column, ensuring the original input order is preserved.","equivalent":true}
|
| 195 |
+
{"id":"awkweave-0010410-p1","original":"Count the distinct values in column 1 and print only the count.","paraphrase":"Determine the number of unique values present in column 1 and print only this total count.","equivalent":true}
|
| 196 |
+
{"id":"awkweave-0034461-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the sequence of fields for each line and display every field.","equivalent":true}
|
| 197 |
+
{"id":"awkweave-0028232-p1","original":"Print every 2nd line starting at line 1 (then line 3, and so on).","paraphrase":"Print every other line starting from the first line (i.e., lines 1, 3, 5, etc.).","equivalent":true}
|
| 198 |
+
{"id":"awkweave-0049704-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"For each record, print column 1 and the cumulative sum of column 2, separated by a space.","equivalent":true}
|
| 199 |
+
{"id":"awkweave-0051771-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"Output column 1 alongside the cumulative sum of column 2 for each record, using a space as the delimiter.","equivalent":true}
|
| 200 |
+
{"id":"awkweave-0026960-p1","original":"Calculate and print the sum of the integers in column 2.","paraphrase":"Compute and display the total sum of integer values in column 2.","equivalent":true}
|
| 201 |
+
{"id":"awkweave-0059912-p1","original":"Output only the first 3 records.","paraphrase":"Output only the first three records from the input.","equivalent":true}
|
| 202 |
+
{"id":"awkweave-0003639-p1","original":"Print the arithmetic mean of column 2, rounded to exactly two decimal places.","paraphrase":"Output the average of the values in column 2, formatted to precisely two decimal places.","equivalent":true}
|
| 203 |
+
{"id":"awkweave-0017312-p1","original":"Print every 4th line starting at line 4 (then line 8, and so on).","paraphrase":"Output every fourth line of the input, beginning with line 4 (i.e., lines 4, 8, 12, etc.).","equivalent":true}
|
| 204 |
+
{"id":"awkweave-0050350-p1","original":"Print the last field of every input line.","paraphrase":"Print the last field from each line of input.","equivalent":true}
|
| 205 |
+
{"id":"awkweave-0038131-p1","original":"Print each repeated value from column 1 with its number of occurrences, in first-appearance order.","paraphrase":"List each value from the first column that appears more than once along with its frequency, ordered by their first occurrence.","equivalent":true}
|
| 206 |
+
{"id":"awkweave-0005608-p1","original":"The input is tab-separated. Print column 2 from every record.","paraphrase":"Given tab-separated input, extract and print the second column from every record.","equivalent":true}
|
| 207 |
+
{"id":"awkweave-0021286-p1","original":"The input is tab-separated. Print column 2 from every record.","paraphrase":"Given tab-separated input, extract and print the second column from every record.","equivalent":true}
|
| 208 |
+
{"id":"awkweave-0012052-p1","original":"Print the last field of every input line.","paraphrase":"Output the final field from every line of input.","equivalent":true}
|
| 209 |
+
{"id":"awkweave-0027538-p1","original":"Print column 4 only for rows where column 1 is exactly ready.","paraphrase":"Output only the fourth column for rows where the first column matches the exact text 'ready'.","equivalent":true}
|
| 210 |
+
{"id":"awkweave-0028453-p1","original":"From column 1, print 4 characters starting at character 2.","paraphrase":"Extract and print a 4-character substring from column 1, beginning at the second character.","equivalent":true}
|
| 211 |
+
{"id":"awkweave-0033274-p1","original":"Print lines 2 through 5, including both endpoints.","paraphrase":"Print lines 2 to 5, inclusive of both the start and end lines.","equivalent":true}
|
| 212 |
+
{"id":"awkweave-0041522-p1","original":"Count records for each value in column 2. Print each value and its count in order of first appearance.","paraphrase":"Tally the occurrences of each unique value in the second column, listing them alongside their counts in the order they first appear.","equivalent":true}
|
| 213 |
+
{"id":"awkweave-0018646-p1","original":"Print column 4 only for rows where column 3 is exactly pending.","paraphrase":"Print only the fourth column for rows where the third column contains the exact value 'pending'.","equivalent":true}
|
| 214 |
+
{"id":"awkweave-0013033-p1","original":"Print lines 3 through 5, including both endpoints.","paraphrase":"Print lines 3 through 5, inclusive of both the start and end lines.","equivalent":true}
|
| 215 |
+
{"id":"awkweave-0045118-p1","original":"Find and print the longest input line; if tied, keep the earliest.","paraphrase":"Output the longest line from the input, selecting the first one encountered if there is a tie in length.","equivalent":true}
|
| 216 |
+
{"id":"awkweave-0018966-p1","original":"Print the arithmetic mean of column 1, rounded to exactly two decimal places.","paraphrase":"Output the average of the values in column 1, formatted to two decimal places.","equivalent":true}
|
| 217 |
+
{"id":"awkweave-0014855-p1","original":"Print every 3rd line starting at line 2 (then line 5, and so on).","paraphrase":"Output every third line beginning with line 2 (i.e., lines 2, 5, 8, etc.).","equivalent":true}
|
| 218 |
+
{"id":"awkweave-0053124-p1","original":"Print every line except those containing the exact text amber.","paraphrase":"Output every line that does not contain the exact substring 'amber'.","equivalent":true}
|
| 219 |
+
{"id":"awkweave-0059144-p1","original":"Print column 1 and pass when column 2 is at least 24; otherwise print fail.","paraphrase":"Show the first column; if the second column is 24 or greater, output 'pass', otherwise output 'fail'.","equivalent":true}
|
| 220 |
+
{"id":"awkweave-0007385-p1","original":"Find and print the largest numeric value in column 1.","paraphrase":"Identify and output the maximum numeric value found in column 1.","equivalent":true}
|
| 221 |
+
{"id":"awkweave-0022624-p1","original":"Print column 3 only for rows where column 4 is exactly active.","paraphrase":"Display the third column exclusively for rows where the fourth column matches 'active' exactly.","equivalent":true}
|
| 222 |
+
{"id":"awkweave-0043578-p1","original":"Count all input records and print the total.","paraphrase":"Output the total count of all input records.","equivalent":true}
|
| 223 |
+
{"id":"awkweave-0024035-p1","original":"Calculate and print the sum of the integers in column 2.","paraphrase":"Compute and output the sum of integer values found in the second column.","equivalent":true}
|
| 224 |
+
{"id":"awkweave-0025456-p1","original":"Print each repeated value from column 1 with its number of occurrences, in first-appearance order.","paraphrase":"List each duplicate value from the first column along with its occurrence count, ordered by first appearance.","equivalent":true}
|
| 225 |
+
{"id":"awkweave-0057350-p1","original":"Print column 1 and pass when column 2 is at least 20; otherwise print fail.","paraphrase":"Display column 1 and append 'pass' if column 2 is greater than or equal to 20; otherwise, append 'fail'.","equivalent":true}
|
| 226 |
+
{"id":"awkweave-0015031-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate exact duplicate lines while maintaining the original order and keeping the first instance of each unique line.","equivalent":true}
|
| 227 |
+
{"id":"awkweave-0038772-p1","original":"Print every line except those containing the exact text fable.","paraphrase":"Output every line that does not contain the exact string 'fable'.","equivalent":true}
|
| 228 |
+
{"id":"awkweave-0003568-p1","original":"For every row, print field 1 followed by the sum of fields 2 and 3.","paraphrase":"Display field 1 followed by the sum of fields 2 and 3 for every row.","equivalent":true}
|
| 229 |
+
{"id":"awkweave-0013246-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Print the count of whitespace-delimited fields for each line.","equivalent":true}
|
| 230 |
+
{"id":"awkweave-0022043-p1","original":"Output only the first 5 records.","paraphrase":"Display only the first 5 records.","equivalent":true}
|
| 231 |
+
{"id":"awkweave-0036928-p1","original":"Find and print the longest input line; if tied, keep the earliest.","paraphrase":"Identify and print the longest input line, selecting the earliest one in case of a tie.","equivalent":true}
|
| 232 |
+
{"id":"awkweave-0000257-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores in the first column with spaces and print the modified values.","equivalent":true}
|
| 233 |
+
{"id":"awkweave-0051909-p1","original":"Print column 4 followed by column 2 for every record.","paraphrase":"Output the fourth column followed by the second column for each record.","equivalent":true}
|
| 234 |
+
{"id":"awkweave-0057566-p1","original":"Print the complete records where column 3 is greater than 39.","paraphrase":"Output full records where the value in the third column exceeds 39.","equivalent":true}
|
| 235 |
+
{"id":"awkweave-0038026-p1","original":"Print the last field of every input line.","paraphrase":"Print the final field from each input line.","equivalent":true}
|
| 236 |
+
{"id":"awkweave-0047325-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"For each entry, output the first column value alongside the cumulative sum of the second column, using a space as the delimiter.","equivalent":true}
|
| 237 |
+
{"id":"awkweave-0043507-p1","original":"From column 1, print 3 characters starting at character 1.","paraphrase":"Extract and print the first 3 characters from column 1.","equivalent":false}
|
| 238 |
+
{"id":"awkweave-0033255-p1","original":"Sum column 3 for each category in column 2, printing groups in order of first appearance.","paraphrase":"Calculate the sum of column 3 grouped by column 2 categories, listing groups in the order they first appear.","equivalent":true}
|
| 239 |
+
{"id":"awkweave-0007637-p1","original":"The input is simple comma-separated data with no quoted commas. Print column 1 when column 2 exceeds 16.","paraphrase":"Output the first column of comma-separated records where the second column is strictly greater than 16, assuming no quoted commas.","equivalent":true}
|
| 240 |
+
{"id":"awkweave-0019333-p1","original":"Print each repeated value from column 1 with its number of occurrences, in first-appearance order.","paraphrase":"List duplicate values from column 1 alongside their frequency, sorted by when they first appear.","equivalent":false}
|
| 241 |
+
{"id":"awkweave-0031200-p1","original":"Print column 6 followed by column 2 for every record.","paraphrase":"Output the sixth column followed by the second column for each record.","equivalent":true}
|
| 242 |
+
{"id":"awkweave-0028075-p1","original":"Find and print the longest input line; if tied, keep the earliest.","paraphrase":"Identify and print the longest line in the input, selecting the first one encountered if there are ties.","equivalent":true}
|
| 243 |
+
{"id":"awkweave-0008522-p1","original":"Print column 1 and pass when column 2 is at least 27; otherwise print fail.","paraphrase":"Output the first column and print 'pass' if the second column is 27 or greater; otherwise, print 'fail'.","equivalent":true}
|
| 244 |
+
{"id":"awkweave-0017781-p1","original":"Count the distinct values in column 1 and print only the count.","paraphrase":"Calculate the number of unique values present in the first column and output only that total count.","equivalent":true}
|
| 245 |
+
{"id":"awkweave-0032756-p1","original":"Print every 4th line starting at line 2 (then line 6, and so on).","paraphrase":"Output every fourth line beginning with line 2 (i.e., lines 2, 6, 10, etc.).","equivalent":true}
|
| 246 |
+
{"id":"awkweave-0043385-p1","original":"Keep only the first line for each distinct value in column 2; preserve input order.","paraphrase":"Retain only the first occurrence for every unique value in column 2, preserving the original sequence.","equivalent":true}
|
| 247 |
+
{"id":"awkweave-0021613-p1","original":"Print lines 4 through 6, including both endpoints.","paraphrase":"Output lines 4 to 6, inclusive of both the start and end lines.","equivalent":true}
|
| 248 |
+
{"id":"awkweave-0007919-p1","original":"Print the complete records where column 1 is at most 76.","paraphrase":"Display full records where the value in the first column is less than or equal to 76.","equivalent":true}
|
| 249 |
+
{"id":"awkweave-0052427-p1","original":"Calculate and print the sum of the integers in column 1.","paraphrase":"Compute and display the total sum of integer values found in column 1.","equivalent":true}
|
| 250 |
+
{"id":"awkweave-0023953-p1","original":"Print lines 4 through 6, including both endpoints.","paraphrase":"Print lines 4, 5, and 6 inclusive.","equivalent":true}
|
| 251 |
+
{"id":"awkweave-0005446-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Output the count of whitespace-delimited fields for each line.","equivalent":true}
|
| 252 |
+
{"id":"awkweave-0000441-p1","original":"Print the arithmetic mean of column 1, rounded to exactly two decimal places.","paraphrase":"Output the average of column 1, formatted to exactly two decimal places.","equivalent":true}
|
| 253 |
+
{"id":"awkweave-0000586-p1","original":"Print the last field of every input line.","paraphrase":"Output the final field from every line of input.","equivalent":true}
|
| 254 |
+
{"id":"awkweave-0048524-p1","original":"Output only the first 3 records.","paraphrase":"Display only the first 3 records.","equivalent":true}
|
| 255 |
+
{"id":"awkweave-0042105-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the order of fields on each line and print all fields.","equivalent":true}
|
| 256 |
+
{"id":"awkweave-0021878-p1","original":"Print the three complete records with the highest numeric values in column 3, sorted descending. Preserve input order for ties.","paraphrase":"Display the top three records with the highest numeric values in column 3, sorted in descending order; maintain the original input order for any ties.","equivalent":true}
|
| 257 |
+
{"id":"awkweave-0022900-p1","original":"Print lines 4 through 6, including both endpoints.","paraphrase":"Print lines 4, 5, and 6 inclusive.","equivalent":true}
|
| 258 |
+
{"id":"awkweave-0051274-p1","original":"Print each repeated value from column 1 with its number of occurrences, in first-appearance order.","paraphrase":"Identify values in column 1 that appear more than once, then print each duplicate along with its frequency, sorted by first occurrence.","equivalent":true}
|
| 259 |
+
{"id":"awkweave-0007949-p1","original":"The input is simple comma-separated data with no quoted commas. Print column 1 when column 2 exceeds 11.","paraphrase":"For simple comma-separated input without quoted commas, output the first column whenever the second column's value is greater than 11.","equivalent":true}
|
| 260 |
+
{"id":"awkweave-0001805-p1","original":"Calculate and print the sum of the integers in column 3.","paraphrase":"Compute and display the total sum of integers in column 3.","equivalent":true}
|
| 261 |
+
{"id":"awkweave-0012124-p1","original":"Find and print the longest input line; if tied, keep the earliest.","paraphrase":"Identify and output the longest line from the input; if multiple lines share the maximum length, select the one that appears earliest.","equivalent":true}
|
| 262 |
+
{"id":"awkweave-0045309-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 14.","paraphrase":"Skip the header row, then output the 'display_name' field for every record where the 'score' field is strictly greater than 14.","equivalent":true}
|
| 263 |
+
{"id":"awkweave-0013827-p1","original":"Convert column 1 to uppercase and print only that column.","paraphrase":"Transform the first column to uppercase and output only that column.","equivalent":true}
|
| 264 |
+
{"id":"awkweave-0005453-p1","original":"The input is simple comma-separated data with no quoted commas. Print column 1 when column 2 exceeds 13.","paraphrase":"Process simple comma-separated values without quoted fields, and print the first column only if the value in the second column is greater than 13.","equivalent":true}
|
| 265 |
+
{"id":"awkweave-0044627-p1","original":"Calculate and print the sum of the integers in column 2.","paraphrase":"Compute and display the total sum of integer values found in column 2.","equivalent":true}
|
| 266 |
+
{"id":"awkweave-0030349-p1","original":"Print lines 4 through 6, including both endpoints.","paraphrase":"Display lines 4 through 6, inclusive of both start and end lines.","equivalent":true}
|
| 267 |
+
{"id":"awkweave-0046619-p1","original":"Find and print the largest numeric value in column 2.","paraphrase":"Identify and print the maximum numeric value found in column 2.","equivalent":true}
|
| 268 |
+
{"id":"awkweave-0049154-p1","original":"Find and print the largest numeric value in column 1.","paraphrase":"Identify and output the maximum number found in the first column.","equivalent":true}
|
| 269 |
+
{"id":"awkweave-0036126-p1","original":"Print the arithmetic mean of column 2, rounded to exactly two decimal places.","paraphrase":"Print the average of the second column, rounded to two decimal places.","equivalent":true}
|
| 270 |
+
{"id":"awkweave-0015610-p1","original":"Count how many records have paused in column 2. Print 0 if there are none.","paraphrase":"Count the number of records where the second column is 'paused', printing 0 if none exist.","equivalent":true}
|
| 271 |
+
{"id":"awkweave-0033706-p1","original":"Count how many records have active in column 2. Print 0 if there are none.","paraphrase":"Output the count of records where column 2 is 'active', defaulting to 0 if no matches are found.","equivalent":true}
|
| 272 |
+
{"id":"awkweave-0004368-p1","original":"For each line, output fields 3 and 2, in that order.","paraphrase":"Output field 3 followed by field 2 for each line.","equivalent":true}
|
| 273 |
+
{"id":"awkweave-0041147-p1","original":"Print the complete records where column 3 is less than 74.","paraphrase":"Display full records where the value in column 3 is strictly less than 74.","equivalent":true}
|
| 274 |
+
{"id":"awkweave-0027154-p1","original":"Count how many records have active in column 2. Print 0 if there are none.","paraphrase":"Output the count of entries where column 2 is 'active', defaulting to 0 if no matches are found.","equivalent":true}
|
| 275 |
+
{"id":"awkweave-0009755-p1","original":"Print all fields from lines where field 1 begins with WARN.","paraphrase":"Output all fields from lines where the first field starts with 'WARN'.","equivalent":true}
|
| 276 |
+
{"id":"awkweave-0036667-p1","original":"Print lines 3 through 5, including both endpoints.","paraphrase":"Output lines 3 through 5, inclusive.","equivalent":true}
|
| 277 |
+
{"id":"awkweave-0025083-p1","original":"Print every line except those containing the exact text cobalt.","paraphrase":"Print every line that does not contain the exact string 'cobalt'.","equivalent":true}
|
| 278 |
+
{"id":"awkweave-0001851-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"For each entry, output column 1 alongside the cumulative sum of column 2, using a space as the delimiter.","equivalent":true}
|
| 279 |
+
{"id":"awkweave-0052717-p1","original":"Print each repeated value from column 1 with its number of occurrences, in first-appearance order.","paraphrase":"List each duplicate value from column 1 along with its frequency, ordered by first appearance.","equivalent":false}
|
| 280 |
+
{"id":"awkweave-0040609-p1","original":"Count how many records have active in column 2. Print 0 if there are none.","paraphrase":"Count the number of records where the second column is 'active', and output 0 if no such records exist.","equivalent":true}
|
| 281 |
+
{"id":"awkweave-0042485-p1","original":"Find and print the largest numeric value in column 3.","paraphrase":"Identify and output the maximum numerical value found in the third column.","equivalent":true}
|
| 282 |
+
{"id":"awkweave-0056320-p1","original":"Print column 4 only for rows where column 3 is exactly pending.","paraphrase":"Extract and print only the fourth column for rows where the third column equals pending.","equivalent":true}
|
| 283 |
+
{"id":"awkweave-0026628-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 10.","paraphrase":"Ignoring the header row, output the display_name field for any record where the score exceeds 10.","equivalent":true}
|
| 284 |
+
{"id":"awkweave-0001345-p1","original":"For every row, print field 1 followed by the sum of fields 2 and 3.","paraphrase":"For each row, display the first field followed by the total of the second and third fields.","equivalent":true}
|
| 285 |
+
{"id":"awkweave-0035068-p1","original":"Print lines 2 through 4, including both endpoints.","paraphrase":"Print lines 2 through 4, inclusive.","equivalent":true}
|
| 286 |
+
{"id":"awkweave-0026883-p1","original":"Print the arithmetic mean of column 3, rounded to exactly two decimal places.","paraphrase":"Calculate the average of the values in the third column and print it rounded to exactly two decimal places.","equivalent":true}
|
| 287 |
+
{"id":"awkweave-0018837-p1","original":"For each line, output fields 6 and 2, in that order.","paraphrase":"For every line, display field 6 followed by field 2.","equivalent":true}
|
| 288 |
+
{"id":"awkweave-0034250-p1","original":"Output only the first 3 records.","paraphrase":"Show only the initial 3 records.","equivalent":true}
|
| 289 |
+
{"id":"awkweave-0016869-p1","original":"Convert column 1 to uppercase and print only that column.","paraphrase":"Transform column 1 to uppercase letters and print only this transformed column.","equivalent":true}
|
| 290 |
+
{"id":"awkweave-0011509-p1","original":"Print column 1 only for rows where column 4 is exactly ready.","paraphrase":"Print only the first column for rows where the fourth column is exactly 'ready'.","equivalent":true}
|
| 291 |
+
{"id":"awkweave-0022855-p1","original":"Print the last field of every input line.","paraphrase":"Output the final field from each line of the input.","equivalent":true}
|
| 292 |
+
{"id":"awkweave-0054454-p1","original":"Count how many records have ready in column 2. Print 0 if there are none.","paraphrase":"Count the number of records containing 'ready' in the second column, outputting 0 if no matches are found.","equivalent":true}
|
| 293 |
+
{"id":"awkweave-0018720-p1","original":"For each line, output fields 5 and 1, in that order.","paraphrase":"For each line, print the fifth field followed by the first field.","equivalent":true}
|
| 294 |
+
{"id":"awkweave-0006100-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate exact duplicate lines while keeping the first instance and the original order.","equivalent":true}
|
| 295 |
+
{"id":"awkweave-0001224-p1","original":"Count all input records and print the total.","paraphrase":"Count the total number of input records and output the result.","equivalent":true}
|
| 296 |
+
{"id":"awkweave-0021685-p1","original":"Print the last field of every input line.","paraphrase":"Display the final field from each input line.","equivalent":true}
|
| 297 |
+
{"id":"awkweave-0030645-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 8.","paraphrase":"With the first line as a header, print the display_name column for data rows where the score is greater than 8.","equivalent":true}
|
| 298 |
+
{"id":"awkweave-0048988-p1","original":"Print column 1 only for rows where column 3 is exactly active.","paraphrase":"Output only the first column for rows where the third column contains exactly the string 'active'.","equivalent":true}
|
| 299 |
+
{"id":"awkweave-0054044-p1","original":"The first row is a header. Print the note column for every data row.","paraphrase":"Skip the header row and output the 'note' column for all remaining rows.","equivalent":true}
|
| 300 |
+
{"id":"awkweave-0004875-p1","original":"For each line, output fields 4 and 3, in that order.","paraphrase":"Display fields 4 and 3 from each line, preserving that specific order.","equivalent":true}
|
| 301 |
+
{"id":"awkweave-0046823-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores in column 1 with spaces and print the modified values.","equivalent":true}
|
| 302 |
+
{"id":"awkweave-0026025-p1","original":"Print the arithmetic mean of column 3, rounded to exactly two decimal places.","paraphrase":"Output the average of the values in column 3, formatted to exactly two decimal places.","equivalent":true}
|
| 303 |
+
{"id":"awkweave-0044680-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Display the count of whitespace-delimited fields present on each line.","equivalent":true}
|
| 304 |
+
{"id":"awkweave-0035270-p1","original":"Find and print the largest numeric value in column 1.","paraphrase":"Identify and output the maximum numeric value present in column 1.","equivalent":true}
|
| 305 |
+
{"id":"awkweave-0050156-p1","original":"Print the complete records where column 3 is at most 53.","paraphrase":"Display full records where the third column is less than or equal to 53.","equivalent":true}
|
| 306 |
+
{"id":"awkweave-0036323-p1","original":"Find and print the largest numeric value in column 3.","paraphrase":"Identify and display the maximum numeric value present in the third column.","equivalent":true}
|
| 307 |
+
{"id":"awkweave-0019624-p1","original":"Print lines 2 through 4, including both endpoints.","paraphrase":"Display lines 2 to 4, inclusive.","equivalent":true}
|
| 308 |
+
{"id":"awkweave-0059267-p1","original":"Count records for each value in column 2. Print each value and its count in order of first appearance.","paraphrase":"Tally records per value in column 2 and print each value with its count, ordered by first appearance.","equivalent":true}
|
| 309 |
+
{"id":"awkweave-0003571-p1","original":"From column 1, print 4 characters starting at character 1.","paraphrase":"Extract and print the first 4 characters from column 1, starting at position 1.","equivalent":true}
|
| 310 |
+
{"id":"awkweave-0014687-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores in column 1 with spaces and output the modified values.","equivalent":true}
|
| 311 |
+
{"id":"awkweave-0050070-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace and replace internal whitespace sequences with a single space.","equivalent":true}
|
| 312 |
+
{"id":"awkweave-0012540-p1","original":"Convert column 1 to uppercase and print only that column.","paraphrase":"Transform the text in column 1 to uppercase and output only that modified column.","equivalent":true}
|
| 313 |
+
{"id":"awkweave-0026953-p1","original":"Print column 4 only for rows where column 1 is exactly paused.","paraphrase":"Output only the fourth column for rows where the first column contains exactly the string 'paused'.","equivalent":true}
|
| 314 |
+
{"id":"awkweave-0011052-p1","original":"Count all input records and print the total.","paraphrase":"Determine the total number of input records and print this count.","equivalent":true}
|
| 315 |
+
{"id":"awkweave-0049488-p1","original":"Count the distinct values in column 2 and print only the count.","paraphrase":"Determine the number of unique values present in the second column and print only that total count.","equivalent":true}
|
| 316 |
+
{"id":"awkweave-0010212-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace, then replace any sequence of internal whitespace characters with a single space.","equivalent":true}
|
| 317 |
+
{"id":"awkweave-0020920-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate duplicate lines while keeping the first instance and maintaining the original sequence.","equivalent":true}
|
| 318 |
+
{"id":"awkweave-0029025-p1","original":"Skip the first line and print every remaining line unchanged.","paraphrase":"Omit the header line and output all subsequent lines exactly as they appear.","equivalent":true}
|
| 319 |
+
{"id":"awkweave-0021072-p1","original":"Print the arithmetic mean of column 3, rounded to exactly two decimal places.","paraphrase":"Output the average of the third column, formatted to two decimal places.","equivalent":true}
|
| 320 |
+
{"id":"awkweave-0057486-p1","original":"Print column 3 followed by column 1 for every record.","paraphrase":"For every record, output column 3 followed by column 1.","equivalent":true}
|
| 321 |
+
{"id":"awkweave-0024717-p1","original":"The first row is a header. Print display_name for data rows whose score is greater than 13.","paraphrase":"With the first row as a header, output the 'display_name' for data rows where the 'score' exceeds 13.","equivalent":true}
|
| 322 |
+
{"id":"awkweave-0024844-p1","original":"Print the last field of every input line.","paraphrase":"Display the final field of each input line.","equivalent":true}
|
| 323 |
+
{"id":"awkweave-0039741-p1","original":"Print column 4 followed by column 3 for every record.","paraphrase":"For every record, print the fourth column followed immediately by the third column.","equivalent":true}
|
| 324 |
+
{"id":"awkweave-0059504-p1","original":"The first row is a header. Print the record_id column for every data row.","paraphrase":"Treating the first row as a header, output the 'record_id' field for all remaining data rows.","equivalent":true}
|
| 325 |
+
{"id":"awkweave-0001537-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate exact duplicate lines while keeping the first instance and maintaining the original sequence.","equivalent":true}
|
| 326 |
+
{"id":"awkweave-0044843-p1","original":"The input is simple comma-separated data with no quoted commas. Print column 1 when column 2 exceeds 9.","paraphrase":"For simple comma-separated data without quoted commas, output column 1 if column 2 is greater than 9.","equivalent":true}
|
| 327 |
+
{"id":"awkweave-0056253-p1","original":"Count all input records and print the total.","paraphrase":"Count the total number of input records and print the result.","equivalent":true}
|
| 328 |
+
{"id":"awkweave-0031626-p1","original":"Count the distinct values in column 1 and print only the count.","paraphrase":"Calculate and display only the total number of unique values found in the first column.","equivalent":true}
|
| 329 |
+
{"id":"awkweave-0042964-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Output the count of whitespace-delimited fields for each line.","equivalent":true}
|
| 330 |
+
{"id":"awkweave-0009959-p1","original":"Find and print the largest numeric value in column 3.","paraphrase":"Identify and print the maximum numeric value present in column 3.","equivalent":true}
|
| 331 |
+
{"id":"awkweave-0018621-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"For every record, output the first column alongside the cumulative sum of the second column, separated by a space.","equivalent":true}
|
| 332 |
+
{"id":"awkweave-0043783-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Display the count of whitespace-delimited fields present on each line.","equivalent":true}
|
| 333 |
+
{"id":"awkweave-0017865-p1","original":"Show whole lines whose 2nd field is between 5 and 24, inclusive.","paraphrase":"Show entire lines where the second field falls within the inclusive range of 5 to 24.","equivalent":true}
|
| 334 |
+
{"id":"awkweave-0036470-p1","original":"Print all fields from lines where field 1 begins with ERROR.","paraphrase":"Output all fields from any line where the first field starts with the string 'ERROR'.","equivalent":true}
|
| 335 |
+
{"id":"awkweave-0053482-p1","original":"Find and print the smallest numeric value in column 1.","paraphrase":"Identify and print the minimum numeric value found in column 1.","equivalent":true}
|
| 336 |
+
{"id":"awkweave-0049010-p1","original":"Count records for each value in column 2. Print each value and its count in order of first appearance.","paraphrase":"Tally records for each unique value in the second column, printing the value and its count in the order of first appearance.","equivalent":true}
|
| 337 |
+
{"id":"awkweave-0057458-p1","original":"Calculate and print the sum of the integers in column 1.","paraphrase":"Compute and display the sum of integer values found in the first column.","equivalent":true}
|
| 338 |
+
{"id":"awkweave-0013385-p1","original":"Output only the first 2 records.","paraphrase":"Display only the first 2 records.","equivalent":true}
|
| 339 |
+
{"id":"awkweave-0058535-p1","original":"Print every 4th line starting at line 1 (then line 5, and so on).","paraphrase":"Output every fourth line, beginning with line 1 (i.e., lines 1, 5, 9, etc.).","equivalent":true}
|
| 340 |
+
{"id":"awkweave-0057207-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace from the text, and replace any sequence of internal whitespace characters with a single space.","equivalent":true}
|
| 341 |
+
{"id":"awkweave-0036973-p1","original":"Print the last field of every input line.","paraphrase":"Output the final field from each line of the input.","equivalent":true}
|
| 342 |
+
{"id":"awkweave-0009667-p1","original":"Find and print the longest input line; if tied, keep the earliest.","paraphrase":"Identify and output the longest line from the input; in case of a tie in length, select the one that appears earliest.","equivalent":true}
|
| 343 |
+
{"id":"awkweave-0019327-p1","original":"From column 1, print 4 characters starting at character 3.","paraphrase":"Extract and print a 4-character substring from the first column, starting at the third character.","equivalent":true}
|
| 344 |
+
{"id":"awkweave-0045341-p1","original":"Replace every underscore in column 1 with a space and print the resulting values.","paraphrase":"Substitute all underscores in the first column with spaces and print the modified values.","equivalent":true}
|
| 345 |
+
{"id":"awkweave-0051819-p1","original":"Sum column 3 for each category in column 2, printing groups in order of first appearance.","paraphrase":"Calculate the sum of column 3 grouped by each category in column 2, and print the results in the order the groups first appear.","equivalent":true}
|
| 346 |
+
{"id":"awkweave-0024930-p1","original":"Skip the first line and print every remaining line unchanged.","paraphrase":"Omit the initial line and output all subsequent lines exactly as they appear.","equivalent":true}
|
| 347 |
+
{"id":"awkweave-0055864-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate duplicate lines while keeping the first instance and maintaining the original sequence.","equivalent":true}
|
| 348 |
+
{"id":"awkweave-0055881-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace and replace sequences of internal whitespace with a single space.","equivalent":true}
|
| 349 |
+
{"id":"awkweave-0051140-p1","original":"Calculate and print the sum of the integers in column 3.","paraphrase":"Compute and display the sum of all integer values found in the third column.","equivalent":true}
|
| 350 |
+
{"id":"awkweave-0058274-p1","original":"Output only the first 5 records.","paraphrase":"Show only the initial 5 records.","equivalent":true}
|
| 351 |
+
{"id":"awkweave-0021689-p1","original":"Print all fields from lines where field 3 begins with INFO.","paraphrase":"Print all fields from lines where the third field starts with 'INFO'.","equivalent":true}
|
| 352 |
+
{"id":"awkweave-0007407-p1","original":"Count the distinct values in column 1 and print only the count.","paraphrase":"Calculate and print only the total number of unique values found in the first column.","equivalent":true}
|
| 353 |
+
{"id":"awkweave-0043809-p1","original":"Print the arithmetic mean of column 2, rounded to exactly two decimal places.","paraphrase":"Print the average of column 2, rounded to exactly two decimal places.","equivalent":true}
|
| 354 |
+
{"id":"awkweave-0012458-p1","original":"Keep only the first line for each distinct value in column 3; preserve input order.","paraphrase":"Retain only the first occurrence for each unique value in column 3, keeping the original order.","equivalent":true}
|
| 355 |
+
{"id":"awkweave-0049356-p1","original":"Convert column 2 to uppercase and print only that column.","paraphrase":"Transform the second column to uppercase and display only that column.","equivalent":true}
|
| 356 |
+
{"id":"awkweave-0008585-p1","original":"Print all fields from lines where field 2 begins with INFO.","paraphrase":"Output all fields from lines where the second field starts with 'INFO'.","equivalent":true}
|
| 357 |
+
{"id":"awkweave-0014818-p1","original":"For each row, print column 1 and column 2 divided by column 3 to two decimal places; skip rows where column 3 is zero.","paraphrase":"For each row where the third column is non-zero, print the first column and the result of dividing the second column by the third, formatted to two decimal places.","equivalent":true}
|
| 358 |
+
{"id":"awkweave-0009003-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace from each line and replace sequences of internal whitespace with a single space.","equivalent":true}
|
| 359 |
+
{"id":"awkweave-0045640-p1","original":"Count how many records have ready in column 2. Print 0 if there are none.","paraphrase":"Determine the number of records where column 2 is ready. Output 0 if no such records exist.","equivalent":true}
|
| 360 |
+
{"id":"awkweave-0029671-p1","original":"The input is tab-separated. Print column 3 from every record.","paraphrase":"Given tab-separated input, output the third column for every record.","equivalent":true}
|
| 361 |
+
{"id":"awkweave-0043814-p1","original":"Keep only the first line for each distinct value in column 1; preserve input order.","paraphrase":"Retain only the initial line for every unique value in column 1, preserving the input order.","equivalent":true}
|
| 362 |
+
{"id":"awkweave-0056369-p1","original":"Find and print the largest numeric value in column 3.","paraphrase":"Identify and display the maximum numeric value present in the third column.","equivalent":true}
|
| 363 |
+
{"id":"awkweave-0050385-p1","original":"Count the distinct values in column 2 and print only the count.","paraphrase":"Calculate and print the total number of unique values found in the second column.","equivalent":true}
|
| 364 |
+
{"id":"awkweave-0054611-p1","original":"Calculate and print the sum of the integers in column 2.","paraphrase":"Compute and display the total sum of integer values found in the second column.","equivalent":true}
|
| 365 |
+
{"id":"awkweave-0042784-p1","original":"Print the last field of every input line.","paraphrase":"Output the final field from each line of input.","equivalent":true}
|
| 366 |
+
{"id":"awkweave-0032628-p1","original":"Reverse the order of fields on every line and print all fields.","paraphrase":"Reverse the field order for each line and print all fields.","equivalent":true}
|
| 367 |
+
{"id":"awkweave-0054143-p1","original":"Calculate and print the sum of the integers in column 2.","paraphrase":"Compute and display the total sum of all integer values found in the second column.","equivalent":true}
|
| 368 |
+
{"id":"awkweave-0053786-p1","original":"Print all fields from lines where field 1 begins with ERROR.","paraphrase":"Print all fields from lines where the first field starts with the string 'ERROR'.","equivalent":true}
|
| 369 |
+
{"id":"awkweave-0051574-p1","original":"Remove exact duplicate lines, preserving the first occurrence and original order.","paraphrase":"Eliminate exact duplicate lines while keeping the first instance and maintaining the original sequence.","equivalent":true}
|
| 370 |
+
{"id":"awkweave-0049221-p1","original":"Show whole lines whose 1st field is between 8 and 29, inclusive.","paraphrase":"Display entire lines where the first field falls within the inclusive range of 8 to 29.","equivalent":true}
|
| 371 |
+
{"id":"awkweave-0008968-p1","original":"For each row, print column 1 and column 2 divided by column 3 to two decimal places; skip rows where column 3 is zero.","paraphrase":"For each record, output the first column and the result of dividing the second column by the third, rounded to two decimal places, while omitting any rows where the third column is zero.","equivalent":true}
|
| 372 |
+
{"id":"awkweave-0018684-p1","original":"Show whole lines whose 3rd field is between 3 and 26, inclusive.","paraphrase":"Display entire lines where the third field falls within the inclusive range of 3 to 26.","equivalent":true}
|
| 373 |
+
{"id":"awkweave-0032777-p1","original":"Keep only the first line for each distinct value in column 1; preserve input order.","paraphrase":"Retain only the first occurrence of each unique value in column 1, preserving the original input order.","equivalent":true}
|
| 374 |
+
{"id":"awkweave-0040255-p1","original":"Print lines 4 through 6, including both endpoints.","paraphrase":"Print lines 4, 5, and 6.","equivalent":true}
|
| 375 |
+
{"id":"awkweave-0032682-p1","original":"Select the 2nd and 1st fields in that order.","paraphrase":"Reorder the fields by selecting the second field followed by the first field.","equivalent":true}
|
| 376 |
+
{"id":"awkweave-0007118-p1","original":"Print column 1 and pass when column 2 is at least 22; otherwise print fail.","paraphrase":"Output column 1; if column 2 is 22 or higher, print pass, else print fail.","equivalent":true}
|
| 377 |
+
{"id":"awkweave-0048401-p1","original":"Print the complete records where column 2 is at least 65.","paraphrase":"Display full records where the value in the second column is greater than or equal to 65.","equivalent":true}
|
| 378 |
+
{"id":"awkweave-0040722-p1","original":"Print every line except those containing the exact text juniper.","paraphrase":"Print every line that does not contain the exact string juniper.","equivalent":true}
|
| 379 |
+
{"id":"awkweave-0022548-p1","original":"Print every line except those containing the exact text harbor.","paraphrase":"Output every line that does not contain the exact string 'harbor'.","equivalent":false}
|
| 380 |
+
{"id":"awkweave-0014275-p1","original":"Print the last field of every input line.","paraphrase":"Output the final field from every line of input.","equivalent":true}
|
| 381 |
+
{"id":"awkweave-0001281-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace, and replace internal whitespace sequences with a single space.","equivalent":true}
|
| 382 |
+
{"id":"awkweave-0058279-p1","original":"Find and print the smallest numeric value in column 3.","paraphrase":"Identify and output the minimum numeric value found in column 3.","equivalent":true}
|
| 383 |
+
{"id":"awkweave-0041886-p1","original":"Select the 2nd and 1st fields in that order.","paraphrase":"Extract and output the second field followed by the first field.","equivalent":true}
|
| 384 |
+
{"id":"awkweave-0037372-p1","original":"Count how many records have ready in column 2. Print 0 if there are none.","paraphrase":"Count the number of records with 'ready' in the second column; output 0 if none exist.","equivalent":true}
|
| 385 |
+
{"id":"awkweave-0020510-p1","original":"Print every 4th line starting at line 4 (then line 8, and so on).","paraphrase":"Output every fourth line, beginning with line 4 (i.e., lines 4, 8, 12, etc.).","equivalent":true}
|
| 386 |
+
{"id":"awkweave-0007871-p1","original":"The input is simple comma-separated data with no quoted commas. Print column 1 when column 2 exceeds 13.","paraphrase":"For simple comma-separated input without quoted commas, print the first column if the second column value is greater than 13.","equivalent":true}
|
| 387 |
+
{"id":"awkweave-0028885-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Display the count of whitespace-delimited fields for every line.","equivalent":true}
|
| 388 |
+
{"id":"awkweave-0027585-p1","original":"Print the arithmetic mean of column 3, rounded to exactly two decimal places.","paraphrase":"Calculate the average of column 3 and format it to exactly two decimal places.","equivalent":true}
|
| 389 |
+
{"id":"awkweave-0017639-p1","original":"Calculate and print the sum of the integers in column 3.","paraphrase":"Compute and display the total sum of integer values found in column 3.","equivalent":true}
|
| 390 |
+
{"id":"awkweave-0031948-p1","original":"Print lines 3 through 6, including both endpoints.","paraphrase":"Output lines 3 through 6, inclusive of both the start and end lines.","equivalent":true}
|
| 391 |
+
{"id":"awkweave-0057459-p1","original":"Print the arithmetic mean of column 2, rounded to exactly two decimal places.","paraphrase":"Calculate and print the average of the second column, rounded to precisely two decimal places.","equivalent":true}
|
| 392 |
+
{"id":"awkweave-0048967-p1","original":"From column 1, print 3 characters starting at character 3.","paraphrase":"Extract and print a 3-character substring from column 1, beginning at the third character.","equivalent":true}
|
| 393 |
+
{"id":"awkweave-0024455-p1","original":"Print the complete records where column 2 is greater than 59.","paraphrase":"Output the full records for which the value in column 2 exceeds 59.","equivalent":true}
|
| 394 |
+
{"id":"awkweave-0050289-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"For each entry, output the first column alongside the cumulative sum of the second column, using a space as the delimiter.","equivalent":true}
|
| 395 |
+
{"id":"awkweave-0037415-p1","original":"Find and print the largest numeric value in column 2.","paraphrase":"Identify and display the maximum numeric value present in the second column.","equivalent":true}
|
| 396 |
+
{"id":"awkweave-0011751-p1","original":"Print the arithmetic mean of column 2, rounded to exactly two decimal places.","paraphrase":"Print the average of the second column, rounded to exactly two decimal places.","equivalent":true}
|
| 397 |
+
{"id":"awkweave-0019588-p1","original":"Count how many records have ready in column 2. Print 0 if there are none.","paraphrase":"Count the number of records where the second column is 'ready', outputting 0 if no such records exist.","equivalent":true}
|
| 398 |
+
{"id":"awkweave-0043339-p1","original":"Count how many records have paused in column 2. Print 0 if there are none.","paraphrase":"Count the number of records where column 2 contains paused; output 0 if no such records exist.","equivalent":true}
|
| 399 |
+
{"id":"awkweave-0002037-p1","original":"Skip the first line and print every remaining line unchanged.","paraphrase":"Omit the header line and output all subsequent lines exactly as they appear.","equivalent":false}
|
| 400 |
+
{"id":"awkweave-0051388-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Output the count of whitespace-delimited fields for each line.","equivalent":true}
|
| 401 |
+
{"id":"awkweave-0043549-p1","original":"Print the number of whitespace-separated fields on each line.","paraphrase":"Display the count of whitespace-delimited fields present on each line.","equivalent":true}
|
| 402 |
+
{"id":"awkweave-0002922-p1","original":"Count the distinct values in column 1 and print only the count.","paraphrase":"Calculate and output only the total number of unique values found in the first column.","equivalent":true}
|
| 403 |
+
{"id":"awkweave-0037928-p1","original":"Print column 1 and pass when column 2 is at least 22; otherwise print fail.","paraphrase":"Print column 1 with 'pass' if column 2 is 22 or greater, otherwise print 'fail'.","equivalent":true}
|
| 404 |
+
{"id":"awkweave-0036739-p1","original":"Print the last field of every input line.","paraphrase":"Print the final field from each input line.","equivalent":true}
|
| 405 |
+
{"id":"awkweave-0007349-p1","original":"Keep only the first line for each distinct value in column 3; preserve input order.","paraphrase":"Retain only the first occurrence for each unique value in the third column, preserving the original input sequence.","equivalent":true}
|
| 406 |
+
{"id":"awkweave-0009341-p1","original":"Print column 1 and pass when column 2 is at least 21; otherwise print fail.","paraphrase":"Display column 1 and output 'pass' if column 2 is 21 or greater; otherwise, output 'fail'.","equivalent":true}
|
| 407 |
+
{"id":"awkweave-0040678-p1","original":"Print the last field of every input line.","paraphrase":"Print the final field from each input line.","equivalent":true}
|
| 408 |
+
{"id":"awkweave-0052373-p1","original":"Print every 2nd line starting at line 1 (then line 3, and so on).","paraphrase":"Output every other line, beginning with the first line (i.e., lines 1, 3, 5, etc.).","equivalent":true}
|
| 409 |
+
{"id":"awkweave-0023947-p1","original":"Print the last field of every input line.","paraphrase":"Output the final field from every line of input.","equivalent":true}
|
| 410 |
+
{"id":"awkweave-0040344-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"Output the first column alongside the cumulative total of the second column, with values separated by a space.","equivalent":true}
|
| 411 |
+
{"id":"awkweave-0001539-p1","original":"For each record, print column 1 and the running sum of column 2, separated by a space.","paraphrase":"For every record, output column 1 alongside the cumulative sum of column 2, separated by a space.","equivalent":true}
|
| 412 |
+
{"id":"awkweave-0059908-p1","original":"Print column 4 only for rows where column 2 is exactly failed.","paraphrase":"Extract and print only the fourth column for rows where the second column equals 'failed'.","equivalent":true}
|
| 413 |
+
{"id":"awkweave-0003146-p1","original":"Count records for each value in column 2. Print each value and its count in order of first appearance.","paraphrase":"Tally records per unique value in column 2, listing each value and its total in the order they first appear.","equivalent":true}
|
| 414 |
+
{"id":"awkweave-0047925-p1","original":"Trim leading and trailing whitespace and collapse internal whitespace to single spaces.","paraphrase":"Remove leading and trailing whitespace from the input, and replace any sequence of internal whitespace characters with a single space.","equivalent":true}
|
| 415 |
+
{"id":"awkweave-0001220-p1","original":"Calculate and print the sum of the integers in column 3.","paraphrase":"Compute and display the sum of integer values in the third column.","equivalent":true}
|
| 416 |
+
{"id":"awkweave-0053167-p1","original":"Count how many records have ready in column 2. Print 0 if there are none.","paraphrase":"Determine the number of entries where the second column contains 'ready', outputting 0 if no such entries exist.","equivalent":true}
|
| 417 |
+
{"id":"awkweave-0014629-p1","original":"Print column 3 only for rows where column 1 is exactly closed.","paraphrase":"Output only column 3 for rows where column 1 contains exactly the text 'closed'.","equivalent":true}
|
| 418 |
+
{"id":"awkweave-0028407-p1","original":"Count all input records and print the total.","paraphrase":"Count the total number of input records and print the result.","equivalent":true}
|
| 419 |
+
{"id":"awkweave-0028810-p1","original":"Print each repeated value from column 1 with its number of occurrences, in first-appearance order.","paraphrase":"List each duplicate value from the first column along with its occurrence count, ordered by when they first appeared.","equivalent":true}
|
| 420 |
+
{"id":"awkweave-0028089-p1","original":"Skip the first line and print every remaining line unchanged.","paraphrase":"Omit the first line and print all subsequent lines without modification.","equivalent":true}
|
paraphrase-audit.summary.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "qwen/qwen3.5-9b",
|
| 3 |
+
"seed": 20261128,
|
| 4 |
+
"rows": 420,
|
| 5 |
+
"requested": 500,
|
| 6 |
+
"missing": 80,
|
| 7 |
+
"equivalent": 414,
|
| 8 |
+
"disputed": 6,
|
| 9 |
+
"audit_file": "paraphrase-audit.jsonl"
|
| 10 |
+
}
|
paraphrase_data.py
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import concurrent.futures
|
| 5 |
+
import json
|
| 6 |
+
import os
|
| 7 |
+
import re
|
| 8 |
+
import time
|
| 9 |
+
import urllib.error
|
| 10 |
+
import urllib.request
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
MODEL = "qwen/qwen3.7-plus"
|
| 14 |
+
NUMBER_PATTERN = re.compile(r"(?<![A-Za-z_])\d+(?:\.\d+)?(?![A-Za-z_])")
|
| 15 |
+
LITERAL_PATTERN = re.compile(r'"([^"\n]+)"')
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def literals_to_preserve(row: dict) -> list[str]:
|
| 19 |
+
values = []
|
| 20 |
+
for value in LITERAL_PATTERN.findall(row["program"]):
|
| 21 |
+
if "\\" in value or "%" in value or value in {" ", ",", "\\t"}:
|
| 22 |
+
continue
|
| 23 |
+
if len(value) >= 2:
|
| 24 |
+
values.append(value)
|
| 25 |
+
values.extend(re.findall(r"/\^?([A-Z][A-Z0-9 _-]{1,})/", row["program"]))
|
| 26 |
+
return sorted(set(values))
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def number_aliases(number: int) -> set[str]:
|
| 30 |
+
units = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
|
| 31 |
+
teens = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
|
| 32 |
+
tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
|
| 33 |
+
if number < 10:
|
| 34 |
+
words = units[number]
|
| 35 |
+
elif number < 20:
|
| 36 |
+
words = teens[number - 10]
|
| 37 |
+
elif number < 100:
|
| 38 |
+
words = tens[number // 10] + ("-" + units[number % 10] if number % 10 else "")
|
| 39 |
+
elif number < 120:
|
| 40 |
+
remainder = number % 100
|
| 41 |
+
tail = units[remainder] if remainder < 10 else teens[remainder - 10]
|
| 42 |
+
words = "one hundred" + (" " + tail if remainder else "")
|
| 43 |
+
else:
|
| 44 |
+
words = str(number)
|
| 45 |
+
ordinals = {
|
| 46 |
+
0: "zeroth", 1: "first", 2: "second", 3: "third", 4: "fourth",
|
| 47 |
+
5: "fifth", 6: "sixth", 7: "seventh", 8: "eighth", 9: "ninth",
|
| 48 |
+
10: "tenth", 11: "eleventh", 12: "twelfth", 13: "thirteenth",
|
| 49 |
+
14: "fourteenth", 15: "fifteenth", 16: "sixteenth", 17: "seventeenth",
|
| 50 |
+
18: "eighteenth", 19: "nineteenth", 20: "twentieth", 30: "thirtieth",
|
| 51 |
+
40: "fortieth", 50: "fiftieth",
|
| 52 |
+
60: "sixtieth", 70: "seventieth", 80: "eightieth", 90: "ninetieth",
|
| 53 |
+
100: "one hundredth",
|
| 54 |
+
}
|
| 55 |
+
if number in ordinals:
|
| 56 |
+
ordinal = ordinals[number]
|
| 57 |
+
elif number < 100:
|
| 58 |
+
ordinal = tens[number // 10] + "-" + ordinals[number % 10]
|
| 59 |
+
else:
|
| 60 |
+
ordinal = str(number)
|
| 61 |
+
return {str(number), words, words.replace("-", " "), ordinal, ordinal.replace("-", " ")}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def valid_paraphrase(original: str, paraphrase: str, row: dict) -> bool:
|
| 65 |
+
paraphrase = paraphrase.strip()
|
| 66 |
+
if not 10 <= len(paraphrase) <= 400 or paraphrase == original.strip():
|
| 67 |
+
return False
|
| 68 |
+
if "\n" in paraphrase or "```" in paraphrase:
|
| 69 |
+
return False
|
| 70 |
+
lowered = paraphrase.lower()
|
| 71 |
+
for value in set(NUMBER_PATTERN.findall(original)):
|
| 72 |
+
aliases = number_aliases(int(value)) if value.isdigit() else {value}
|
| 73 |
+
if not any(re.search(r"(?<![a-z0-9])" + re.escape(alias) + r"(?![a-z0-9])", lowered) for alias in aliases):
|
| 74 |
+
return False
|
| 75 |
+
if any(value not in paraphrase for value in literals_to_preserve(row)):
|
| 76 |
+
return False
|
| 77 |
+
for marker in ("comma-separated", "tab-separated", "first appearance", "two decimal places"):
|
| 78 |
+
if marker in original.lower() and marker not in lowered:
|
| 79 |
+
synonyms = {
|
| 80 |
+
"comma-separated": ("comma separated", "csv"),
|
| 81 |
+
"tab-separated": ("tab separated", "tsv"),
|
| 82 |
+
"first appearance": ("first appear", "order in which", "order they appear"),
|
| 83 |
+
"two decimal places": ("2 decimal places", "two decimals"),
|
| 84 |
+
}
|
| 85 |
+
if not any(term in lowered for term in synonyms[marker]):
|
| 86 |
+
return False
|
| 87 |
+
return True
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def request_batch(batch: list[dict], timeout: int = 120) -> list[str]:
|
| 91 |
+
payload = {
|
| 92 |
+
"model": MODEL,
|
| 93 |
+
"messages": [
|
| 94 |
+
{
|
| 95 |
+
"role": "system",
|
| 96 |
+
"content": (
|
| 97 |
+
"You paraphrase technical text-processing requests. Return only valid JSON. "
|
| 98 |
+
"Preserve the exact operation, every numeric value as an Arabic numeral, all field "
|
| 99 |
+
"positions and names, literal values, input separator, output formatting, ordering, "
|
| 100 |
+
"and tie-breaking requirements. Do not add or remove constraints. Keep each request "
|
| 101 |
+
"concise and natural, and vary sentence structure. Keep every numeric value unchanged."
|
| 102 |
+
),
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"role": "user",
|
| 106 |
+
"content": "Return {\"paraphrases\": [...]} with exactly one paraphrase per numbered input, in order.\n"
|
| 107 |
+
+ "\n".join(f"{index}. {row['request']}" for index, row in enumerate(batch, 1)),
|
| 108 |
+
},
|
| 109 |
+
],
|
| 110 |
+
"response_format": {"type": "json_object"},
|
| 111 |
+
"temperature": 0.85,
|
| 112 |
+
"max_tokens": 3000,
|
| 113 |
+
"reasoning": {"enabled": False},
|
| 114 |
+
}
|
| 115 |
+
base_url = os.environ["OPENROUTER_BASE_URL"].rstrip("/")
|
| 116 |
+
request = urllib.request.Request(
|
| 117 |
+
base_url + "/chat/completions",
|
| 118 |
+
data=json.dumps(payload).encode("utf-8"),
|
| 119 |
+
headers={
|
| 120 |
+
"Authorization": "Bearer " + os.environ["OPENROUTER_API_KEY"],
|
| 121 |
+
"Content-Type": "application/json",
|
| 122 |
+
},
|
| 123 |
+
)
|
| 124 |
+
for attempt in range(4):
|
| 125 |
+
try:
|
| 126 |
+
with urllib.request.urlopen(request, timeout=timeout) as response:
|
| 127 |
+
data = json.load(response)
|
| 128 |
+
content = data["choices"][0]["message"]["content"]
|
| 129 |
+
parsed = json.loads(content)
|
| 130 |
+
paraphrases = parsed["paraphrases"]
|
| 131 |
+
if not isinstance(paraphrases, list) or len(paraphrases) != len(batch):
|
| 132 |
+
raise ValueError("Wrong paraphrase count")
|
| 133 |
+
return [str(value).strip() for value in paraphrases]
|
| 134 |
+
except (urllib.error.URLError, urllib.error.HTTPError, KeyError, ValueError, json.JSONDecodeError) as error:
|
| 135 |
+
if attempt == 3:
|
| 136 |
+
raise RuntimeError(f"Paraphrase request failed after retries: {error}") from error
|
| 137 |
+
time.sleep(2 ** attempt)
|
| 138 |
+
raise AssertionError("unreachable")
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def main() -> None:
|
| 142 |
+
parser = argparse.ArgumentParser()
|
| 143 |
+
parser.add_argument("input", type=Path)
|
| 144 |
+
parser.add_argument("output", type=Path)
|
| 145 |
+
parser.add_argument("--batch-size", type=int, default=12)
|
| 146 |
+
parser.add_argument("--workers", type=int, default=16)
|
| 147 |
+
parser.add_argument("--limit", type=int)
|
| 148 |
+
args = parser.parse_args()
|
| 149 |
+
|
| 150 |
+
rows = [json.loads(line) for line in args.input.open(encoding="utf-8")]
|
| 151 |
+
rows.sort(key=lambda row: row["id"])
|
| 152 |
+
eligible = [row for row in rows if row["split"] == "train"]
|
| 153 |
+
if args.limit:
|
| 154 |
+
eligible = eligible[: args.limit]
|
| 155 |
+
|
| 156 |
+
existing_paraphrases = {}
|
| 157 |
+
if args.output.exists():
|
| 158 |
+
for line in args.output.open(encoding="utf-8"):
|
| 159 |
+
row = json.loads(line)
|
| 160 |
+
if row.get("paraphrase_of"):
|
| 161 |
+
existing_paraphrases[row["paraphrase_of"]] = row
|
| 162 |
+
batches = [eligible[index:index + args.batch_size] for index in range(0, len(eligible), args.batch_size)]
|
| 163 |
+
batches = [batch for batch in batches if any(row["id"] not in existing_paraphrases for row in batch)]
|
| 164 |
+
|
| 165 |
+
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 166 |
+
with args.output.open("w", encoding="utf-8") as handle:
|
| 167 |
+
for row in rows:
|
| 168 |
+
handle.write(json.dumps(row, ensure_ascii=False, separators=(",", ":")) + "\n")
|
| 169 |
+
for row in existing_paraphrases.values():
|
| 170 |
+
handle.write(json.dumps(row, ensure_ascii=False, separators=(",", ":")) + "\n")
|
| 171 |
+
|
| 172 |
+
accepted = 0
|
| 173 |
+
fallback = 0
|
| 174 |
+
completed = 0
|
| 175 |
+
with concurrent.futures.ThreadPoolExecutor(max_workers=args.workers) as executor:
|
| 176 |
+
futures = {executor.submit(request_batch, batch): batch for batch in batches}
|
| 177 |
+
for future in concurrent.futures.as_completed(futures):
|
| 178 |
+
batch = futures[future]
|
| 179 |
+
try:
|
| 180 |
+
paraphrases = future.result()
|
| 181 |
+
except Exception as error:
|
| 182 |
+
print(f"batch failed; retaining originals: {error}", flush=True)
|
| 183 |
+
paraphrases = [row["request"] for row in batch]
|
| 184 |
+
new_rows = []
|
| 185 |
+
for row, paraphrase in zip(batch, paraphrases):
|
| 186 |
+
if row["id"] in existing_paraphrases:
|
| 187 |
+
continue
|
| 188 |
+
new_row = dict(row)
|
| 189 |
+
new_row["id"] = row["id"] + "-p1"
|
| 190 |
+
new_row["paraphrase_of"] = row["id"]
|
| 191 |
+
new_row["paraphrase_model"] = MODEL
|
| 192 |
+
if valid_paraphrase(row["request"], paraphrase, row):
|
| 193 |
+
new_row["request"] = paraphrase
|
| 194 |
+
new_row["source"] = "openrouter-paraphrase"
|
| 195 |
+
accepted += 1
|
| 196 |
+
else:
|
| 197 |
+
new_row["source"] = "original-grammar-copy"
|
| 198 |
+
fallback += 1
|
| 199 |
+
new_rows.append(new_row)
|
| 200 |
+
with args.output.open("a", encoding="utf-8") as handle:
|
| 201 |
+
for row in new_rows:
|
| 202 |
+
handle.write(json.dumps(row, ensure_ascii=False, separators=(",", ":")) + "\n")
|
| 203 |
+
completed += len(batch)
|
| 204 |
+
if completed % 240 == 0 or completed == len(eligible):
|
| 205 |
+
print(f"paraphrased {completed}/{len(eligible)}; accepted={accepted}; guarded={fallback}", flush=True)
|
| 206 |
+
print(f"wrote {len(rows) + len(eligible)} rows to {args.output}; accepted={accepted}; guarded={fallback}")
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
if __name__ == "__main__":
|
| 210 |
+
main()
|
validate_dataset.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import collections
|
| 5 |
+
import concurrent.futures
|
| 6 |
+
import hashlib
|
| 7 |
+
import json
|
| 8 |
+
import shutil
|
| 9 |
+
import subprocess
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
from awkweave.execution import run_awk
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def awk_version() -> str:
|
| 16 |
+
executable = shutil.which("awk")
|
| 17 |
+
if executable is None:
|
| 18 |
+
return "awk unavailable"
|
| 19 |
+
for arguments in (["-W", "version"], ["--version"]):
|
| 20 |
+
result = subprocess.run([executable, *arguments], capture_output=True, text=True, check=False)
|
| 21 |
+
output = (result.stdout or result.stderr).strip().splitlines()
|
| 22 |
+
if result.returncode == 0 and output:
|
| 23 |
+
return output[0]
|
| 24 |
+
return "unknown awk"
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def validate_row(row: dict) -> tuple[str, str | None]:
|
| 28 |
+
try:
|
| 29 |
+
if run_awk(row["program"], row["input_text"]) != row["expected_output"]:
|
| 30 |
+
return row["id"], "primary output mismatch"
|
| 31 |
+
if run_awk(row["program"], row["validation_input"]) != row["validation_output"]:
|
| 32 |
+
return row["id"], "validation output mismatch"
|
| 33 |
+
return row["id"], None
|
| 34 |
+
except Exception as error:
|
| 35 |
+
return row["id"], str(error)[:500]
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def main() -> None:
|
| 39 |
+
parser = argparse.ArgumentParser()
|
| 40 |
+
parser.add_argument("data", type=Path)
|
| 41 |
+
parser.add_argument("--workers", type=int, default=8)
|
| 42 |
+
parser.add_argument("--output", type=Path)
|
| 43 |
+
args = parser.parse_args()
|
| 44 |
+
rows = [json.loads(line) for line in args.data.open(encoding="utf-8")]
|
| 45 |
+
ids = [row["id"] for row in rows]
|
| 46 |
+
if len(ids) != len(set(ids)):
|
| 47 |
+
raise ValueError("Duplicate row IDs")
|
| 48 |
+
by_id = {row["id"]: row for row in rows}
|
| 49 |
+
for row in rows:
|
| 50 |
+
if row.get("paraphrase_of"):
|
| 51 |
+
original = by_id.get(row["paraphrase_of"])
|
| 52 |
+
if original is None:
|
| 53 |
+
raise ValueError(f"Missing paraphrase source: {row['id']}")
|
| 54 |
+
for key in ("program", "input_text", "expected_output", "validation_input", "validation_output", "split"):
|
| 55 |
+
if row[key] != original[key]:
|
| 56 |
+
raise ValueError(f"Paraphrase changed {key}: {row['id']}")
|
| 57 |
+
if row["split"] != "train":
|
| 58 |
+
raise ValueError(f"Paraphrase outside train split: {row['id']}")
|
| 59 |
+
|
| 60 |
+
errors = []
|
| 61 |
+
with concurrent.futures.ProcessPoolExecutor(max_workers=args.workers) as executor:
|
| 62 |
+
for completed, (row_id, error) in enumerate(executor.map(validate_row, rows, chunksize=20), 1):
|
| 63 |
+
if error:
|
| 64 |
+
errors.append({"id": row_id, "error": error})
|
| 65 |
+
if completed % 5000 == 0:
|
| 66 |
+
print(f"validated {completed}/{len(rows)}", flush=True)
|
| 67 |
+
split_integrity = {}
|
| 68 |
+
for left, right in (
|
| 69 |
+
("train", "validation"), ("train", "test"), ("validation", "test"),
|
| 70 |
+
("train", "challenge"), ("validation", "challenge"), ("test", "challenge"),
|
| 71 |
+
):
|
| 72 |
+
left_rows = [row for row in rows if row["split"] == left and not row.get("paraphrase_of")]
|
| 73 |
+
right_rows = [row for row in rows if row["split"] == right and not row.get("paraphrase_of")]
|
| 74 |
+
split_integrity[f"{left}-{right}"] = {
|
| 75 |
+
"input_overlap": len({row["input_text"] for row in left_rows} & {row["input_text"] for row in right_rows}),
|
| 76 |
+
"request_program_overlap": len(
|
| 77 |
+
{(row["request"], row["program"]) for row in left_rows}
|
| 78 |
+
& {(row["request"], row["program"]) for row in right_rows}
|
| 79 |
+
),
|
| 80 |
+
}
|
| 81 |
+
summary = {
|
| 82 |
+
"data": str(args.data),
|
| 83 |
+
"sha256": hashlib.sha256(args.data.read_bytes()).hexdigest(),
|
| 84 |
+
"rows": len(rows),
|
| 85 |
+
"executions": len(rows) * 2,
|
| 86 |
+
"awk_version": awk_version(),
|
| 87 |
+
"errors": errors,
|
| 88 |
+
"splits": dict(collections.Counter(row["split"] for row in rows)),
|
| 89 |
+
"sources": dict(collections.Counter(row["source"] for row in rows)),
|
| 90 |
+
"families": dict(collections.Counter(row["family"] for row in rows)),
|
| 91 |
+
"unique_requests": len({row["request"] for row in rows}),
|
| 92 |
+
"unique_programs": len({row["program"] for row in rows}),
|
| 93 |
+
"split_integrity": split_integrity,
|
| 94 |
+
}
|
| 95 |
+
text = json.dumps(summary, indent=2)
|
| 96 |
+
if args.output:
|
| 97 |
+
args.output.write_text(text, encoding="utf-8")
|
| 98 |
+
print(text)
|
| 99 |
+
if errors:
|
| 100 |
+
raise SystemExit(1)
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
if __name__ == "__main__":
|
| 104 |
+
main()
|
validation.json
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"data": "awkweave-release.jsonl",
|
| 3 |
+
"sha256": "cb638fc2d41eb592229aed9c069d212601df76535341aadc084b5fe14411e57f",
|
| 4 |
+
"rows": 114027,
|
| 5 |
+
"executions": 228054,
|
| 6 |
+
"awk_version": "mawk 1.3.4 20200120",
|
| 7 |
+
"errors": [],
|
| 8 |
+
"splits": {
|
| 9 |
+
"train": 107994,
|
| 10 |
+
"validation": 3000,
|
| 11 |
+
"test": 3000,
|
| 12 |
+
"challenge": 33
|
| 13 |
+
},
|
| 14 |
+
"sources": {
|
| 15 |
+
"original-grammar": 60000,
|
| 16 |
+
"openrouter-paraphrase": 52642,
|
| 17 |
+
"original-grammar-copy": 1352,
|
| 18 |
+
"original-hand-authored": 33
|
| 19 |
+
},
|
| 20 |
+
"families": {
|
| 21 |
+
"project_fields": 2924,
|
| 22 |
+
"last_field": 2924,
|
| 23 |
+
"numeric_filter": 2924,
|
| 24 |
+
"numeric_range": 2924,
|
| 25 |
+
"string_filter": 2924,
|
| 26 |
+
"regex_filter": 2924,
|
| 27 |
+
"exclude_regex": 2923,
|
| 28 |
+
"line_range": 2924,
|
| 29 |
+
"first_n": 2924,
|
| 30 |
+
"skip_header": 2923,
|
| 31 |
+
"count_matches": 2923,
|
| 32 |
+
"sum_field": 2924,
|
| 33 |
+
"average_field": 2923,
|
| 34 |
+
"min_field": 2924,
|
| 35 |
+
"max_field": 2924,
|
| 36 |
+
"count_records": 2924,
|
| 37 |
+
"dedup_lines": 2924,
|
| 38 |
+
"dedup_field": 2923,
|
| 39 |
+
"running_total": 2922,
|
| 40 |
+
"computed_field": 2922,
|
| 41 |
+
"conditional_label": 2922,
|
| 42 |
+
"uppercase": 2922,
|
| 43 |
+
"substring": 2921,
|
| 44 |
+
"replace_underscores": 2922,
|
| 45 |
+
"reverse_fields": 2922,
|
| 46 |
+
"field_count": 2922,
|
| 47 |
+
"count_by_key": 2922,
|
| 48 |
+
"sum_by_key": 2922,
|
| 49 |
+
"duplicates_only": 2920,
|
| 50 |
+
"header_projection": 2922,
|
| 51 |
+
"header_filter": 2923,
|
| 52 |
+
"tsv_projection": 2923,
|
| 53 |
+
"csv_filter": 2923,
|
| 54 |
+
"normalize_whitespace": 2923,
|
| 55 |
+
"longest_line": 2922,
|
| 56 |
+
"every_nth": 2923,
|
| 57 |
+
"distinct_count": 2923,
|
| 58 |
+
"ratio": 2923,
|
| 59 |
+
"top_three": 2923,
|
| 60 |
+
"http_5xx_count": 1,
|
| 61 |
+
"http_bytes_sum": 1,
|
| 62 |
+
"http_unique_clients": 1,
|
| 63 |
+
"http_api_errors": 1,
|
| 64 |
+
"http_success_bytes": 1,
|
| 65 |
+
"http_non_get": 1,
|
| 66 |
+
"http_url_counts": 1,
|
| 67 |
+
"header_region_totals": 1,
|
| 68 |
+
"header_pending_ids": 1,
|
| 69 |
+
"header_amount_average": 1,
|
| 70 |
+
"top_two_amounts": 1,
|
| 71 |
+
"region_average": 1,
|
| 72 |
+
"amount_percentage": 1,
|
| 73 |
+
"passwd_shell": 1,
|
| 74 |
+
"passwd_uid_range": 1,
|
| 75 |
+
"passwd_shell_counts": 1,
|
| 76 |
+
"keyvalue_errors": 1,
|
| 77 |
+
"keyvalue_latency": 1,
|
| 78 |
+
"event_window": 1,
|
| 79 |
+
"running_delta": 1,
|
| 80 |
+
"group_maximum": 1,
|
| 81 |
+
"first_last_group": 1,
|
| 82 |
+
"positive_ratio": 1,
|
| 83 |
+
"clamp_values": 1,
|
| 84 |
+
"consecutive_dedup": 1,
|
| 85 |
+
"blank_filter": 1,
|
| 86 |
+
"blank_count": 1,
|
| 87 |
+
"line_numbers": 1,
|
| 88 |
+
"character_count": 1,
|
| 89 |
+
"comma_to_tab": 1,
|
| 90 |
+
"fixed_width": 1,
|
| 91 |
+
"absolute_difference": 1,
|
| 92 |
+
"sorted_unique_words": 1
|
| 93 |
+
},
|
| 94 |
+
"unique_requests": 15350,
|
| 95 |
+
"unique_programs": 1326,
|
| 96 |
+
"split_integrity": {
|
| 97 |
+
"train-validation": {
|
| 98 |
+
"input_overlap": 0,
|
| 99 |
+
"request_program_overlap": 339
|
| 100 |
+
},
|
| 101 |
+
"train-test": {
|
| 102 |
+
"input_overlap": 0,
|
| 103 |
+
"request_program_overlap": 348
|
| 104 |
+
},
|
| 105 |
+
"validation-test": {
|
| 106 |
+
"input_overlap": 0,
|
| 107 |
+
"request_program_overlap": 222
|
| 108 |
+
},
|
| 109 |
+
"train-challenge": {
|
| 110 |
+
"input_overlap": 0,
|
| 111 |
+
"request_program_overlap": 0
|
| 112 |
+
},
|
| 113 |
+
"validation-challenge": {
|
| 114 |
+
"input_overlap": 0,
|
| 115 |
+
"request_program_overlap": 0
|
| 116 |
+
},
|
| 117 |
+
"test-challenge": {
|
| 118 |
+
"input_overlap": 0,
|
| 119 |
+
"request_program_overlap": 0
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
}
|