コード例 #1
0
        public void Texts()
        {
            var tokenizer = new LatinWordTokenizer();
            var corpus    = new UsfmFileTextCorpus(tokenizer, CorporaTestHelpers.UsfmStylesheetPath,
                                                   Encoding.UTF8, CorporaTestHelpers.UsfmTestProjectPath);

            Assert.That(corpus.Texts.Select(t => t.Id), Is.EquivalentTo(new[] { "MAT", "MRK" }));
        }
コード例 #2
0
        public void Segments_EmptyText()
        {
            var tokenizer = new LatinWordTokenizer();
            var corpus    = new UsfmFileTextCorpus(tokenizer, CorporaTestHelpers.UsfmStylesheetPath,
                                                   Encoding.UTF8, CorporaTestHelpers.UsfmTestProjectPath);

            IText text = corpus.GetText("MRK");

            TextSegment[] segments = text.Segments.ToArray();
            Assert.That(segments, Is.Empty);
        }
コード例 #3
0
        public void TryGetText()
        {
            var tokenizer = new LatinWordTokenizer();
            var corpus    = new UsfmFileTextCorpus(tokenizer, CorporaTestHelpers.UsfmStylesheetPath,
                                                   Encoding.UTF8, CorporaTestHelpers.UsfmTestProjectPath);

            IText text;

            Assert.That(corpus.TryGetText("MAT", out text), Is.True);
            Assert.That(text.Id, Is.EqualTo("MAT"));
            Assert.That(corpus.TryGetText("LUK", out _), Is.False);
        }
コード例 #4
0
        public void Segments_NonEmptyText()
        {
            var tokenizer = new LatinWordTokenizer();
            var corpus    = new UsfmFileTextCorpus(tokenizer, CorporaTestHelpers.UsfmStylesheetPath,
                                                   Encoding.UTF8, CorporaTestHelpers.UsfmTestProjectPath);

            IText text = corpus.GetText("MAT");

            TextSegment[] segments = text.Segments.ToArray();
            Assert.That(segments.Length, Is.EqualTo(10));
            Assert.That(segments[0].SegmentRef, Is.EqualTo(new VerseRef("MAT 1:1", corpus.Versification)));
            Assert.That(segments[0].Segment, Is.EqualTo("Chapter one , verse one .".Split()));
            Assert.That(segments[1].SegmentRef, Is.EqualTo(new VerseRef("MAT 1:2", corpus.Versification)));
            Assert.That(segments[1].Segment, Is.EqualTo("Chapter one , verse two .".Split()));
            Assert.That(segments[5].SegmentRef, Is.EqualTo(new VerseRef("MAT 2:1", corpus.Versification)));
            Assert.That(segments[5].Segment, Is.EqualTo("Chapter two , verse one .".Split()));
            Assert.That(segments[9].SegmentRef, Is.EqualTo(new VerseRef("MAT 2:5", corpus.Versification)));
            Assert.That(segments[9].Segment, Is.EqualTo("Chapter two , verse five .".Split()));
        }