<commit_before>package com.airhacks.enhydrator.out;

/*
 * #%L
 * enhydrator
 * %%
 * Copyright (C) 2014 - 2015 <NAME>
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
import com.airhacks.enhydrator.in.Row;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Objects;
import static java.util.Objects.requireNonNull;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author airhacks.com
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "scriptable-sink")
public class ScriptableSink extends SinkTemplate {

    private static final String DEFAULT_NAME = "script";

    @XmlTransient
    private ScriptEngine engine;
    @XmlTransient
    private Invocable invocable;

    @XmlElement(name = "script-file")
    private String scriptFile;

    @XmlTransient
    private String scriptContent;

    @XmlTransient
    private Sink sink;

    public ScriptableSink(String scriptFile) {
        super(DEFAULT_NAME);
        this.scriptFile = scriptFile;
    }

    public ScriptableSink() {
    }

    public String load(String file) throws IOException {
        return new String(Files.readAllBytes(Paths.get(file)), "UTF-8");
    }
<commit_msg>Additional constructor for custom naming added.<commit_after>package com.airhacks.enhydrator.out;

/*
 * #%L
 * enhydrator
 * %%
 * Copyright (C) 2014 - 2015 <NAME>
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
import com.airhacks.enhydrator.in.Row;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Objects;
import static java.util.Objects.requireNonNull;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author <EMAIL>
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "scriptable-sink")
public class ScriptableSink extends SinkTemplate {

    private static final String DEFAULT_NAME = "script";

    @XmlTransient
    private ScriptEngine engine;
    @XmlTransient
    private Invocable invocable;

    @XmlElement(name = "script-file")
    private String scriptFile;

    @XmlTransient
    private String scriptContent;

    @XmlTransient
    private Sink sink;

    public ScriptableSink(String scriptFile) {
        super(DEFAULT_NAME);
        this.scriptFile = scriptFile;
    }

    public ScriptableSink(String name, String scriptFile) {
        super(name);
        this.scriptFile = scriptFile;
    }

    public ScriptableSink() {
    }

    public String load(String file) throws IOException {
        return new String(Files.readAllBytes(Paths.get(file)), "UTF-8");
    }

{'fraction_non_alphanumeric': 0.09471724458924831, 'fraction_numerical': 0.00605073306958343, 'mean_word_length': 3.9573241061130333, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 10}, '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': '377175', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1215, 'n_words': 361}