Przeglądaj źródła

语料库词典 kwic

natasha 1 rok temu
rodzic
commit
4e0c841fbe

BIN
src/assets/teacherdev/ylk-sort-down.png


BIN
src/assets/teacherdev/ylk-sort-no.png


BIN
src/assets/teacherdev/ylk-sort-up.png


+ 93 - 26
src/views/corpus/Result.vue

@@ -99,14 +99,14 @@
                   </span>
                 </div>
               </template>
-              <template v-if="patternIndex == 0">
+              <!-- <template v-if="patternIndex == 0">
                 <div class="lang_sort" @click="sortEvent">
                   长度
                   <img v-if="sort == 'down'" src="../../assets/teacherdev/ylk-sort-down.png" alt="" />
                   <img v-else-if="sort == 'up'" src="../../assets/teacherdev/ylk-sort-up.png" alt="" />
                   <img v-else src="../../assets/teacherdev/ylk-sort-no.png" alt="" />
                 </div>
-              </template>
+              </template> -->
               <div class="refresh" @click="handleRefresh">
                 <img src="../../assets/teacherdev/refresh.png" alt="" />
               </div>
@@ -118,9 +118,11 @@
                   style="margin-left: 24px"
                 >
                 </el-switch> -->
-                <el-switch v-model="shiyiShow" active-text="释义" active-color="#424242" style="margin-left: 16px">
+                <el-switch v-model="shiyiShow" active-text="释义" active-color="#424242" style="margin-left: 20px">
                 </el-switch>
               </template>
+              <el-switch v-model="fenciShow" active-text="分词" active-color="#424242" style="margin-left: 8px">
+              </el-switch>
             </div>
 
             <div class="size">
@@ -132,6 +134,12 @@
           <div class="main">
             <div class="list">
               <template v-if="patternIndex == 0">
+                <div class="lang_sort" :class="[sortType==='length'?'active':'']" @click="sortEvent('length')">
+                  按长度
+                  <img v-if="sort == 'down'&&sortType==='length'" src="../../assets/teacherdev/ylk-sort-up.png" alt="" />
+                  <img v-else-if="sort == 'up'&&sortType==='length'" src="../../assets/teacherdev/ylk-sort-down.png" alt="" />
+                  <img v-else src="../../assets/teacherdev/ylk-sort-no.png" alt="" />
+                </div>
                 <div v-for="(item, i) in ShowList" :key="i + 'sentence'" class="one">
                   <div class="top">
                     <!--
@@ -168,6 +176,20 @@
                 </div>
               </template>
               <template v-else>
+                <div style="display:flex">
+                    <div class="lang_sort" :class="[sortType==='zflength'?'active':'']" @click="sortEvent('zflength')">
+                    按字符
+                    <img v-if="sort == 'down'&&sortType==='zflength'" src="../../assets/teacherdev/ylk-sort-up.png" alt="" />
+                    <img v-else-if="sort == 'up'&&sortType==='zflength'" src="../../assets/teacherdev/ylk-sort-down.png" alt="" />
+                    <img v-else src="../../assets/teacherdev/ylk-sort-no.png" alt="" />
+                    </div>
+                    <div class="lang_sort" :class="[sortType==='pclength'?'active':'']" @click="sortEvent('pclength')">
+                    按频次
+                    <img v-if="sort == 'down'&&sortType==='pclength'" src="../../assets/teacherdev/ylk-sort-up.png" alt="" />
+                    <img v-else-if="sort == 'up'&&sortType==='pclength'" src="../../assets/teacherdev/ylk-sort-down.png" alt="" />
+                    <img v-else src="../../assets/teacherdev/ylk-sort-no.png" alt="" />
+                    </div>
+                </div>
                 <div v-for="(item, index) in ShowList" :key="'kwic' + index" class="kwic_one">
                   <div class="number">{{ item.number }}</div>
                   <el-tooltip effect="dark" placement="bottom">
@@ -185,7 +207,37 @@
                     }"
                   >
                     <div v-for="(txt, indexs) in item.resArr" :key="indexs">
-                      <span v-for="(txts, indexs) in txt" v-html="txts" :key="indexs"></span>
+                      <div :style="{'padding':fenciShow?'0 2px':'','display':'inline-block'}" v-for="(txts, indext) in txt" :key="indext">
+                        <!-- <span v-html="txts"></span> -->
+                        <template v-if="sortType==='pclength'&&(KWIC_sortIndex === 0 || KWIC_sortIndex === 2)">
+                            <template v-if="indexs===0&&KWIC_sortIndex === 0">
+                                <el-tooltip effect="dark" placement="bottom" style="display:inline">
+                                    <div slot="content">
+                                        {{item.adjoin_fc_frequency_list_left[indext]}}
+                                    </div>
+                                    <div class="">
+                                        <span v-html="txts"></span>
+                                    </div>
+                                </el-tooltip>
+                            </template>
+                            <template v-else-if="indexs===2&&KWIC_sortIndex === 2">
+                                <el-tooltip effect="dark" placement="bottom" style="display:inline">
+                                    <div slot="content">
+                                        {{item.adjoin_fc_frequency_list_right[indext]}}
+                                    </div>
+                                    <div class="">
+                                        <span v-html="txts"></span>
+                                    </div>
+                                </el-tooltip>
+                            </template>
+                            <template v-else>
+                                <span v-html="txts"></span>
+                            </template>
+                        </template>
+                        <template v-else>
+                            <span v-html="txts"></span>
+                        </template>
+                      </div>
                     </div>
                   </div>
                 </div>
@@ -282,6 +334,7 @@ export default {
       page: 1,
       pageSize: 30,
       shiyiShow: true,
+      fenciShow: true,
       pinyinShow: true,
       JFIndex: 0,
       hzData: [],
@@ -293,6 +346,7 @@ export default {
       rightTopIndex: 0,
       sizeIndex: 1,
       sort: '',
+      sortType: '',
       rightList: [],
       KWIC_sortIndex: 0,
       allNumber: 0,
@@ -324,7 +378,8 @@ export default {
       this.getdata();
     },
     // 排序
-    sortEvent() {
+    sortEvent(type) {
+      this.sortType = type
       if (this.sort == 'up' || !this.sort) {
         this.sort = 'down';
       } else {
@@ -538,8 +593,10 @@ export default {
     handleRefresh() {
       this.pinyinShow = true;
       this.shiyiShow = true;
+      this.fenciShow = true;
       this.sizeIndex = 1;
-      this.sort = 'down';
+      this.sort = '';
+      this.sortType = ''
       this.KWIC_sortIndex = 0;
       this.cutSize(1);
       this.getdata();
@@ -562,7 +619,7 @@ export default {
         sort_mode: this.sort ? (this.sort == 'down' ? 'DESCENT' : 'ASCENT') : 'NO',
         compare_mode: this.patternIndex === 0 ? 'LENGTH' : 'KWIC',
         kwic_arrange_type: this.KWIC_sortIndex === 0 ? 'LEFT' : this.KWIC_sortIndex === 1 ? 'MID' : 'RIGHT',
-        kwic_compare_by: 0
+        kwic_compare_by: this.sortType==='pclength'?1:0
       };
       BookgetContent(Mname, data)
         .then(res => {
@@ -636,6 +693,8 @@ export default {
             });
             let data = this.changefiveword(arr, item.sentence_fc_list_word_index, type);
             item.resArr = data;
+            item.adjoin_fc_frequency_list_left = item.adjoin_fc_frequency_list.splice(0,item.sentence_fc_list_word_index)
+            item.adjoin_fc_frequency_list_right = item.adjoin_fc_frequency_list.splice(item.sentence_fc_list_word_index)
           } else if (type == 'right') {
             let sentence = JSON.parse(JSON.stringify(item.sentence));
             let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
@@ -646,6 +705,8 @@ export default {
             });
             let data = this.changefiveword(arr, item.sentence_fc_list_word_index, type);
             item.resArr = data;
+            item.adjoin_fc_frequency_list_left = item.adjoin_fc_frequency_list.splice(0,item.sentence_fc_list_word_index)
+            item.adjoin_fc_frequency_list_right = item.adjoin_fc_frequency_list.splice(item.sentence_fc_list_word_index)
           } else if (type == 'mid') {
             let sentence = JSON.parse(JSON.stringify(item.sentence));
             let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
@@ -656,6 +717,8 @@ export default {
             });
             let data = this.changefiveword(arr, item.sentence_fc_list_word_index, type);
             item.resArr = data;
+            item.adjoin_fc_frequency_list_left = item.adjoin_fc_frequency_list.splice(0,item.sentence_fc_list_word_index)
+            item.adjoin_fc_frequency_list_right = item.adjoin_fc_frequency_list.splice(item.sentence_fc_list_word_index)
           } else {
             this.scoreAHitNumber += item.position_list.length;
             let newsentence = JSON.parse(JSON.stringify(item.sentence));
@@ -1025,24 +1088,6 @@ export default {
           }
         }
 
-        .lang_sort {
-          display: flex;
-          align-items: center;
-          justify-content: center;
-          width: 54px;
-          height: 28px;
-          margin-left: 24px;
-          cursor: pointer;
-          background: #eee;
-          border-radius: 4px;
-
-          img {
-            width: 16px;
-            height: 16px;
-            margin-left: 2px;
-          }
-        }
-
         .refresh {
           display: flex;
           align-items: center;
@@ -1080,7 +1125,29 @@ export default {
         // height: 95%;
         .list {
           margin-top: 16px;
-
+          
+          .lang_sort {
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            width: max-content;
+            cursor: pointer;
+            margin: 0 0 16px 16px;
+            border-radius: 20px;
+            border: 1px solid #E5E6EB;
+            padding: 4px 12px;
+            font-size: 14px;
+            &.active{
+                border-color: #4992FF;
+                background: #4992FF;
+                color: #fff;
+            }
+            img {
+                width: 16px;
+                height: 16px;
+                margin-left: 2px;
+            }
+          }
           .one {
             padding: 0 16px;
             margin-bottom: 8px;