public void Setup() { cloudLayouter = new CircularCloudLayouter(new Point(0, 0)); sizeChooser = new WordCountSizeChooser(); var stat = new Dictionary <WordStatistics.WordStatistics, int>(); var counter = 1; foreach (var word in words) { stat[new WordStatistics.WordStatistics(word, StatisticsType.WordCount)] = counter++; } analyzedText = new AnalyzedText(words, stat); }
public AnalyzedLayoutedText GetLayoutedText(AnalyzedText analyzedText) { var layouter = cloudLayouterConfiguration.GetCloudLayouter(); var sizes = sizeChooser.GetWordSizes(analyzedText, 20, 20); var layout = new Dictionary <Word, Rectangle>(); foreach (var wordSizePair in sizes.OrderByDescending(x => x.Value.Width)) { layout[wordSizePair.Key] = layouter.PutNextRectangle(wordSizePair.Value); } return(analyzedText.ToLayoutedText(layout .Select(x => new LayoutedWord(x.Key, x.Value)) .ToArray())); }
public Dictionary <Word, Size> GetWordSizes(AnalyzedText analyzedText, int wordHeight = 100, float letterToWidthRatio = 100f) { var sizes = new Dictionary <Word, Size>(); foreach (var word in analyzedText.Words) { var scale = Math.Sqrt(analyzedText.GetStat(word, StatisticsType.WordCount)); sizes[word] = new Size((int)(word.Value.Length * letterToWidthRatio * scale), (int)(wordHeight * scale)); } return(sizes); }
public string GetAnalyzedText(string name) { CloudTableClient tableClient = GetContainer(); // Create the CloudTable object that represents the "quotes" table. CloudTable table = tableClient.GetTableReference(ContainerName.analyzedText.ToString()); List <string> t = new List <string>(); TableOperation to = TableOperation.Retrieve <AnalyzedText>("Image", name); AnalyzedText tr = (AnalyzedText)table.ExecuteAsync(to).Result.Result; if (tr != null) { return(tr.Text); } else { return(""); } }