Re: Some Help Please
"SamBC" <sambc-+byImgRrt+a6NMhornyX/[email protected]> Sun, 8 Oct 2000 12:53:29 +0100
| Newsgroups | gmane.games.freeciv.java |
|---|---|
| Message-ID | <029a01c03122$62233ee0$18e4fea9@oemcomputer> |
Two reasons, perhaps? 1) He's learning Java and it is a code example (and a reasonably good one, esp for string handling) 2) It may be more verbose, but it is far nearer plain english than that command, and more understandable with less work... SamBC ----- Original Message ----- From: "Erik Sigra" <[email protected]> To: <[email protected]> Sent: Saturday, October 07, 2000 12:13 AM Subject: [FreeCiv-Java] Re: Some Help Please Houjeh Tiourchi wrote: > > The following code reads a text file, makes a tally of all the different > words used in the file, and prints out a list of the words that appear > most frequently, along with the number of times each word appears. > Please explain to me what each lone of code does and how if possible. I > am a novice and really want to learn this piece of code inside and out. Why use a long java program? I just used a unix command to do it. Something like: cat foo.bar | tr "[A-Zà ÃÃ]" "[a-zåäö]" | tr -d "\(\)\_\t" | tr " 0123456789\"\-\.\,\:\;\'\=\<\>\?\!\/\*\[\]" "\n" | sort | uniq -c | sort