コード例 #1
0
        /// <inheritdoc />
        public SmsSplittingResult SplitMessageWithWordWrap(string text, bool concatenatedSms = true)
        {
            if (text == null)
            {
                throw new ArgumentNullException(nameof(text));
            }

            if (text == string.Empty)
            {
                return(new SmsSplittingResult
                {
                    Encoding = SmsEncoding.Gsm7Bit,
                    Parts = new List <SmsPart>()
                });
            }

            var encoding = GetEncoding(text);
            var blocks   = TextSplitter.Split(text, encoding);
            var builder  = new SmsBuilder(blocks, encoding, concatenatedSms);

            return(new SmsSplittingResult
            {
                Encoding = encoding,
                Parts = builder.Parts
            });
        }
コード例 #2
0
 private IEnumerable <string> SplitInput(string inputText)
 {
     if (TextSplitter != null)
     {
         return(TextSplitter.Split(inputText));
     }
     return(new[] { inputText });
 }
コード例 #3
0
        public void PositiveCaseLongText(
            string text,
            int symbolsCountPerSegment)
        {
            TextSplitter splitter = new TextSplitter(text);

            string[] split = splitter.Split(symbolsCountPerSegment);
            foreach (var sp in split)
            {
                Assert.True(sp.Length <= symbolsCountPerSegment);
            }
        }
コード例 #4
0
        private static void AddWords(OneToSetMap <string, string> wordsPerAssembly, JetHashSet <string> abbreviations,
                                     IAssemblyPsiModule assemblyPsiModule, string name)
        {
            var textParts = TextSplitter.Split(name);

            foreach (var textPart in textParts.Where(tp => tp.Type == TextPartType.Word))
            {
                if (textPart.Text == textPart.Text.ToUpperInvariant())
                {
                    abbreviations.Add(textPart.Text);
                }
                else
                {
                    wordsPerAssembly.Add(assemblyPsiModule.Assembly.AssemblyName.Name, textPart.Text);
                }
            }
        }
コード例 #5
0
        private async Task ResumeAfterRateIsSet(
            IDialogContext context,
            IAwaitable <long> argument)
        {
            rating = (int)await argument;
            string message = GetMessageAfterRatingSet(rating);
            await context.SayAsync(message);

            var    scraper      = new ScraperService();
            string scrappedText = await scraper.ScrapAsync(link);

            TextSplitter splitter = new TextSplitter(scrappedText.Trim());

            string[] split         = splitter.Split(MaxDocumentLength);
            var      textAnalytics = new TextAnalyticsApiService();
            var      keywords      = await textAnalytics.GetKeywordsAsync(split);

            await context.PostAsync($"Keywords: {String.Join(",", keywords)}");

            context.Done <object>(null);
        }
コード例 #6
0
 public void DefaultImplementation(String input, String[] output)
 {
     Assert.AreEqual(output, _splitter.Split(input));
 }