Find words which contains more than 3 e vowels: Difference between revisions

→‎{{header|Raku}}: Add an alternate
(Add Pascal)
(→‎{{header|Raku}}: Add an alternate)
Line 497:
 
=={{header|Raku}}==
 
Hardly even worth saving as a script file; an easily entered one-liner.
<lang perl6>.say for "unixdict.txt".IO.lines.grep: { !/<[aiou]>/ and /e.*e.*e.*e/ };</lang>
{{out}}
Line 517 ⟶ 519:
tennessee
</pre>
 
In an attempt to be a little less useless, here's an alternate script that allows you to specify a vowel, the minimum count to search for, and the file to search. Counts base vowels case, and combining accent insensitive; works with ''any'' text file, not just word lists. Defaults to finding words with at least 4 'e's in unixdict.txt. Default output is same as above.
 
<lang perl6>unit sub MAIN ($vowel = 'e', $min = 4, $file = 'unixdict.txt');
.say for squish sort
( $file.IO.slurp.words.grep: { ((my $b = .lc.samemark(' ').comb.Bag){$vowel} >= $min) && $b<a e i o u>.sum == $b{$vowel} } )\
».subst(/<[":;,.?!_\[\]]>/, '', :g);</lang>
 
How about: find words with at least 4 'a's in the [https://github.com/thundergnat/rc-run/blob/master/rc/resources/lemiz.txt Les Misérables file] used for the [[Word frequency]] task?
 
Command line <code>> raku monovowel a 4 lemiz.txt</code>
 
{{out}}
<pre>Caracalla
Caracara
Salamanca
Vâsaphantâ</pre>
 
=={{header|REXX}}==
10,333

edits