コード例 #1
0
 public DocumentSummaryProfile()
 {
     // Creates map to document summary
     // Doesn't need a reciprocal mapping, this is a one-way mapping
     this.CreateMap <data.Document, DocumentSummary>()
     .ForMember(m => m.SummaryText, o => o.MapFrom(src => TextManipulations.Summarize(src.Text)));
 }
コード例 #2
0
        public void CanStripLyricMarkerWhenSummarizing()
        {
            var text    = $"#{RandomValueGenerator.AlphaNumericTextWithSpaces(10, 20)}\n#{RandomValueGenerator.AlphaNumericTextWithSpaces(10, 20)}";
            var newText = TextManipulations.Summarize(text);

            Assert.IsFalse(newText.Contains('#'));
        }
コード例 #3
0
        public void CanStripSectionsWhenSummarizing()
        {
            var section = $"[{RandomValueGenerator.AlphaNumericText(10, 20)}]";
            var text    = $"{RandomValueGenerator.AlphaNumericTextWithSpaces(10, 20)}\n{section}";
            var newText = TextManipulations.Summarize(text);

            Assert.IsFalse(newText.Contains(section));
        }
コード例 #4
0
        public void CanStripAnnotationsWhenSummarizing()
        {
            var annotation = $"!{RandomValueGenerator.AlphaNumericTextWithSpaces(10, 20)}";
            var text       = $"{annotation}\n{RandomValueGenerator.AlphaNumericTextWithSpaces(10, 20)}";
            var newText    = TextManipulations.Summarize(text);

            Assert.IsFalse(newText.Contains('!'));
            Assert.IsFalse(newText.Contains(annotation.Substring(1)));
        }
コード例 #5
0
        public void CanStripChordsWhenSummarizing()
        {
            var chords  = $"@{RandomValueGenerator.AlphaNumericTextWithSpaces(10, 20)}";
            var text    = $"{chords}\n{RandomValueGenerator.AlphaNumericTextWithSpaces(10, 20)}";
            var newText = TextManipulations.Summarize(text);

            Assert.IsFalse(newText.Contains('@'));
            Assert.IsFalse(newText.Contains(chords.Substring(1)));
        }