Jump to content

Changeable words: Difference between revisions

m (→‎{{header|Phix}}: use unix_dict())
Line 870:
52: upperclassmen -> upperclassman
</pre>
 
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<lang jq>
# $alphas is an array of the characters that can be substituted.
# Emit a stream of words "greater than" the input word that differ by just one character.
def changeable_to($dict; $alphas):
. as $w
| range(0;length) as $i
| .[:$i] + $alphas[] + .[$i+1:]
| select($w < . and $dict[.]);
INDEX( inputs; . )
| . as $dict
| [range(97;123) | [.] | implode] as $alphas
| keys[] # keys_unsorted[]
| select(length>11)
| . as $w
| [changeable_to($dict; $alphas)] | unique[] # avoid redundancy
| "\($w) <=> \(.)"
</lang>
Invocation: jq -n -rR -f changeable-words.jq unixdict.txt
{{out}}
<pre>
aristotelean <=> aristotelian
claustrophobia <=> claustrophobic
committeeman <=> committeemen
committeewoman <=> committeewomen
complementary <=> complimentary
confirmation <=> conformation
congresswoman <=> congresswomen
councilwoman <=> councilwomen
craftsperson <=> draftsperson
eavesdropped <=> eavesdropper
frontiersman <=> frontiersmen
handicraftsman <=> handicraftsmen
incommutable <=> incomputable
installation <=> instillation
kaleidescope <=> kaleidoscope
neuroanatomy <=> neuroanotomy
newspaperman <=> newspapermen
nonagenarian <=> nonogenarian
onomatopoeia <=> onomatopoeic
philanthrope <=> philanthropy
prescription <=> proscription
schizophrenia <=> schizophrenic
shakespearean <=> shakespearian
spectroscope <=> spectroscopy
underclassman <=> underclassmen
upperclassman <=> upperclassmen
</pre>
 
 
=={{header|Julia}}==
2,490

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.