👔 Improve sphere word cloud again...
This commit is contained in:
@@ -88,8 +88,9 @@ public class SphereRewindServiceGrpc(
|
|||||||
.Take(1000)
|
.Take(1000)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
var segmenter = new JiebaSegmenter();
|
var segmenter = new JiebaSegmenter();
|
||||||
var words = segmenter.CutInParallel(postContents);
|
var words = segmenter.CutForSearchInParallel(postContents);
|
||||||
var allWords = words.SelectMany(w => w);
|
var allWords = words.SelectMany(w => w)
|
||||||
|
.Where(word => !word.All(c => char.IsPunctuation(c) || char.IsWhiteSpace(c)));
|
||||||
var topWords = allWords
|
var topWords = allWords
|
||||||
.GroupBy(w => w)
|
.GroupBy(w => w)
|
||||||
.Select(g => new { Word = g.Key, Count = g.Count() })
|
.Select(g => new { Word = g.Key, Count = g.Count() })
|
||||||
@@ -270,5 +271,4 @@ public class SphereRewindServiceGrpc(
|
|||||||
Data = GrpcTypeHelper.ConvertObjectToByteString(data),
|
Data = GrpcTypeHelper.ConvertObjectToByteString(data),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user