<commit_before>import data.Devices;
import data.Language;
import org.xml.sax.SAXException;
import parser.DevicesParser;
import parser.LanguageParser;

import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.PrintWriter;

public class Main {

	public static void main(String[] args) {
		processDevices();
		processLanguages();
	}


	private static void processDevices() {
		File file = new File("xml/devices.xml");

		try {
			System.out.println(String.format("Loading devices specification from '%s'", file.getAbsolutePath()));

			Devices devices = DevicesParser.parse(file);

			File dir = new File("export/objects/");
			dir.mkdirs();

			String name = "devices.java";
			File output = new File(dir, name);

			System.out.println(String.format("Saving devices objects to '%s'", output.getAbsolutePath()));
			PrintWriter writer = new PrintWriter(output, "UTF-8");

			devices.printDevicesJava(writer);

			writer.close();
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (SAXException e) {
			e.printStackTrace();
		}
	}

	private static void processLanguages() {
		File[] files = new File("xml/languages/").listFiles(new FilenameFilter() {
			@Override
			public boolean accept(File dir, String name) {
				return name.startsWith("language_") && name.endsWith(".xml");
			}
		});

		for (File file : files) {
			try {
				System.out.println(String.format("Loading translation from '%s'", file.getAbsolutePath()));

				Language language = LanguageParser.parse(file);

				File dir = new File(String.format("export/values-%s/", language.getCode()));
				dir.mkdirs();

				String name = "generated_strings_devices.xml";
				File output = new File(dir, name);

				System.out.println(String.format("Saving Android's strings XML to '%s'", output.getAbsolutePath()));
				PrintWriter writer = new PrintWriter(output, "UTF-8");
				language.printAndroidXml(writer);
				writer.close();
			} catch (ParserConfigurationException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			} catch (SAXException e) {
				e.printStackTrace();
			}
		}
	}

}<commit_msg>For default (en) language, use output folder as "values", not "values-en"<commit_after>import data.Devices;
import data.Language;
import org.xml.sax.SAXException;
import parser.DevicesParser;
import parser.LanguageParser;

import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.PrintWriter;

public class Main {

	public static final String DEFAULT_LANG_CODE = "en";

	public static void main(String[] args) {
		processDevices();
		processLanguages();
	}


	private static void processDevices() {
		File file = new File("xml/devices.xml");

		try {
			System.out.println(String.format("Loading devices specification from '%s'", file.getAbsolutePath()));

			Devices devices = DevicesParser.parse(file);

			File dir = new File("export/objects/");
			dir.mkdirs();

			String name = "devices.java";
			File output = new File(dir, name);

			System.out.println(String.format("Saving devices objects to '%s'", output.getAbsolutePath()));
			PrintWriter writer = new PrintWriter(output, "UTF-8");

			devices.printDevicesJava(writer);

			writer.close();
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (SAXException e) {
			e.printStackTrace();
		}
	}

	private static void processLanguages() {
		File[] files = new File("xml/languages/").listFiles(new FilenameFilter() {
			@Override
			public boolean accept(File dir, String name) {
				return name.startsWith("language_") && name.endsWith(".xml");
			}
		});

		for (File file : files) {
			try {
				System.out.println(String.format("Loading translation from '%s'", file.getAbsolutePath()));

				Language language = LanguageParser.parse(file);

				String path = language.getCode().equalsIgnoreCase(DEFAULT_LANG_CODE) ? "export/values/" : String.format("export/values-%s/", language.getCode());

				File dir = new File(path);
				dir.mkdirs();

				String name = "generated_strings_devices.xml";
				File output = new File(dir, name);

				System.out.println(String.format("Saving Android's strings XML to '%s'", output.getAbsolutePath()));
				PrintWriter writer = new PrintWriter(output, "UTF-8");
				language.printAndroidXml(writer);
				writer.close();
			} catch (ParserConfigurationException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			} catch (SAXException e) {
				e.printStackTrace();
			}
		}
	}

}
{'fraction_non_alphanumeric': 0.14, 'fraction_numerical': 0.0008421052631578948, 'mean_word_length': 4.220879120879121, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3723059', 'n_tokens_mistral': 1617, 'n_tokens_neox': 1386, 'n_words': 337}