Datasets:
Jqweave: 39k execution-verified natural-language-to-jq examples across 39 task families
Browse files- .gitattributes +1 -0
- DATASET_LICENSE.txt +11 -0
- LICENSE +202 -0
- README.md +57 -0
- data/test.jsonl +0 -0
- data/train.jsonl +3 -0
- data/validation.jsonl +0 -0
- generate_data.py +168 -0
- jqweave/__init__.py +1 -0
- jqweave/execution.py +73 -0
- validate_dataset.py +81 -0
- validation.json +73 -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 |
+
Jqweave 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,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language: en
|
| 4 |
+
pretty_name: Jqweave Data
|
| 5 |
+
size_categories:
|
| 6 |
+
- 10K<n<100K
|
| 7 |
+
task_categories:
|
| 8 |
+
- text-generation
|
| 9 |
+
tags:
|
| 10 |
+
- jq
|
| 11 |
+
- json
|
| 12 |
+
- code-generation
|
| 13 |
+
- text-to-code
|
| 14 |
+
- execution-verified
|
| 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 |
+
---
|
| 25 |
+
|
| 26 |
+
# Jqweave Data
|
| 27 |
+
|
| 28 |
+
Jqweave Data is a synthetic natural-language-to-`jq` dataset for training small, offline JSON-processing models. Each example pairs an English request and representative JSON input with one bare `jq` command and actual outputs from two different inputs.
|
| 29 |
+
|
| 30 |
+
## Contents
|
| 31 |
+
|
| 32 |
+
- **39000 rows** across **39 task families**.
|
| 33 |
+
- Splits: **31200 train / 3900 validation / 3900 test**.
|
| 34 |
+
- Field selection, array indexing, filtering, mapping, aggregation, grouping, sorting, object conversion, CSV/TSV formatting, and JSON Lines.
|
| 35 |
+
- Two different inputs per row and exact output from each.
|
| 36 |
+
- Commands use only `jq` on stdin/stdout with no filenames, modules, environment access, or additional inputs.
|
| 37 |
+
|
| 38 |
+
Every reference command was executed on both inputs with `jq-1.6`: **78000 successful executions, 0 errors**. The validation report and SHA-256 are in `validation.json`.
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from datasets import load_dataset
|
| 42 |
+
|
| 43 |
+
train = load_dataset("asterbraid/jqweave-data", split="train")
|
| 44 |
+
print(train[0])
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Schema
|
| 48 |
+
|
| 49 |
+
Each row contains `request`, `command`, `input_text`, `expected_output`, `validation_input`, `validation_output`, `family`, `difficulty`, `split`, `source`, and `license`.
|
| 50 |
+
|
| 51 |
+
## Limitations
|
| 52 |
+
|
| 53 |
+
The data is grammar-generated and measures in-distribution behavior, not broad real-world competence. Requests have four mechanical phrasing forms. Inputs are synthetic, and identical request/command pairs recur with different records. Review generated commands before using them on important data.
|
| 54 |
+
|
| 55 |
+
## License
|
| 56 |
+
|
| 57 |
+
Dataset rows are CC-BY-4.0. See `DATASET_LICENSE.txt`. Included generation, validation, and execution code is Apache-2.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:027789b4e0e937025dc3eddba5051dba3db05b82e3a66fdff1715a831ffea0b6
|
| 3 |
+
size 49085303
|
data/validation.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
generate_data.py
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import concurrent.futures
|
| 4 |
+
import json
|
| 5 |
+
import random
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
from jqweave.execution import run_jq
|
| 9 |
+
|
| 10 |
+
NAMES = ["alice", "bruno", "chen", "dina", "eli", "farah", "gus", "hana", "iris", "jules", "kira", "liam", "mira", "nina", "omar", "petra"]
|
| 11 |
+
CATEGORIES = ["alpha", "beta", "gamma", "delta"]
|
| 12 |
+
STATUSES = ["ready", "pending", "failed", "closed"]
|
| 13 |
+
FAMILIES = [
|
| 14 |
+
("select_field", "Extract the value of the 'name' field.", "jq '.name'", "object"),
|
| 15 |
+
("nested_field", "Extract the city from the user's address.", "jq '.user.address.city'", "nested"),
|
| 16 |
+
("array_first", "Return the first element of the array.", "jq '.[0]'", "records"),
|
| 17 |
+
("array_last", "Return the last element of the array.", "jq '.[-1]'", "records"),
|
| 18 |
+
("array_index", "Return the third element of the array.", "jq '.[2]'", "records"),
|
| 19 |
+
("array_length", "Count the number of records in the array.", "jq 'length'", "records"),
|
| 20 |
+
("object_keys", "List the object's keys in sorted order.", "jq 'keys'", "object"),
|
| 21 |
+
("object_values", "Return the object's values as an array.", "jq '[.[]]'", "object"),
|
| 22 |
+
("select_array_field", "Extract the name field from every record as a stream.", "jq '.[] | .name'", "records"),
|
| 23 |
+
("pluck_array", "Build an array containing every record's name.", "jq '[.[] | .name]'", "records"),
|
| 24 |
+
("filter_active", "Keep only records whose active flag is true.", "jq '[.[] | select(.active == true)]'", "records"),
|
| 25 |
+
("filter_score", "Keep only records with a score of at least __THRESHOLD__.", "jq '[.[] | select(.score >= __THRESHOLD__)]'", "records"),
|
| 26 |
+
("filter_status", "Keep only records whose status is '__STATUS__'.", "jq '[.[] | select(.status == \"__STATUS__\")]'", "records"),
|
| 27 |
+
("map_number", "Double the score in every record.", "jq '[.[] | .score * 2]'", "records"),
|
| 28 |
+
("map_string", "Convert every record's name to uppercase.", "jq '[.[] | .name | ascii_upcase]'", "records"),
|
| 29 |
+
("sum_field", "Sum all record scores.", "jq '[.[] | .score] | add'", "records"),
|
| 30 |
+
("average_field", "Compute the average of all record scores.", "jq '[.[] | .score] | add / length'", "records"),
|
| 31 |
+
("min_field", "Find the smallest record score.", "jq '[.[] | .score] | min'", "records"),
|
| 32 |
+
("max_field", "Find the largest record score.", "jq '[.[] | .score] | max'", "records"),
|
| 33 |
+
("unique_categories", "List the unique categories in sorted order.", "jq '[.[] | .category] | unique'", "records"),
|
| 34 |
+
("group_count", "Group records by category and return each category with its record count.", "jq 'group_by(.category) | map({category: .[0].category, count: length})'", "records"),
|
| 35 |
+
("sort_score", "Sort records by score in ascending order.", "jq 'sort_by(.score)'", "records"),
|
| 36 |
+
("reverse_array", "Reverse the order of the array.", "jq 'reverse'", "records"),
|
| 37 |
+
("flatten_array", "Flatten all nested arrays into a single array.", "jq 'flatten'", "array_arrays"),
|
| 38 |
+
("join_strings", "Join all strings with a comma and a space.", "jq 'join(\", \")'", "strings"),
|
| 39 |
+
("to_entries", "Convert the object into an array of key-value entries.", "jq 'to_entries'", "object"),
|
| 40 |
+
("from_entries", "Convert the key-value entries back into an object.", "jq 'from_entries'", "entries"),
|
| 41 |
+
("has_key", "Check whether the object contains the key 'name'.", "jq 'has(\"name\")'", "object"),
|
| 42 |
+
("delete_key", "Remove the password field from the object.", "jq 'del(.password)'", "object"),
|
| 43 |
+
("rename_key", "Rename the username field to name while preserving the id field.", "jq '{name: .username, id: .id}'", "object"),
|
| 44 |
+
("concat_arrays", "Concatenate arrays a and b into one array.", "jq '.a + .b'", "concat"),
|
| 45 |
+
("merge_objects", "Merge objects a and b into one object.", "jq '.a + .b'", "merge"),
|
| 46 |
+
("raw_strings", "Print every string without JSON quotes.", "jq -r '.[]'", "strings"),
|
| 47 |
+
("csv_convert", "Convert each record's name and score into a CSV row.", "jq -r '.[] | [.name,.score] | @csv'", "records"),
|
| 48 |
+
("tsv_convert", "Convert each record's name and score into a TSV row.", "jq -r '.[] | [.name,.score] | @tsv'", "records"),
|
| 49 |
+
("jsonlines_slurp", "Read JSON objects from JSON Lines and collect their names into an array.", "jq -s '[.[] | .name]'", "jsonlines"),
|
| 50 |
+
("conditional", "Return pass if the score is at least __THRESHOLD__, otherwise return fail.", "jq 'if .score >= __THRESHOLD__ then \"pass\" else \"fail\" end'", "object"),
|
| 51 |
+
("default_value", "Return the name field, using unknown when the value is null.", "jq '.name // \"unknown\"'", "default"),
|
| 52 |
+
("type_filter", "Keep only values that are numbers.", "jq '[.[] | select(type == \"number\")]'", "types"),
|
| 53 |
+
]
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def record(rng: random.Random) -> dict:
|
| 57 |
+
name = rng.choice(NAMES)
|
| 58 |
+
return {
|
| 59 |
+
"id": rng.randint(1, 1000000),
|
| 60 |
+
"name": name,
|
| 61 |
+
"username": name,
|
| 62 |
+
"category": rng.choice(CATEGORIES),
|
| 63 |
+
"status": rng.choice(STATUSES),
|
| 64 |
+
"score": rng.randint(0, 100),
|
| 65 |
+
"active": rng.choice([True, False]),
|
| 66 |
+
"password": rng.choice(["secret", "hidden", "remove-me"]),
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def build_input(kind: str, rng: random.Random):
|
| 71 |
+
if kind == "object":
|
| 72 |
+
return record(rng)
|
| 73 |
+
if kind == "nested":
|
| 74 |
+
return {"user": {"name": rng.choice(NAMES), "address": {"city": rng.choice(["Oslo", "Paris", "Tokyo", "Lima"]), "zip": rng.randint(10000, 99999)}}, "id": rng.randint(1, 1000000)}
|
| 75 |
+
if kind == "records":
|
| 76 |
+
return [record(rng) for _ in range(rng.randint(3, 6))]
|
| 77 |
+
if kind == "array_arrays":
|
| 78 |
+
return [[rng.choice(NAMES) for _ in range(2)], [rng.choice(NAMES)], [rng.choice(NAMES) for _ in range(2)]]
|
| 79 |
+
if kind == "strings":
|
| 80 |
+
return [rng.choice(NAMES) for _ in range(4)]
|
| 81 |
+
if kind == "entries":
|
| 82 |
+
return [{"key": rng.choice(["name", "score", "category", "status"]), "value": rng.randint(1, 100)} for _ in range(4)]
|
| 83 |
+
if kind == "concat":
|
| 84 |
+
return {"a": [rng.choice(NAMES) for _ in range(2)], "b": [rng.choice(NAMES) for _ in range(2)]}
|
| 85 |
+
if kind == "merge":
|
| 86 |
+
return {"a": {"x": rng.randint(1, 50), "shared": "left", "id": rng.randint(1, 1000000)}, "b": {"y": rng.randint(50, 100), "shared": "right"}}
|
| 87 |
+
if kind == "jsonlines":
|
| 88 |
+
return "\n".join(json.dumps(record(rng), separators=(",", ":")) for _ in range(4)) + "\n"
|
| 89 |
+
if kind == "default":
|
| 90 |
+
return {"name": None, "id": rng.randint(1, 1000000)}
|
| 91 |
+
if kind == "types":
|
| 92 |
+
return [rng.choice(NAMES), rng.randint(1, 100), rng.choice([True, False]), rng.randint(1, 100), None]
|
| 93 |
+
raise ValueError(kind)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def add_salt(value, salt: str):
|
| 97 |
+
if isinstance(value, str):
|
| 98 |
+
return value + json.dumps({"name": salt}, separators=(",", ":")) + "\n"
|
| 99 |
+
if isinstance(value, dict):
|
| 100 |
+
value["_row_nonce"] = salt
|
| 101 |
+
elif value and isinstance(value[0], dict):
|
| 102 |
+
value[0]["_row_nonce"] = salt
|
| 103 |
+
elif value and isinstance(value[0], list):
|
| 104 |
+
value.append([salt])
|
| 105 |
+
else:
|
| 106 |
+
value.append(salt)
|
| 107 |
+
return value
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def encode(value) -> str:
|
| 111 |
+
if isinstance(value, str):
|
| 112 |
+
return value
|
| 113 |
+
return json.dumps(value, ensure_ascii=False, separators=(",", ":"))
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def request_forms(request: str, index: int) -> str:
|
| 117 |
+
if index == 0:
|
| 118 |
+
return request
|
| 119 |
+
lowered = request[0].lower() + request[1:]
|
| 120 |
+
if index == 1:
|
| 121 |
+
return "Please " + lowered
|
| 122 |
+
if index == 2:
|
| 123 |
+
return "Using jq, " + lowered
|
| 124 |
+
return "Can you " + lowered
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
def build_row(task: tuple[str, int]) -> dict:
|
| 128 |
+
family, index = task
|
| 129 |
+
rng = random.Random(20261130 + index * 7919)
|
| 130 |
+
_, request, command, kind = next(item for item in FAMILIES if item[0] == family)
|
| 131 |
+
threshold = rng.choice([50, 60, 70, 80, 90])
|
| 132 |
+
status = rng.choice(STATUSES)
|
| 133 |
+
request = request.replace("__THRESHOLD__", str(threshold)).replace("__STATUS__", status)
|
| 134 |
+
command = command.replace("__THRESHOLD__", str(threshold)).replace("__STATUS__", status)
|
| 135 |
+
input_text = encode(add_salt(build_input(kind, rng), f"{family}-{index}-a"))
|
| 136 |
+
validation_input = encode(add_salt(build_input(kind, rng), f"{family}-{index}-b"))
|
| 137 |
+
if input_text == validation_input:
|
| 138 |
+
raise ValueError(f"Identical inputs for {family}-{index}")
|
| 139 |
+
split = "validation" if index % 10 == 0 else "test" if index % 10 == 1 else "train"
|
| 140 |
+
return {
|
| 141 |
+
"id": f"{family}-{index:04d}",
|
| 142 |
+
"request": request_forms(request, index % 4),
|
| 143 |
+
"command": command,
|
| 144 |
+
"input_text": input_text,
|
| 145 |
+
"expected_output": run_jq(command, input_text),
|
| 146 |
+
"validation_input": validation_input,
|
| 147 |
+
"validation_output": run_jq(command, validation_input),
|
| 148 |
+
"family": family,
|
| 149 |
+
"difficulty": 1 + int(any(marker in command for marker in ("group_by", "map(", "select", "from_entries", "@"))),
|
| 150 |
+
"split": split,
|
| 151 |
+
"source": "jqweave-grammar-v1",
|
| 152 |
+
"license": "CC-BY-4.0",
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def main() -> None:
|
| 157 |
+
tasks = [(family, index) for family, *_ in FAMILIES for index in range(1000)]
|
| 158 |
+
output = Path("jqweave-seed.jsonl")
|
| 159 |
+
with output.open("w", encoding="utf-8") as handle, concurrent.futures.ProcessPoolExecutor(max_workers=8) as executor:
|
| 160 |
+
for completed, row in enumerate(executor.map(build_row, tasks, chunksize=50), 1):
|
| 161 |
+
handle.write(json.dumps(row, ensure_ascii=False, separators=(",", ":")) + "\n")
|
| 162 |
+
if completed % 5000 == 0:
|
| 163 |
+
print(f"generated {completed}/{len(tasks)}", flush=True)
|
| 164 |
+
print(f"wrote {len(tasks)} rows to {output}")
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
if __name__ == "__main__":
|
| 168 |
+
main()
|
jqweave/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"""Jqweave natural-language-to-jq tools."""
|
jqweave/execution.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import re
|
| 4 |
+
import resource
|
| 5 |
+
import shlex
|
| 6 |
+
import shutil
|
| 7 |
+
import subprocess
|
| 8 |
+
|
| 9 |
+
MAX_INPUT_BYTES = 1_000_000
|
| 10 |
+
MAX_COMMAND_CHARS = 4_000
|
| 11 |
+
ENV_PATTERN = re.compile(r"\$ENV\b|(?<![A-Za-z0-9_.])env(?![A-Za-z0-9_])")
|
| 12 |
+
MODULE_PATTERN = re.compile(r"(?<![A-Za-z0-9_.])(?:import|include|load|modulemeta)(?![A-Za-z0-9_])")
|
| 13 |
+
INPUT_PATTERN = re.compile(r"(?<![A-Za-z0-9_.])inputs?(?![A-Za-z0-9_])")
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class UnsafeCommandError(ValueError):
|
| 17 |
+
pass
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def check_command(command: str) -> list[str]:
|
| 21 |
+
if not command.strip():
|
| 22 |
+
raise UnsafeCommandError("The jq command is empty.")
|
| 23 |
+
if len(command) > MAX_COMMAND_CHARS:
|
| 24 |
+
raise UnsafeCommandError("The jq command is too long.")
|
| 25 |
+
try:
|
| 26 |
+
arguments = shlex.split(command)
|
| 27 |
+
except ValueError as error:
|
| 28 |
+
raise UnsafeCommandError(f"Cannot parse jq command: {error}") from error
|
| 29 |
+
if not arguments or arguments[0] != "jq":
|
| 30 |
+
raise UnsafeCommandError("Only jq commands are allowed.")
|
| 31 |
+
if ENV_PATTERN.search(command) or MODULE_PATTERN.search(command) or INPUT_PATTERN.search(command):
|
| 32 |
+
raise UnsafeCommandError("Environment, module, and additional-input access are not allowed.")
|
| 33 |
+
index = 1
|
| 34 |
+
options = []
|
| 35 |
+
while index < len(arguments) and arguments[index] in {"-c", "-r", "-s"}:
|
| 36 |
+
options.append(arguments[index])
|
| 37 |
+
index += 1
|
| 38 |
+
if len(options) > 1:
|
| 39 |
+
raise UnsafeCommandError("Use at most one jq option.")
|
| 40 |
+
if index != len(arguments) - 1:
|
| 41 |
+
raise UnsafeCommandError("Expected exactly one jq filter and no filenames or other options.")
|
| 42 |
+
return arguments
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def limit_resources() -> None:
|
| 46 |
+
resource.setrlimit(resource.RLIMIT_CPU, (2, 2))
|
| 47 |
+
resource.setrlimit(resource.RLIMIT_AS, (256_000_000, 256_000_000))
|
| 48 |
+
resource.setrlimit(resource.RLIMIT_FSIZE, (1_000_000, 1_000_000))
|
| 49 |
+
resource.setrlimit(resource.RLIMIT_CORE, (0, 0))
|
| 50 |
+
resource.setrlimit(resource.RLIMIT_NOFILE, (16, 16))
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def run_jq(command: str, input_text: str, timeout: float = 3.0) -> str:
|
| 54 |
+
arguments = check_command(command)
|
| 55 |
+
if len(input_text.encode("utf-8")) > MAX_INPUT_BYTES:
|
| 56 |
+
raise ValueError("Input text exceeds the 1 MB limit.")
|
| 57 |
+
executable = shutil.which("jq")
|
| 58 |
+
if executable is None:
|
| 59 |
+
raise RuntimeError("No jq executable is available on PATH.")
|
| 60 |
+
result = subprocess.run(
|
| 61 |
+
[executable, *arguments[1:]],
|
| 62 |
+
input=input_text,
|
| 63 |
+
text=True,
|
| 64 |
+
capture_output=True,
|
| 65 |
+
timeout=timeout,
|
| 66 |
+
env={"LC_ALL": "C", "PATH": "/usr/bin:/bin"},
|
| 67 |
+
preexec_fn=limit_resources,
|
| 68 |
+
start_new_session=True,
|
| 69 |
+
check=False,
|
| 70 |
+
)
|
| 71 |
+
if result.returncode != 0:
|
| 72 |
+
raise ValueError(result.stderr.strip() or f"jq exited with status {result.returncode}")
|
| 73 |
+
return result.stdout
|
validate_dataset.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import collections
|
| 5 |
+
import concurrent.futures
|
| 6 |
+
import hashlib
|
| 7 |
+
import json
|
| 8 |
+
import subprocess
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
from jqweave.execution import run_jq
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def jq_version() -> str:
|
| 15 |
+
result = subprocess.run(["jq", "--version"], capture_output=True, text=True, check=False)
|
| 16 |
+
return (result.stdout or result.stderr).strip()
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def validate_row(row: dict) -> tuple[str, str | None]:
|
| 20 |
+
try:
|
| 21 |
+
if run_jq(row["command"], row["input_text"]) != row["expected_output"]:
|
| 22 |
+
return row["id"], "primary output mismatch"
|
| 23 |
+
if run_jq(row["command"], row["validation_input"]) != row["validation_output"]:
|
| 24 |
+
return row["id"], "validation output mismatch"
|
| 25 |
+
return row["id"], None
|
| 26 |
+
except Exception as error:
|
| 27 |
+
return row["id"], str(error)[:500]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def main() -> None:
|
| 31 |
+
parser = argparse.ArgumentParser()
|
| 32 |
+
parser.add_argument("data", type=Path)
|
| 33 |
+
parser.add_argument("--workers", type=int, default=8)
|
| 34 |
+
parser.add_argument("--output", type=Path)
|
| 35 |
+
args = parser.parse_args()
|
| 36 |
+
rows = [json.loads(line) for line in args.data.open(encoding="utf-8")]
|
| 37 |
+
ids = [row["id"] for row in rows]
|
| 38 |
+
if len(ids) != len(set(ids)):
|
| 39 |
+
raise ValueError("Duplicate row IDs")
|
| 40 |
+
errors = []
|
| 41 |
+
with concurrent.futures.ProcessPoolExecutor(max_workers=args.workers) as executor:
|
| 42 |
+
for completed, (row_id, error) in enumerate(executor.map(validate_row, rows, chunksize=100), 1):
|
| 43 |
+
if error:
|
| 44 |
+
errors.append({"id": row_id, "error": error})
|
| 45 |
+
if completed % 5000 == 0:
|
| 46 |
+
print(f"validated {completed}/{len(rows)}", flush=True)
|
| 47 |
+
split_integrity = {}
|
| 48 |
+
for left, right in (("train", "validation"), ("train", "test"), ("validation", "test")):
|
| 49 |
+
left_rows = [row for row in rows if row["split"] == left]
|
| 50 |
+
right_rows = [row for row in rows if row["split"] == right]
|
| 51 |
+
split_integrity[f"{left}-{right}"] = {
|
| 52 |
+
"input_overlap": len({row["input_text"] for row in left_rows} & {row["input_text"] for row in right_rows}),
|
| 53 |
+
"request_command_overlap": len(
|
| 54 |
+
{(row["request"], row["command"]) for row in left_rows}
|
| 55 |
+
& {(row["request"], row["command"]) for row in right_rows}
|
| 56 |
+
),
|
| 57 |
+
}
|
| 58 |
+
summary = {
|
| 59 |
+
"data": str(args.data),
|
| 60 |
+
"sha256": hashlib.sha256(args.data.read_bytes()).hexdigest(),
|
| 61 |
+
"rows": len(rows),
|
| 62 |
+
"executions": len(rows) * 2,
|
| 63 |
+
"jq_version": jq_version(),
|
| 64 |
+
"errors": errors,
|
| 65 |
+
"splits": dict(collections.Counter(row["split"] for row in rows)),
|
| 66 |
+
"sources": dict(collections.Counter(row["source"] for row in rows)),
|
| 67 |
+
"families": dict(collections.Counter(row["family"] for row in rows)),
|
| 68 |
+
"unique_requests": len({row["request"] for row in rows}),
|
| 69 |
+
"unique_commands": len({row["command"] for row in rows}),
|
| 70 |
+
"split_integrity": split_integrity,
|
| 71 |
+
}
|
| 72 |
+
text = json.dumps(summary, indent=2)
|
| 73 |
+
if args.output:
|
| 74 |
+
args.output.write_text(text, encoding="utf-8")
|
| 75 |
+
print(text)
|
| 76 |
+
if errors:
|
| 77 |
+
raise SystemExit(1)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
if __name__ == "__main__":
|
| 81 |
+
main()
|
validation.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"data": "jqweave-seed.jsonl",
|
| 3 |
+
"sha256": "c7f34a31a47d4930d9b9dacebea6d99b670f68cc7c04ec0396f5aeb92bd937e7",
|
| 4 |
+
"rows": 39000,
|
| 5 |
+
"executions": 78000,
|
| 6 |
+
"jq_version": "jq-1.6",
|
| 7 |
+
"errors": [],
|
| 8 |
+
"splits": {
|
| 9 |
+
"validation": 3900,
|
| 10 |
+
"test": 3900,
|
| 11 |
+
"train": 31200
|
| 12 |
+
},
|
| 13 |
+
"sources": {
|
| 14 |
+
"jqweave-grammar-v1": 39000
|
| 15 |
+
},
|
| 16 |
+
"families": {
|
| 17 |
+
"select_field": 1000,
|
| 18 |
+
"nested_field": 1000,
|
| 19 |
+
"array_first": 1000,
|
| 20 |
+
"array_last": 1000,
|
| 21 |
+
"array_index": 1000,
|
| 22 |
+
"array_length": 1000,
|
| 23 |
+
"object_keys": 1000,
|
| 24 |
+
"object_values": 1000,
|
| 25 |
+
"select_array_field": 1000,
|
| 26 |
+
"pluck_array": 1000,
|
| 27 |
+
"filter_active": 1000,
|
| 28 |
+
"filter_score": 1000,
|
| 29 |
+
"filter_status": 1000,
|
| 30 |
+
"map_number": 1000,
|
| 31 |
+
"map_string": 1000,
|
| 32 |
+
"sum_field": 1000,
|
| 33 |
+
"average_field": 1000,
|
| 34 |
+
"min_field": 1000,
|
| 35 |
+
"max_field": 1000,
|
| 36 |
+
"unique_categories": 1000,
|
| 37 |
+
"group_count": 1000,
|
| 38 |
+
"sort_score": 1000,
|
| 39 |
+
"reverse_array": 1000,
|
| 40 |
+
"flatten_array": 1000,
|
| 41 |
+
"join_strings": 1000,
|
| 42 |
+
"to_entries": 1000,
|
| 43 |
+
"from_entries": 1000,
|
| 44 |
+
"has_key": 1000,
|
| 45 |
+
"delete_key": 1000,
|
| 46 |
+
"rename_key": 1000,
|
| 47 |
+
"concat_arrays": 1000,
|
| 48 |
+
"merge_objects": 1000,
|
| 49 |
+
"raw_strings": 1000,
|
| 50 |
+
"csv_convert": 1000,
|
| 51 |
+
"tsv_convert": 1000,
|
| 52 |
+
"jsonlines_slurp": 1000,
|
| 53 |
+
"conditional": 1000,
|
| 54 |
+
"default_value": 1000,
|
| 55 |
+
"type_filter": 1000
|
| 56 |
+
},
|
| 57 |
+
"unique_requests": 200,
|
| 58 |
+
"unique_commands": 49,
|
| 59 |
+
"split_integrity": {
|
| 60 |
+
"train-validation": {
|
| 61 |
+
"input_overlap": 0,
|
| 62 |
+
"request_command_overlap": 100
|
| 63 |
+
},
|
| 64 |
+
"train-test": {
|
| 65 |
+
"input_overlap": 0,
|
| 66 |
+
"request_command_overlap": 100
|
| 67 |
+
},
|
| 68 |
+
"validation-test": {
|
| 69 |
+
"input_overlap": 0,
|
| 70 |
+
"request_command_overlap": 0
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
}
|