Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30506
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Jeff Higgins <jeff@invalid.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: The Grand Canyon |
| Date | Mon, 08 Dec 2014 01:21:21 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 38 |
| Message-ID | <m63g2d$9j9$1@dont-email.me> (permalink) |
| References | <Canyon-20141208004520@ram.dialup.fu-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Mon, 8 Dec 2014 06:22:05 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="c50a9e5d554cfaba13eda1c71e805135"; logging-data="9833"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DyYndhU8UiQ/69WACeCCJ53kkNP702Sk=" |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.2.0 |
| In-Reply-To | <Canyon-20141208004520@ram.dialup.fu-berlin.de> |
| Cancel-Lock | sha1:JdYU32fNsvL/VdPLaepKJAe8vRo= |
| Xref | csiph.com comp.lang.java.programmer:30506 |
Show key headers only | View raw
On 12/07/2014 06:59 PM, Stefan Ram wrote:
> Today, I saw the Grand Canyon!
>
> Say, you want to count the even numbers of a list.
> Well, that's easy, you just ...
>
>
> public class Main
> { public static void main( final java.lang.String args[] )
> { final java.util.List< java.lang.Integer >list = java.util.Arrays.asList( 1, 2, 3, 4 );
> java.lang.System.out.println( list.stream().filter( i -> 0 == i % 2 ).count() ); }}
>
> Now, say, you want to count the vowel letters in a string.
>
> public class Main
> { public static void main( final java.lang.String args[] )
> { final java.lang.String s = "alpha";
> ... x = ... s ... ;
> java.lang.System.out.println( x.stream().filter( ch -> "aeiou".contains( ch )).count() ); }}
>
> Can you fill in something for »...« to bridge the gap between
> the string and the filter counter? (The output should be »2«.)
>
> You can't.
>
> So, this is not just a gap, it's a canyon.
>
> The Grand Canyon of Java programming!
>
So, after much study, I conclude you will:
For each language, and dialect of that language;
Construct a word->IPA transcription dictionary:
Split the string into words:
Map the words to their IPA transcription:
Filter the vowels from the transcriptions:
Reduce to a vowel count.
Voilà! vwäˈlä
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
Re: The Grand Canyon Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 01:21 -0500 Re: The Grand Canyon Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 01:48 -0500
csiph-web