@@ -0,0 +1,2996 @@
+/*********************************************************************************%0A * Copyright (c) 2011, Monnet Project All rights reserved.%0A *%0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted provided that the following conditions are met: *%0A * Redistributions of source code must retain the above copyright notice, this%0A * list of conditions and the following disclaimer. * Redistributions in binary%0A * form must reproduce the above copyright notice, this list of conditions and%0A * the following disclaimer in the documentation and/or other materials provided%0A * with the distribution. * Neither the name of the Monnet Project nor the names%0A * of its contributors may be used to endorse or promote products derived from%0A * this software without specific prior written permission.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22%0A * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE%0A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE%0A * ARE DISCLAIMED. IN NO EVENT SHALL THE MONNET PROJECT BE LIABLE FOR ANY%0A * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES%0A * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;%0A * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND%0A * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT%0A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS%0A * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A * *******************************************************************************%0A */%0Apackage eu.monnetproject.translation.topics.experiments;%0A%0Aimport java.io.DataInputStream;%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0A%0A/**%0A *%0A * @author John McCrae%0A */%0Apublic class WordMapSize %7B%0A    %0A    %0A    private static void fail(String message) %7B%0A        System.err.println(message);%0A        System.err.println(%22%5CnUsage:%5Cn%22%0A                + %22%5Ctmvn exec:java -Dexec.mainClass=%5C%22%22+WordMapSize.class.getName()+%22%5C%22 -Dexec.args=%5C%22wordMap%5C%22%22);%0A        System.exit(-1);%0A    %7D%0A%0A    public static void main(String%5B%5D args) throws Exception %7B%0A        if(args.length != 1) %7B%0A            fail(%22Wrong number of arguments%22);%0A        %7D%0A        final File wordMapFile = new File(args%5B0%5D);%0A        if(!wordMapFile.exists() %7C%7C !wordMapFile.canRead()) %7B%0A            fail(%22Cannot read wordMap%22);%0A        %7D%0A        %0A        int W = 0;%0A        int n = 0;%0A        final DataInputStream data = new DataInputStream(new FileInputStream(wordMapFile));%0A        while(data.available() %3E 0) %7B%0A            data.readUTF();%0A            int w = data.readInt();%0A            if(w %3E W) %7B%0A                W = w;%0A            %7D%0A            if(++n %25 10000 == 0) %7B%0A                System.err.print(%22.%22);%0A            %7D%0A        %7D%0A        data.close();%0A        System.err.println();%0A        System.out.print(%22W=%22 + (W+1));%0A    %7D%0A%7D%0A%0A 

Add word map counter