summaryrefslogtreecommitdiff
path: root/first-def.jq
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-03-22 09:00:06 +0100
committerTom Smeding <tom.smeding@gmail.com>2020-03-22 09:00:06 +0100
commitc07cd773dbedfe8f4a76b43dd9ec37f841d09432 (patch)
treed30b6c01917a3312c117d7b5e19ee9a4b2f6d59f /first-def.jq
parent841519901e8b6df97733bad85f215a640f6d6d3f (diff)
JQ script for extracting first definitionsHEADmaster
Diffstat (limited to 'first-def.jq')
-rw-r--r--first-def.jq6
1 files changed, 6 insertions, 0 deletions
diff --git a/first-def.jq b/first-def.jq
new file mode 100644
index 0000000..13bc221
--- /dev/null
+++ b/first-def.jq
@@ -0,0 +1,6 @@
+.[] |
+{romaji: .romaji, text: .alternatives[0].text} + (
+ .alternatives[0] |
+ (select(has("definitions")) | {def: .definitions[0]}),
+ (select(has("conjugations")) | .conjugations[0] | {form: .form} + (.alternatives[0] | {text, def: .definitions[0]}))
+)