|
@@ -79,6 +79,9 @@
|
|
|
show-word-limit
|
|
|
></el-input>
|
|
|
<div class="NPC-gPinyin">
|
|
|
+ <el-button type="danger" size="small" @click="_sureSegWord"
|
|
|
+ >确定分词结果</el-button
|
|
|
+ >
|
|
|
<el-button type="danger" size="small" @click="_createPinyin"
|
|
|
>确定生成拼音</el-button
|
|
|
>
|
|
@@ -94,6 +97,15 @@
|
|
|
style="width: 400px"
|
|
|
>
|
|
|
<el-table-column prop="chs" label="词" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.chs"
|
|
|
+ placeholder="请输入内容"
|
|
|
+ @blur="onBlur(scope.row, 'chs')"
|
|
|
+ maxlength="200"
|
|
|
+ show-word-limit
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="拼音" width="220">
|
|
|
<template slot-scope="scope">
|
|
@@ -237,6 +249,44 @@ export default {
|
|
|
var RegExp = /^[a-zA-Z]+$/;
|
|
|
return RegExp.test(str);
|
|
|
},
|
|
|
+ //确定分词结果
|
|
|
+ _sureSegWord() {
|
|
|
+ let sentIndex = this.sentIndex;
|
|
|
+ let sent_arr = this.paraCon.seg_words[sentIndex].sent_str.split(/\s+/);
|
|
|
+ let res_str = "";
|
|
|
+ sent_arr.forEach((item) => {
|
|
|
+ if (item) {
|
|
|
+ let bool = this.checkEn(item);
|
|
|
+ // if (bool) {
|
|
|
+ // res_str += item.trim() + " ";
|
|
|
+ // } else
|
|
|
+ if (item == "(") {
|
|
|
+ res_str += " " + item.trim() + " ";
|
|
|
+ } else if (item == ")") {
|
|
|
+ res_str += " " + item.trim() + " ";
|
|
|
+ } else {
|
|
|
+ res_str += item.trim();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ res_str = res_str.replace(/\s+/g, " ");
|
|
|
+ let org_sent = this.paraCon.sentences[sentIndex];
|
|
|
+ if (res_str.trim() != org_sent.trim()) {
|
|
|
+ this.$message.warning("跟原句不一致,请检查是否误删除或新增其他内容");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let arr = this.paraCon.seg_words[sentIndex].sent_str.split(/\s+/);
|
|
|
+ this.$set(this.paraCon.segList, sentIndex, arr);
|
|
|
+ let wordsList = [];
|
|
|
+ arr.forEach((sItem) => {
|
|
|
+ let obj = {
|
|
|
+ chs: sItem,
|
|
|
+ pinyin: "",
|
|
|
+ };
|
|
|
+ wordsList.push(obj);
|
|
|
+ });
|
|
|
+ this.$set(this.paraCon.wordsList, sentIndex, wordsList);
|
|
|
+ },
|
|
|
//生成拼音
|
|
|
_createPinyin() {
|
|
|
let sentIndex = this.sentIndex;
|
|
@@ -245,9 +295,10 @@ export default {
|
|
|
sent_arr.forEach((item) => {
|
|
|
if (item) {
|
|
|
let bool = this.checkEn(item);
|
|
|
- if (bool) {
|
|
|
- res_str += item.trim() + " ";
|
|
|
- } else if (item == "(") {
|
|
|
+ // if (bool) {
|
|
|
+ // res_str += item.trim() + " ";
|
|
|
+ // } else
|
|
|
+ if (item == "(") {
|
|
|
res_str += " " + item.trim() + " ";
|
|
|
} else if (item == ")") {
|
|
|
res_str += " " + item.trim() + " ";
|
|
@@ -332,8 +383,6 @@ export default {
|
|
|
created() {},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {
|
|
|
- console.log("====分词结果====");
|
|
|
- console.log(this.curQue.detail);
|
|
|
this.getParaSegWordsResult();
|
|
|
},
|
|
|
beforeCreate() {}, //生命周期 - 创建之前
|