<commit_before>package ch.openech.dm;

import java.util.Map.Entry;

import ch.openech.dm.code.EchCodes;
import ch.openech.mj.db.model.Code;
import ch.openech.mj.db.model.Format;
import ch.openech.mj.db.model.Formats;
import ch.openech.mj.db.model.PlainFormat;
import ch.openech.xml.write.EchNamespaceContext;


public class EchFormats {
	
	// public static final String date = "http://www.w3.org/2001/XMLSchema:date";
	// public static final String datePartiallyKnown = "http://www.ech.ch/xmlns/eCH-0044/2:datePartiallyKnown";

	public static final String baseName = "baseName";
	public static final String organisationName = "organisationName";
	public static final String addressLine = "addressLine";
	public static final String yesNo = "yesNo";
	
	public static final String residencePermit = "residencePermit";
	public static final String basedOnLaw = "basedOnLaw";

	// eCH 11
	public static final String originName = "originName";
	
	// eCH 20/21
	public static final String jobTitle = "jobTitle";
	public static final String employer = "employer";

	public static final String typeOfContact = "typeOfContact";

	public static final String cantonAbbreviation = "cantonAbbreviation";
	public static final Format cantonAbbreviationFormat = new PlainFormat(2);
	
	static {
		Formats formats = Formats.getInstance();
		
		EchNamespaceContext echNamespaceContext = EchNamespaceContext.getNamespaceContext(20, "2.2");	
		for (Entry<String, Format> type : echNamespaceContext.getSimpleTypes().entrySet()) {
			formats.register(type.getKey(), type.getValue());
		}
		
		// Von den Schemas nicht abgedeckte Formate
		
		formats.register(jobTitle, new PlainFormat(100));
		formats.register(employer, new PlainFormat(100));
		formats.register(originName, new PlainFormat(50));
		
		// codes

		for (Entry<String, Code> type : EchCodes.getCodes().entrySet()) {
			formats.register(type.getKey(), type.getValue());
		}

		formats.register(typeOfContact, new PlainFormat(1));
		formats.register("category", new PlainFormat(1));
		
		formats.register(cantonAbbreviation, cantonAbbreviationFormat);
	}

	public static void initialize() {
		// nothing to do, everything done in static initializer
	}
}<commit_msg>EchFormats: Auch Organisations-Formate einlesen<commit_after>package ch.openech.dm;

import java.util.Map.Entry;

import ch.openech.dm.code.EchCodes;
import ch.openech.mj.db.model.Code;
import ch.openech.mj.db.model.Format;
import ch.openech.mj.db.model.Formats;
import ch.openech.mj.db.model.PlainFormat;
import ch.openech.xml.write.EchNamespaceContext;


public class EchFormats {
	
	// public static final String date = "http://www.w3.org/2001/XMLSchema:date";
	// public static final String datePartiallyKnown = "http://www.ech.ch/xmlns/eCH-0044/2:datePartiallyKnown";

	public static final String baseName = "baseName";
	public static final String organisationName = "organisationName";
	public static final String addressLine = "addressLine";
	public static final String yesNo = "yesNo";
	
	public static final String residencePermit = "residencePermit";
	public static final String basedOnLaw = "basedOnLaw";

	// eCH 11
	public static final String originName = "originName";
	
	// eCH 20/21
	public static final String jobTitle = "jobTitle";
	public static final String employer = "employer";

	public static final String typeOfContact = "typeOfContact";

	public static final String cantonAbbreviation = "cantonAbbreviation";
	public static final Format cantonAbbreviationFormat = new PlainFormat(2);
	
	static {
		Formats formats = Formats.getInstance();
		
		registerXmlSimpleTypes(20, "2.2");
		registerXmlSimpleTypes(148, "1.0");
		
		// Von den Schemas nicht abgedeckte Formate
		
		formats.register(jobTitle, new PlainFormat(100));
		formats.register(employer, new PlainFormat(100));
		formats.register(originName, new PlainFormat(50));
		
		// codes

		for (Entry<String, Code> type : EchCodes.getCodes().entrySet()) {
			formats.register(type.getKey(), type.getValue());
		}

		formats.register(typeOfContact, new PlainFormat(1));
		formats.register("category", new PlainFormat(1));
		
		formats.register(cantonAbbreviation, cantonAbbreviationFormat);
	}
	
	static void registerXmlSimpleTypes(int root, String version) {
		EchNamespaceContext echNamespaceContext = EchNamespaceContext.getNamespaceContext(root, version);
		for (Entry<String, Format> type : echNamespaceContext.getSimpleTypes().entrySet()) {
			Formats.getInstance().register(type.getKey(), type.getValue());
		}
	}

	public static void initialize() {
		// nothing to do, everything done in static initializer
	}
}
{'fraction_non_alphanumeric': 0.10916385135135136, 'fraction_numerical': 0.014146959459459459, 'mean_word_length': 4.22271223814774, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, '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': '1364951', 'n_tokens_mistral': 1632, 'n_tokens_neox': 1425, 'n_words': 345}