summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xoedquery.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/oedquery.sh b/oedquery.sh
index 239d2cf..49f0bfa 100755
--- a/oedquery.sh
+++ b/oedquery.sh
@@ -63,7 +63,14 @@ _define() {
for json in $(echo "${result}" | jq -r '.results[].lexicalEntries[] | @base64')
do
output="$output $(_jq '.lexicalCategory.text'): "
- output="$output $(_jq '.entries[0].senses[0].definitions[0]') "
+ #output="$output $(_jq '.entries[0].senses[0].definitions[0]') "
+ # Sometimes there's no definition and so we can fall back to shortDefinition
+ definition=$(_jq '.entries[0].senses[0].definitions[0]')
+ if [[ -z $defintion ]]
+ then
+ definition=$(_jq '.entries[0].senses[0].shortDefinitions[0]')
+ fi
+ output="$output $definition "
examplePhrase=$(_jq '.entries[0].senses[0].examples[0].text')
if [[ "$examplePhrase" != "null" ]]
then