ConcatenateTopStringsBySalience
(
IEnumerable<IEdge> edges,
String edgeColumnName,
Int32 maximumTopStrings
)
{
Debug.Assert(edges != null);
Debug.Assert( !String.IsNullOrEmpty(edgeColumnName) );
Debug.Assert(maximumTopStrings > 0);
// Don't convert to lower case (bitly URLs are case-sensitive, for
// example), and don't skip any words.
WordCounter oWordCounter = new WordCounter( false, new String[0] );
oWordCounter.SkipUrlsAndPunctuation = false;
foreach (IEdge oEdge in edges)
{
String sSpaceDelimitedCellValue;
if ( oEdge.TryGetNonEmptyStringValue(edgeColumnName,
out sSpaceDelimitedCellValue) )
{
oWordCounter.CountTermsInDocument(sSpaceDelimitedCellValue);
}
}
oWordCounter.CalculateSalienceOfCountedTerms();
return ( String.Join(TwitterSearchNetworkWordMetricUtil.WordSeparator,
TwitterSearchNetworkStringUtil.TakeTopStringsAsArray(
(from CountedWord oCountedWord in oWordCounter.CountedTerms
orderby oCountedWord.Salience descending
select oCountedWord.Word),
maximumTopStrings
) ) );
}