public void generateProfile() {
        File directory = new File(get("directory"));
        for (String lang: arglist) {
            File file = searchFile(directory, lang + "wiki-.*-abstract\\.xml.*");
            if (file == null) {
                System.err.println("Not Found abstract xml : lang = " + lang);
                continue;
            }

            FileOutputStream os = null;
            try {
                LangProfile profile = GenProfile.loadFromWikipediaAbstract(lang, file);
                profile.omitLessFreq();

                File profile_path = new File(get("directory") + "/profiles/" + lang);
                os = new FileOutputStream(profile_path);
                JSON.encode(profile, os);
            } catch (JSONException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (LangDetectException e) {
                e.printStackTrace();
            } finally {
                try {
                    if (os!=null) os.close();
                } catch (IOException e) {}
            }
        }        
    }