<commit_before>﻿using System;

using FluentAssertions;

using Xunit;

namespace Grobid.PdfToXml.Test
{
    public class IndexGeneratorTest
    {
        [Fact]
        public void PageIndexShouldIncrementOnCall()
        {
            var testSubject = new IndexGenerator();
            testSubject.PageIndex.Should().Be("p1");
            testSubject.PageIndex.Should().Be("p2");
            testSubject.PageIndex.Should().Be("p3");
        }

        [Fact]
        public void TextIndexShouldIncrementOnCall()
        {
            var testSubject = new IndexGenerator();
            testSubject.PageIndex.Should().Be("p1");
            testSubject.TextIndex.Should().Be("p1_t1");
            testSubject.TextIndex.Should().Be("p1_t2");
            testSubject.TextIndex.Should().Be("p1_t3");
        }
    }

    public class IndexGenerator
    {
        private int pageIndex;
        private int textIndex;

        public string PageIndex
        {
            get
            {
                this.pageIndex++;
                return String.Format("p{0}", this.pageIndex);
            }
        }

        public string TextIndex
        {
            get
            {
                this.textIndex++;
                return String.Format("p{0}_t{1}", this.pageIndex, this.textIndex);
            }
        }
    }
}
<commit_msg>Roll TextIndex on PageIndex change.<commit_after>﻿using System;

using FluentAssertions;

using Xunit;

namespace Grobid.PdfToXml.Test
{
    public class IndexGeneratorTest
    {
        [Fact]
        public void PageIndexShouldIncrementOnCall()
        {
            var testSubject = new IndexGenerator();
            testSubject.PageIndex.Should().Be("p1");
            testSubject.PageIndex.Should().Be("p2");
            testSubject.PageIndex.Should().Be("p3");
        }

        [Fact]
        public void TextIndexShouldIncrementOnCall()
        {
            var testSubject = new IndexGenerator();
            testSubject.PageIndex.Should().Be("p1");
            testSubject.TextIndex.Should().Be("p1_t1");
            testSubject.TextIndex.Should().Be("p1_t2");
            testSubject.TextIndex.Should().Be("p1_t3");
        }

        [Fact]
        public void TextIndexShouldRollOnPageChange()
        {
            var testSubject = new IndexGenerator();
            testSubject.PageIndex.Should().Be("p1");
            testSubject.TextIndex.Should().Be("p1_t1");
            testSubject.TextIndex.Should().Be("p1_t2");
            testSubject.PageIndex.Should().Be("p2");
            testSubject.TextIndex.Should().Be("p2_t1");
            testSubject.TextIndex.Should().Be("p2_t2");
        }
    }

    public class IndexGenerator
    {
        private int pageIndex;
        private int textIndex;

        public string PageIndex
        {
            get
            {
                this.pageIndex++;
                this.textIndex = 0;
                return String.Format("p{0}", this.pageIndex);
            }
        }

        public string TextIndex
        {
            get
            {
                this.textIndex++;
                return String.Format("p{0}_t{1}", this.pageIndex, this.textIndex);
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.11047733413389373, 'fraction_numerical': 0.011107775442809968, 'mean_word_length': 1.5147169811320755, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7241856', 'n_tokens_mistral': 921, 'n_tokens_neox': 873, 'n_words': 140}