|
|
|
@ -95,6 +95,17 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
return AjaxResult.success(docInfoService.selectDocInfoById(id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量标注
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping(value = "/uploadPosTagIds")
|
|
|
|
|
public AjaxResult uploadPosTag(@RequestBody List<String> idList) throws IOException {
|
|
|
|
|
for (int i = 0; i < idList.size(); i++) {
|
|
|
|
|
getInfoDelHtml(idList.get(i));
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取文章管理详细信息 去掉内容标签
|
|
|
|
|
*/
|
|
|
|
@ -110,6 +121,7 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
content = MyObjects.delHTMLTag(content);
|
|
|
|
|
content = MyObjects.delSpace(content);
|
|
|
|
|
JSONArray labels = new JSONArray();
|
|
|
|
|
result.put("docInfoId",docInfoId);
|
|
|
|
|
result.put("content", content);
|
|
|
|
|
result.put("connections", new JSONArray());
|
|
|
|
|
result.put("connectionCategories", MyObjects.connectionCategories);
|
|
|
|
@ -170,6 +182,12 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
map.put("adjective",adjective);
|
|
|
|
|
map.put("adverb",adverb);
|
|
|
|
|
result.put("partData",map);
|
|
|
|
|
|
|
|
|
|
//点击词性标注后直接上传 并修改状态
|
|
|
|
|
Query query = new Query(Criteria.where("_id").is(docInfoId));
|
|
|
|
|
Update update = new Update();
|
|
|
|
|
update.set("posTagStatus", "已标注");
|
|
|
|
|
mongoTemplate.upsert(query, update, DocInfo.class);
|
|
|
|
|
return AjaxResult.success("查询成功",result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -212,9 +230,9 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@PostMapping("/uploadPosTag")
|
|
|
|
|
public AjaxResult uploadPosTag(@RequestBody JSONObject jsonObject) throws IOException {
|
|
|
|
|
System.out.println(jsonObject);
|
|
|
|
|
String content = jsonObject.getString("content");
|
|
|
|
|
JSONArray labels = jsonObject.getJSONArray("labels");
|
|
|
|
|
String docInfoId = jsonObject.getString("docInfoId");
|
|
|
|
|
List<IWord> wordList = new ArrayList<>();
|
|
|
|
|
if(labels!=null&&labels.size()>0){
|
|
|
|
|
for(int i=0;i<labels.size();i++){
|
|
|
|
@ -223,7 +241,6 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
Integer startIndex = labelJSONObject.getInteger("startIndex");
|
|
|
|
|
Integer endIndex = labelJSONObject.getInteger("endIndex");
|
|
|
|
|
Integer categoryId = labelJSONObject.getInteger("categoryId");
|
|
|
|
|
|
|
|
|
|
String value = content.substring(startIndex,endIndex);
|
|
|
|
|
String label = MyObjects.wordsMappingIndex.get(categoryId);
|
|
|
|
|
word.setLabel(label);
|
|
|
|
@ -233,7 +250,11 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
Sentence sentence = new Sentence(wordList);
|
|
|
|
|
DependencyParserUtils.learn(sentence);
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
Query query = new Query(Criteria.where("_id").is(docInfoId));
|
|
|
|
|
Update update = new Update();
|
|
|
|
|
update.set("posTagStatus", "已标注");
|
|
|
|
|
mongoTemplate.upsert(query, update, DocInfo.class);
|
|
|
|
|
return AjaxResult.success("标注上传成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -309,8 +330,16 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
// docInfoService.insertEs(docInfo);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@PostMapping("/splitWordIds")
|
|
|
|
|
public AjaxResult splitWordIds(@RequestBody List<DocInfo> docInfoList){
|
|
|
|
|
for (int i = 0; i < docInfoList.size(); i++) {
|
|
|
|
|
splitWordDocInfo(docInfoList.get(i));
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.success("批量分词成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping ("/splitWordStr")
|
|
|
|
|
public AjaxResult splitWord(@RequestBody String str){
|
|
|
|
|
public AjaxResult splitWordStr(@RequestBody String str){
|
|
|
|
|
Segment segment= HanLP.newSegment();
|
|
|
|
|
List<Term> termList = segment.seg(str);
|
|
|
|
|
List<String> wordList=new ArrayList<>();
|
|
|
|
@ -322,8 +351,8 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping ("/splitWordDocInfo")
|
|
|
|
|
public AjaxResult splitWordNew(@RequestBody DocInfo docInfo){
|
|
|
|
|
String title = docInfo.getTitle();
|
|
|
|
|
public AjaxResult splitWordDocInfo(@RequestBody DocInfo docInfo){
|
|
|
|
|
String title = docInfo.getContent();
|
|
|
|
|
Segment segment= HanLP.newSegment();
|
|
|
|
|
List<Term> termList = segment.seg(title);
|
|
|
|
|
List<String> wordList=new ArrayList<>();
|
|
|
|
@ -333,6 +362,16 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
wordList.add(word);
|
|
|
|
|
}
|
|
|
|
|
docInfo.setAnalyzeTitle(wordList);
|
|
|
|
|
List<String> analyzeTitleList = docInfo.getAnalyzeTitle();
|
|
|
|
|
for (int i = 0; i < analyzeTitleList.size(); i++) {
|
|
|
|
|
if(StringUtils.isNotBlank(analyzeTitleList.get(i))){
|
|
|
|
|
CustomDictionary.add(analyzeTitleList.get(i));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Query query = new Query(Criteria.where("_id").is(docInfo.getId()));
|
|
|
|
|
Update update = new Update();
|
|
|
|
|
update.set("splitWordStatus", "已分词");
|
|
|
|
|
mongoTemplate.upsert(query, update, DocInfo.class);
|
|
|
|
|
return AjaxResult.success("分词成功",docInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -343,7 +382,7 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/uploadSplitWordStr")
|
|
|
|
|
public AjaxResult uploadSplitWordNew(@RequestBody String splitResult) {
|
|
|
|
|
public AjaxResult uploadSplitWordStr(@RequestBody String splitResult) {
|
|
|
|
|
try {
|
|
|
|
|
String[] split = splitResult.split("/");
|
|
|
|
|
for (int i = 0; i < split.length; i++) {
|
|
|
|
@ -358,7 +397,7 @@ public class DocInfoController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/uploadSplitWordDocInfo")
|
|
|
|
|
public AjaxResult uploadSplitWordNew(@RequestBody DocInfo docInfo) {
|
|
|
|
|
public AjaxResult uploadSplitWordDocInfo(@RequestBody DocInfo docInfo) {
|
|
|
|
|
try {
|
|
|
|
|
List<String> analyzeTitleList = docInfo.getAnalyzeTitle();
|
|
|
|
|
for (int i = 0; i < analyzeTitleList.size(); i++) {
|
|
|
|
|