<commit_before>export abstract class XmlComponent {
    protected root: Array<XmlComponent>;
    protected rootKey: string;

    constructor(rootKey: string) {
        this.root = new Array<XmlComponent>();
        this.rootKey = rootKey;
    }

    replaceKey() {
        console.log(this.rootKey);
        console.log(this.root);
        if (this.root !== undefined) {
            this.root.forEach(root => {
                root.replaceKey();
            });
        }
        this[this.rootKey] = this.root;
        //Object(this)[this.rootKey]
        delete this.root;
    }
}

interface AttributesProperties {
    val?: any;
    color?: string;
    space?: string;
    sz?: string;
    type?: string;
    rsidR?: string;
    rsidRPr?: string;
    rsidSect?: string;
    w?: string;
    h?: string;
    top?: string;
    right?: string;
    bottom?: string;
    left?: string;
    header?: string;
    footer?: string;
    gutter?: string;
    linePitch?: string;
}

export class Attributes extends XmlComponent {
    private _attr: Object;

    xmlKeys = {
        val: "w:val",
        color: "w:color",
        space: "w:space",
        sz: "w:sz",
        type: "w:type",
        rsidR: "w:rsidR",
        rsidRPr: "w:rsidRPr",
        rsidSect: "w:rsidSect",
        w: "w:w",
        h: "w:h",
        top: "w:top",
        right: "w:right",
        bottom: "w:bottom",
        left: "w:left",
        header: "w:header",
        footer: "w:footer",
        gutter: "w:gutter",
        linePitch: "w:linePitch"
    };

    constructor(properties?: AttributesProperties) {
        super("_attr");
        this._attr = properties

        if (!properties) {
            this._attr = {};
        }

        this._attr["xmlKeys"] = this.xmlKeys;
    }
}

export class Text extends XmlComponent {
    private t: string;

    xmlKeys = {
        t: 'w:t'
    }

    constructor(text: string) {
        super("w:t");
        this.t = text;
    }
}<commit_msg>added xml unit component<commit_after>export abstract class BaseXmlComponent {
    protected rootKey: string;

    constructor(rootKey: string) {
        this.rootKey = rootKey;
    }

    abstract replaceKey(): void;
}

export abstract class XmlComponent extends BaseXmlComponent {
    protected root: Array<BaseXmlComponent>;

    constructor(rootKey: string) {
        super(rootKey);
        this.root = new Array<BaseXmlComponent>();
    }

    replaceKey(): void {
        //console.log(this.rootKey);
        //console.log(this.root);
        if (this.root !== undefined) {
            this.root.forEach(root => {
                root.replaceKey();
            });
            this[this.rootKey] = this.root;
            delete this.root;
        }
    }
}

export abstract class XmlUnitComponent extends BaseXmlComponent {
    protected root: string;

    constructor(rootKey: string) {
        super(rootKey);
    }

    replaceKey(): void {
        if (this.root !== undefined) {
            this[this.rootKey] = this.root;
            delete this.root;
        }
    }
}

interface AttributesProperties {
    val?: any;
    color?: string;
    space?: string;
    sz?: string;
    type?: string;
    rsidR?: string;
    rsidRPr?: string;
    rsidSect?: string;
    w?: string;
    h?: string;
    top?: string;
    right?: string;
    bottom?: string;
    left?: string;
    header?: string;
    footer?: string;
    gutter?: string;
    linePitch?: string;
}

export class Attributes extends XmlComponent {
    private _attr: Object;

    xmlKeys = {
        val: "w:val",
        color: "w:color",
        space: "w:space",
        sz: "w:sz",
        type: "w:type",
        rsidR: "w:rsidR",
        rsidRPr: "w:rsidRPr",
        rsidSect: "w:rsidSect",
        w: "w:w",
        h: "w:h",
        top: "w:top",
        right: "w:right",
        bottom: "w:bottom",
        left: "w:left",
        header: "w:header",
        footer: "w:footer",
        gutter: "w:gutter",
        linePitch: "w:linePitch"
    };

    constructor(properties?: AttributesProperties) {
        super("_attr");
        this._attr = properties

        if (!properties) {
            this._attr = {};
        }

        this._attr["xmlKeys"] = this.xmlKeys;
    }
}

export class Text extends XmlUnitComponent {

    constructor(text: string) {
        super("w:t"); //need special xml component
        this.root = text;
    }
}
{'fraction_non_alphanumeric': 0.13855970829535097, 'fraction_numerical': 0.0, 'mean_word_length': 1.969553450608931, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 9}, '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': '3199699', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1370, 'n_words': 312}