public static void buildDictionary(final File inputFile, final File resourcesFolder) throws IOException, ParserConfigurationException, SAXException {
        if (!inputFile.isFile() || !inputFile.exists()) {
            throw new IllegalArgumentException("Could not find input file " + inputFile);
        }
        final File tempOutputFile = File.createTempFile("make_dictionary_temp", "bin");

        if (!resourcesFolder.isDirectory() || !resourcesFolder.exists()) {
            throw new IllegalArgumentException("Could not find resource folder " + resourcesFolder);
        }

        final File outputFolder = new File(resourcesFolder, "raw/");
        final File dict_id_array = new File(resourcesFolder, "values/words_dict_array.xml");
        
        System.out.println("Reading words from input " + inputFile.getAbsolutePath());
        System.out.println("Will store output files under " + outputFolder.getAbsolutePath());
        System.out.println("Deleting previous versions...");

        //deleting current files
        tempOutputFile.delete();
        File[] dictFiles = outputFolder.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                return name.endsWith(".dict");
            }
        });
        if (dictFiles != null && dictFiles.length > 0) {
            for (File file : dictFiles) {
                file.delete();
            }
        }
        dict_id_array.delete();

        MakeBinaryDictionary maker = new MakeBinaryDictionary(inputFile.getAbsolutePath(), tempOutputFile.getAbsolutePath());
        maker.makeDictionary();
        //now, if the file is larger than 1MB, I'll need to split it to 1MB chunks and rename them.
        if (!tempOutputFile.exists()) {
            throw new IOException("Failed to create binary dictionary file.");
        }

        if (tempOutputFile.length() <= 0) {
            throw new IOException("Failed to create binary dictionary file. Size zero.");
        }

        BinaryDictionaryResourceNormalizer normalizer = new BinaryDictionaryResourceNormalizer(tempOutputFile, outputFolder, dict_id_array);
        normalizer.writeDictionaryIdsResource();

        System.out.println("Done.");
    }