👔 Update jieba config for cutting words
This commit is contained in:
@@ -86,7 +86,7 @@ public class SphereRewindServiceGrpc(
|
|||||||
.Take(1000)
|
.Take(1000)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
var segmenter = new JiebaSegmenter();
|
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 allWords = words.SelectMany(w => w);
|
||||||
var topWords = allWords
|
var topWords = allWords
|
||||||
.GroupBy(w => w)
|
.GroupBy(w => w)
|
||||||
@@ -132,7 +132,8 @@ public class SphereRewindServiceGrpc(
|
|||||||
.Where(c => c.Room.Type == ChatRoomType.Group)
|
.Where(c => c.Room.Type == ChatRoomType.Group)
|
||||||
.Select(c => new { c.RoomId, c.CreatedAt, c.EndedAt })
|
.Select(c => new { c.RoomId, c.CreatedAt, c.EndedAt })
|
||||||
.ToListAsync();
|
.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
|
var mostCalledRoomInfo = callDurations
|
||||||
.GroupBy(c => c.RoomId)
|
.GroupBy(c => c.RoomId)
|
||||||
.Select(g => new { RoomId = g.Key, TotalDuration = g.Sum(c => c.Duration) })
|
.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)
|
.Where(c => c.Room.Type == ChatRoomType.DirectMessage)
|
||||||
.Select(c => new { c.RoomId, c.CreatedAt, c.EndedAt, c.Room })
|
.Select(c => new { c.RoomId, c.CreatedAt, c.EndedAt, c.Room })
|
||||||
.ToListAsync();
|
.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
|
var mostCalledDirectRooms = directCallDurations
|
||||||
.GroupBy(c => c.RoomId)
|
.GroupBy(c => c.RoomId)
|
||||||
.Select(g => new { ChatRoom = g.First().Room, TotalDuration = g.Sum(c => c.Duration) })
|
.Select(g => new { ChatRoom = g.First().Room, TotalDuration = g.Sum(c => c.Duration) })
|
||||||
@@ -233,4 +235,4 @@ public class SphereRewindServiceGrpc(
|
|||||||
Data = GrpcTypeHelper.ConvertObjectToByteString(data)
|
Data = GrpcTypeHelper.ConvertObjectToByteString(data)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user