java快速统计英文文章的单词次数

package homework2;


import java.util.*;



public class Homework {
    
    public static void main(String[] args) {
        
        String ss = "Mr. Louis P. Barker of northern Iowa was also on the car, and he\n" +
                "described a cyclone that he saw in the '70s along in September at the\n" +
                "close of a hot but clear day. The first intimation that Mr. Barker had\n" +
                "of an approaching storm was a small cloud no larger than a man's hand\n" +
                "which he discovered moving slowly toward the southwest with a gyratory\n" +
                "movement. It then appeared to be a funnel-shaped cloud which passed\n" +
                "along near the surface of the ground with its apex now and then lightly\n" +
                "touching a barn or a well, and pulling it out by the roots. It would\n" +
                "then bound lightly into the air and spit on its hands. What he noticed\n" +
                "most carefully on the following day was the wonderful evidences of its\n" +
                "powerful suction. It sucked a milch cow absolutely dry, pulled all the\n" +
                "water out of his cistern, and then went around to the waste-water pipe\n" +
                "that led from the bath-room and drew a 2-year-old child, who was taking\n" +
                "a bath at the time, clear down through the two-inch waste-pipe, a\n" +
                "distance of 150 feet. He had two inches of the pipe with him and a lock\n" +
                "of hair from the child's head.";
        String regex = "[\\s\\p{Punct}]+";
        ss = ss.toLowerCase();
        //System.out.println(ss);
        String words[]=ss.split(regex);
        Mapmap = new HashMap();
        for (int i = 0;i> entrys = map.entrySet();
        Iterator> it = entrys.iterator();
        while(it.hasNext()){
            Map.Entry entry = it.next();
            System.out.println(entry.getKey()+"频数:"+entry.getValue());
        }
        
    }
}  

你可能感兴趣的:(Java)