feat: 优化词云

This commit is contained in:
digua
2026-02-01 20:26:12 +08:00
parent 7a2a512ab4
commit b77db9497b
4 changed files with 15 additions and 42 deletions
+4 -4
View File
@@ -46,11 +46,11 @@ export const POS_TAG_DEFINITIONS: PosTagInfo[] = [
{ tag: 'nt', name: '机构名', description: '机构团体名', meaningful: true }, { tag: 'nt', name: '机构名', description: '机构团体名', meaningful: true },
{ tag: 'nz', name: '其他专名', description: '其他专有名词', meaningful: true }, { tag: 'nz', name: '其他专名', description: '其他专有名词', meaningful: true },
{ tag: 'nw', name: '作品名', description: '作品名', meaningful: true }, { tag: 'nw', name: '作品名', description: '作品名', meaningful: true },
// 动词类 // 动词类(普通动词通常不太有意义,如"是""有""说"等)
{ tag: 'v', name: '动词', description: '普通动词', meaningful: true }, { tag: 'v', name: '动词', description: '普通动词', meaningful: false },
{ tag: 'vn', name: '动名词', description: '动名词', meaningful: true }, { tag: 'vn', name: '动名词', description: '动名词', meaningful: true },
{ tag: 'vd', name: '副动词', description: '副动词', meaningful: true }, { tag: 'vd', name: '副动词', description: '副动词', meaningful: false },
{ tag: 'vg', name: '动语素', description: '动词性语素', meaningful: true }, { tag: 'vg', name: '动语素', description: '动词性语素', meaningful: false },
// 形容词类 // 形容词类
{ tag: 'a', name: '形容词', description: '普通形容词', meaningful: true }, { tag: 'a', name: '形容词', description: '普通形容词', meaningful: true },
{ tag: 'an', name: '名形词', description: '名形词', meaningful: true }, { tag: 'an', name: '名形词', description: '名形词', meaningful: true },
@@ -41,14 +41,14 @@ const stats = ref({
uniqueWords: 0, uniqueWords: 0,
}) })
// 颜色方案 // 颜色方案(固定为默认)
const colorScheme = ref<'default' | 'warm' | 'cool' | 'rainbow'>('default') const colorScheme = 'default' as const
// 字体大小倍率 // 字体大小倍率(默认大)
const sizeScale = ref(1) const sizeScale = ref(1.25)
// 最大显示词数 // 最大显示词数(默认 150
const maxWords = ref(100) const maxWords = ref(150)
// 词性过滤模式 // 词性过滤模式
const posFilterMode = ref<PosFilterMode>('meaningful') const posFilterMode = ref<PosFilterMode>('meaningful')
@@ -78,13 +78,6 @@ const posFilterModeOptions = computed(() => [
{ label: t('posFilter.custom'), value: 'custom' }, { label: t('posFilter.custom'), value: 'custom' },
]) ])
// 配色方案选项
const colorSchemeOptions = computed(() => [
{ label: t('colors.default'), value: 'default' },
{ label: t('colors.warm'), value: 'warm' },
{ label: t('colors.cool'), value: 'cool' },
{ label: t('colors.rainbow'), value: 'rainbow' },
])
// 词数选项 // 词数选项
const maxWordsOptions = [ const maxWordsOptions = [
@@ -297,12 +290,6 @@ onMounted(() => {
<UITabs v-model="maxWords" size="xs" :items="maxWordsOptions" /> <UITabs v-model="maxWords" size="xs" :items="maxWordsOptions" />
</div> </div>
<!-- 配色方案 -->
<div>
<h4 class="mb-2 text-xs font-medium text-gray-600 dark:text-gray-400">{{ t('config.colorScheme') }}</h4>
<UITabs v-model="colorScheme" size="xs" :items="colorSchemeOptions" />
</div>
<!-- 字体大小 --> <!-- 字体大小 -->
<div> <div>
<h4 class="mb-2 text-xs font-medium text-gray-600 dark:text-gray-400">{{ t('config.sizeScale') }}</h4> <h4 class="mb-2 text-xs font-medium text-gray-600 dark:text-gray-400">{{ t('config.sizeScale') }}</h4>
@@ -395,7 +382,6 @@ onMounted(() => {
"uniqueLabel": "独立词" "uniqueLabel": "独立词"
}, },
"config": { "config": {
"colorScheme": "配色方案",
"maxWords": "显示词数", "maxWords": "显示词数",
"sizeScale": "字体大小", "sizeScale": "字体大小",
"userFilter": "用户筛选", "userFilter": "用户筛选",
@@ -417,12 +403,6 @@ onMounted(() => {
"selectAll": "全选", "selectAll": "全选",
"clearAll": "清空" "clearAll": "清空"
}, },
"colors": {
"default": "默认",
"warm": "暖色",
"cool": "冷色",
"rainbow": "彩虹"
},
"empty": { "empty": {
"title": "暂无词云数据", "title": "暂无词云数据",
"description": "当前筛选条件下没有足够的文本消息用于生成词云" "description": "当前筛选条件下没有足够的文本消息用于生成词云"
@@ -440,7 +420,6 @@ onMounted(() => {
"uniqueLabel": "Unique" "uniqueLabel": "Unique"
}, },
"config": { "config": {
"colorScheme": "Color scheme",
"maxWords": "Max words", "maxWords": "Max words",
"sizeScale": "Font size", "sizeScale": "Font size",
"userFilter": "User filter", "userFilter": "User filter",
@@ -462,12 +441,6 @@ onMounted(() => {
"selectAll": "All", "selectAll": "All",
"clearAll": "Clear" "clearAll": "Clear"
}, },
"colors": {
"default": "Default",
"warm": "Warm",
"cool": "Cool",
"rainbow": "Rainbow"
},
"empty": { "empty": {
"title": "No word cloud data", "title": "No word cloud data",
"description": "Not enough text messages to generate a word cloud with current filters" "description": "Not enough text messages to generate a word cloud with current filters"
@@ -18,13 +18,13 @@ const props = defineProps<{
// 子 Tab 配置 // 子 Tab 配置
const subTabs = computed(() => [ const subTabs = computed(() => [
{ id: 'wordcloud', label: t('wordcloud'), icon: 'i-heroicons-cloud' },
{ id: 'hot-repeat', label: t('hotRepeat'), icon: 'i-heroicons-fire' }, { id: 'hot-repeat', label: t('hotRepeat'), icon: 'i-heroicons-fire' },
{ id: 'catchphrase', label: t('catchphrase'), icon: 'i-heroicons-chat-bubble-bottom-center-text' }, { id: 'catchphrase', label: t('catchphrase'), icon: 'i-heroicons-chat-bubble-bottom-center-text' },
{ id: 'wordcloud', label: t('wordcloud'), icon: 'i-heroicons-cloud' },
{ id: 'keyword', label: t('keywordAnalysis'), icon: 'i-heroicons-magnifying-glass' }, { id: 'keyword', label: t('keywordAnalysis'), icon: 'i-heroicons-magnifying-glass' },
]) ])
const activeSubTab = ref('hot-repeat') const activeSubTab = ref('wordcloud')
</script> </script>
<template> <template>
@@ -16,14 +16,14 @@ const props = defineProps<{
timeFilter?: TimeFilter timeFilter?: TimeFilter
}>() }>()
// 子 Tab 配置(私聊:口头禅、词云、关键词分析) // 子 Tab 配置(私聊:词云、口头禅、关键词分析)
const subTabs = computed(() => [ const subTabs = computed(() => [
{ id: 'catchphrase', label: t('catchphrase'), icon: 'i-heroicons-chat-bubble-bottom-center-text' },
{ id: 'wordcloud', label: t('wordcloud'), icon: 'i-heroicons-cloud' }, { id: 'wordcloud', label: t('wordcloud'), icon: 'i-heroicons-cloud' },
{ id: 'catchphrase', label: t('catchphrase'), icon: 'i-heroicons-chat-bubble-bottom-center-text' },
{ id: 'keyword', label: t('keywordAnalysis'), icon: 'i-heroicons-magnifying-glass' }, { id: 'keyword', label: t('keywordAnalysis'), icon: 'i-heroicons-magnifying-glass' },
]) ])
const activeSubTab = ref('catchphrase') const activeSubTab = ref('wordcloud')
</script> </script>
<template> <template>