<commit_before>package eu.modernmt.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Iterator;

/**
 * Created by davide on 31/08/16.
 */
public class Alignment implements Iterable<int[]>, Serializable {

    private final int[] sourceIndexes;
    private final int[] targetIndexes;
    private final float score;

    public static Alignment fromAlignmentPairs(int[][] pairs) {
        return fromAlignmentPairs(pairs, 0);
    }

    public static Alignment fromAlignmentPairs(int[][] pairs, float score) {
        int[] sourceIndexes = new int[pairs.length];
        int[] targetIndexes = new int[pairs.length];

        for (int i = 0; i < pairs.length; i++) {
            sourceIndexes[i] = pairs[i][0];
            targetIndexes[i] = pairs[i][1];
        }

        return new Alignment(sourceIndexes, targetIndexes, score);
    }

    public Alignment(int[] sourceIndexes, int[] targetIndexes) {
        this(sourceIndexes, targetIndexes, 0);
    }

    public Alignment(int[] sourceIndexes, int[] targetIndexes, float score) {
        this.sourceIndexes = sourceIndexes;
        this.targetIndexes = targetIndexes;
        this.score = score;
    }

    public int[] getSourceIndexes() {
        return sourceIndexes;
    }

    public int[] getTargetIndexes() {
        return targetIndexes;
    }

    public int size() {
        return sourceIndexes.length;<commit_msg>added support function for Alignment<commit_after>package eu.modernmt.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Iterator;

/**
 * Created by davide on 31/08/16.
 */
public class Alignment implements Iterable<int[]>, Serializable {

    private final int[] sourceIndexes;
    private final int[] targetIndexes;
    private final float score;

    public static Alignment fromAlignmentPairs(int[][] pairs) {
        return fromAlignmentPairs(pairs, 0);
    }

    public static Alignment fromAlignmentPairs(int[][] pairs, float score) {
        int[] sourceIndexes = new int[pairs.length];
        int[] targetIndexes = new int[pairs.length];

        for (int i = 0; i < pairs.length; i++) {
            sourceIndexes[i] = pairs[i][0];
            targetIndexes[i] = pairs[i][1];
        }

        return new Alignment(sourceIndexes, targetIndexes, score);
    }

    public static Alignment fromAlignmentPairs(String string) {
        String[] pairsString = string.split(" ");

        int[][] pairs = new int[pairsString.length][];
        for (int i = 0; i < pairsString.length; i++) {
            String[] point = pairsString[i].split("-");
            pairs[i] = new int[]{Integer.parseInt(point[0]), Integer.parseInt(point[1])};
        }

        return fromAlignmentPairs(pairs);
    }

    public Alignment(int[] sourceIndexes, int[] targetIndexes) {
        this(sourceIndexes, targetIndexes, 0);
    }

    public Alignment(int[] sourceIndexes, int[] targetIndexes, float score) {
        this.sourceIndexes = sourceIndexes;
        this.targetIndexes = targetIndexes;
        this.score = score;
    }

    public int[] getSourceIndexes() {
        return sourceIndexes;
    }

    public int[] getTargetIndexes() {
        return targetIndexes;
    }

    public int size() {
        return sourceIndexes.length;
{'fraction_non_alphanumeric': 0.11651376146788991, 'fraction_numerical': 0.00764525993883792, 'mean_word_length': 2.875592417061611, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '978349', 'n_tokens_mistral': 985, 'n_tokens_neox': 950, 'n_words': 243}