👔 Update jieba config for cutting words

This commit is contained in:
2025-12-27 01:54:49 +08:00
parent be176ef0c2
commit 9d1bc46bf1

View File

@@ -86,7 +86,7 @@ public class SphereRewindServiceGrpc(
.Take(1000)
.ToListAsync();
var segmenter = new JiebaSegmenter();
var words = segmenter.CutForSearchInParallel(postContents);
var words = segmenter.CutInParallel(postContents, cutAll: true, hmm: false);
var allWords = words.SelectMany(w => w);
var topWords = allWords
.GroupBy(w => w)
@@ -132,7 +132,8 @@ public class SphereRewindServiceGrpc(
.Where(c => c.Room.Type == ChatRoomType.Group)
.Select(c => new { c.RoomId, c.CreatedAt, c.EndedAt })
.ToListAsync();
var callDurations = groupCallRecords.Select(c => new { c.RoomId, Duration = (c.EndedAt ?? now).Minus(c.CreatedAt).Seconds }).ToList();
var callDurations = groupCallRecords
.Select(c => new { c.RoomId, Duration = (c.EndedAt ?? now).Minus(c.CreatedAt).Seconds }).ToList();
var mostCalledRoomInfo = callDurations
.GroupBy(c => c.RoomId)
.Select(g => new { RoomId = g.Key, TotalDuration = g.Sum(c => c.Duration) })
@@ -150,7 +151,8 @@ public class SphereRewindServiceGrpc(
.Where(c => c.Room.Type == ChatRoomType.DirectMessage)
.Select(c => new { c.RoomId, c.CreatedAt, c.EndedAt, c.Room })
.ToListAsync();
var directCallDurations = directCallRecords.Select(c => new { c.RoomId, c.Room, Duration = (c.EndedAt ?? now).Minus(c.CreatedAt).Seconds }).ToList();
var directCallDurations = directCallRecords
.Select(c => new { c.RoomId, c.Room, Duration = (c.EndedAt ?? now).Minus(c.CreatedAt).Seconds }).ToList();
var mostCalledDirectRooms = directCallDurations
.GroupBy(c => c.RoomId)
.Select(g => new { ChatRoom = g.First().Room, TotalDuration = g.Sum(c => c.Duration) })
@@ -233,4 +235,4 @@ public class SphereRewindServiceGrpc(
Data = GrpcTypeHelper.ConvertObjectToByteString(data)
};
}
}
}