. , - , , "" ( ). " ", , . "" "" , .
A method to find out how many highlighted indicators are within the "block size" in front of your example can be better done, I think.
Pseudo
string GetHighestDensityChunk(){
int position
int bestPositionSoFar = 0
int maxHighLightedCountSoFar = 0
for each position in {possible start position}
{
highlightedCount = GetNumberOfHighlightedWithinChunkSize(position)
if(highlightedCount > maxHighLightedCountSoFar)
{
maxHighLightedCountSoFar = highlightedCount
bestPositionSoFar = position
}
}
{revised chunk size} = sample.indexOf(' ', startingAt = bestPositionSoFar + {chunk size}) - bestPositionSoFar
return sample.substring(bestPositionSoFar, {revised chunk size})
}
int GetNumberOfHighlightedWithinChunkSize(position)
{
numberOfHighlightedInRange = 0
for(int i= {possible start position}.indexOf(position); i<= {possible start position}.length; i++){
if({possible start position}[i] < position + {chunk size}){
numberOfHighlightedInRange++;
} else {
break;
}
}
return numberOfHighlightedInRange;
}
source
share