Ejemplo n.º 1
0
        private IEnumerable <TextImage> GetStringImages(
            string text,
            Color[] colors,
            double minFont  = 1.0,
            double maxFont  = 10.0,
            string fontName = "Arial"
            )
        {
            var textWithoutSigns = _textCleaner.RemoveSigns(text);

            var words = _wordExtractor
                        .ExtractWords(textWithoutSigns)
                        .Where(_filter.IsNecessaryPartOfSpeech)
                        .Select(_formatter.GetOriginal)
                        .ToArray();

            var weights = _lexicAnalysator.GetWeights(words);

            var stringImages = _textVisualisator
                               .CreateTextImages(weights)
                               .SetFontSizes(minFont, maxFont)
                               .SetColors(colors)
                               .SetFontTipe(fontName)
                               .GetStringImages();

            return(stringImages);
        }
Ejemplo n.º 2
0
        private IEnumerable <TextImage> GetStringImages(
            IEnumerable <string> texts,
            Color[] colors,
            double minFont  = 1.0,
            double maxFont  = 10.0,
            string fontName = "Arial"
            )
        {
            var listWords      = new List <string>();
            var extractedWords = texts.Select(strs => wordExtractor.ExtractWords(strs)).ToList();

            foreach (var wordSet in extractedWords)
            {
                foreach (var word in wordSet)
                {
                    listWords.Add(word);
                }
            }


            var words = listWords
                        .Where(filter.IsNecessaryPartOfSpeech)
                        .Select(formatter.GetOriginal)
                        .Where(str => str.Length > 1)
                        .ToArray();
            var weights = lexicAnalysator.GetWeights(words);

            var stringImages = textVisualisator
                               .CreateTextImages(weights)
                               .SetFontSizes(minFont, maxFont)
                               .SetColors(colors)
                               .SetFontTipe(fontName)
                               .GetStringImages();

            return(stringImages);
        }