<commit_before>/**
 * 
 */
package uk.bl.dpt.foreg;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.net.Authenticator;
import java.net.PasswordAuthentication;

import javax.xml.bind.JAXBException;

import org.python.core.PyInteger;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;

import eu.planets_project.ifr.core.techreg.formats.SigFileUtils;
import uk.gov.nationalarchives.pronom.SigFile;

/**
 * @author <EMAIL>
 *
 */
public class ForegCmd {

	/**
	 * Apache CLI
	 * http://commons.apache.org/cli/usage.html
	 * 
	 * @param args
	 * @throws JAXBException 
	 * @throws FileNotFoundException 
	 */
	public static void main(String[] args)  {
		downloadSigFile();
		pythonInvoker();
	}
	
	/**
	 * See Jython Integration
	 * http://jythonpodcast.hostjava.net/jythonbook/en/1.0/JythonAndJavaIntegration.html
	 */
	static void pythonInvoker() {
		PythonInterpreter interp = new PythonInterpreter();
        //interp.exec("import sys");
        //interp.exec("print sys");
        interp.set("a", new PyInteger(42));
        interp.exec("print a");
        interp.exec("x = 2+2");
        PyObject x = interp.get("x");
        System.out.println("x: " + x);
        // Attempt to load the formats script:"<commit_msg>Now updates cache correctly.<commit_after>/**
 * 
 */
package uk.bl.dpt.foreg;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.net.Authenticator;
import java.net.PasswordAuthentication;

import javax.xml.bind.JAXBException;

import org.python.core.PyInteger;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;

import eu.planets_project.ifr.core.techreg.formats.SigFileUtils;
import uk.gov.nationalarchives.pronom.SigFile;

/**
 * @author Andrew.Jackson<EMAIL>
 *
 */
public class ForegCmd {

	/**
	 * Apache CLI
	 * http://commons.apache.org/cli/usage.html
	 * 
	 * @param args
	 * @throws Exception 
	 * @throws JAXBException 
	 * @throws FileNotFoundException 
	 */
	public static void main(String[] args) throws Exception  {
		//downloadSigFile();
		SigFileUtils.downloadAllPronomFormatRecords(new File("data/pronom"));
		//pythonInvoker();
	}
	
	/**
	 * See Jython Integration
	 * http://jythonpodcast.hostjava.net/jythonbook/en/1.0/JythonAndJavaIntegration.html
	 */
	static void pythonInvoker() {
		PythonInterpreter interp = new PythonInterpreter();
        //interp.exec("import sys");
        //interp.exec("print sys");
        interp.set("a", new PyInteger(42));
        interp.exec("print a");
        interp.exec("x = 2+2");
        PyObject x = interp.get("x");
        System.out.println("x: " + x);
        // Attempt to load the formats script:"
{'fraction_non_alphanumeric': 0.14107274063188832, 'fraction_numerical': 0.00440852314474651, 'mean_word_length': 3.4933993399339935, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2391329', 'n_tokens_mistral': 932, 'n_tokens_neox': 881, 'n_words': 164}