<commit_before>import { AbbreviationNode, Repeater } from '@emmetio/abbreviation';
import { Container } from '../utils';
import { Config } from '../../config';
import { resolveImplicitTag } from '../implicit-tag';
import latin from './latin.json';
import ru from './russian.json';
import sp from './spanish.json';

interface LoremVocabulary {
    common: string[];
    words: string[];
}

const vocabularies: { [lang: string]: LoremVocabulary } = { ru, sp, latin };
const reLorem = /^lorem([a-z]*)(\d*)(-\d*)?$/i;

export default function lorem(node: AbbreviationNode, ancestors: Container[], config: Config) {
    let m: RegExpMatchArray | null;
    if (node.name && (m = node.name.match(reLorem))) {
        const db: LoremVocabulary = vocabularies[m[1]] || vocabularies.latin;
        const minWordCount = m[2] ? Math.max(1, Number(m[2])) : 30;
        const maxWordCount = m[3] ? Math.max(minWordCount, Number(m[2].slice(1))) : minWordCount;
        const wordCount = rand(minWordCount, maxWordCount);
        const repeat = node.repeat || findRepeater(ancestors);

        node.name = node.attributes = void 0;
        node.value = [paragraph(db, wordCount, !repeat || repeat.value === 0)];

        if (node.repeat && ancestors.length > 1) {<commit_msg>Fixed number of words in Lorem Ipsum generator<commit_after>import { AbbreviationNode, Repeater } from '@emmetio/abbreviation';
import { Container } from '../utils';
import { Config } from '../../config';
import { resolveImplicitTag } from '../implicit-tag';
import latin from './latin.json';
import ru from './russian.json';
import sp from './spanish.json';

interface LoremVocabulary {
    common: string[];
    words: string[];
}

const vocabularies: { [lang: string]: LoremVocabulary } = { ru, sp, latin };
const reLorem = /^lorem([a-z]*)(\d*)(-\d*)?$/i;

export default function lorem(node: AbbreviationNode, ancestors: Container[], config: Config) {
    let m: RegExpMatchArray | null;
    if (node.name && (m = node.name.match(reLorem))) {
        const db: LoremVocabulary = vocabularies[m[1]] || vocabularies.latin;
        const minWordCount = m[2] ? Math.max(1, Number(m[2])) : 30;
        const maxWordCount = m[3] ? Math.max(minWordCount, Number(m[3].slice(1))) : minWordCount;
        const wordCount = rand(minWordCount, maxWordCount);
        const repeat = node.repeat || findRepeater(ancestors);

        node.name = node.attributes = void 0;
        node.value = [paragraph(db, wordCount, !repeat || repeat.value === 0)];

        if (node.repeat && ancestors.length > 1) {
{'fraction_non_alphanumeric': 0.16464131713053703, 'fraction_numerical': 0.009408075264602116, 'mean_word_length': 3.673992673992674, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1430005', 'n_tokens_mistral': 847, 'n_tokens_neox': 830, 'n_words': 211}