Merge remote-tracking branch 'origin/main' into feat/corpus-explorer

This commit is contained in:
2026-04-10 13:19:17 +01:00
14 changed files with 881 additions and 38 deletions

View File

@@ -59,6 +59,21 @@ const CulturalStats = ({ data, onExplore }: CulturalStatsProps) => {
return `${dominantLabel} (${(dominant[1] * 100).toFixed(1)}%)`;
};
const stanceSublabel = (
per1kTokens: number | undefined,
emotionAvg: Record<string, number> | undefined,
) => {
const rateLabel =
typeof per1kTokens === "number"
? `${per1kTokens.toFixed(1)} per 1k words`
: "Word frequency";
const emotionLabel = topEmotion(emotionAvg);
return emotionLabel === "—"
? rateLabel
: `${rateLabel} • Avg mood: ${emotionLabel}`;
};
return (
<div style={styles.page}>
<div style={{ ...styles.container, ...styles.grid }}>

View File

@@ -88,6 +88,15 @@ export default function UserModal({
</div>
</div>
) : null}
{userData.dominant_topic ? (
<div style={styles.topUserItem}>
<div style={styles.topUserName}>Most Common Topic</div>
<div style={styles.topUserMeta}>
{userData.dominant_topic.topic} ({userData.dominant_topic.count} events)
</div>
</div>
) : null}
</div>
)}
</DialogPanel>

View File

@@ -34,6 +34,11 @@ type Vocab = {
top_words: FrequencyWord[];
};
type DominantTopic = {
topic: string;
count: number;
};
type User = {
author: string;
post: number;
@@ -41,6 +46,7 @@ type User = {
comment_post_ratio: number;
comment_share: number;
avg_emotions?: Record<string, number>;
dominant_topic?: DominantTopic | null;
vocab?: Vocab | null;
};
@@ -162,6 +168,10 @@ type StanceMarkers = {
certainty_per_1k_tokens: number;
deontic_per_1k_tokens: number;
permission_per_1k_tokens: number;
hedge_emotion_avg?: Record<string, number>;
certainty_emotion_avg?: Record<string, number>;
deontic_emotion_avg?: Record<string, number>;
permission_emotion_avg?: Record<string, number>;
};
type EntityEmotionAggregate = {
@@ -202,6 +212,7 @@ type FilterResponse = {
export type {
TopUser,
DominantTopic,
Vocab,
User,
InteractionGraph,