package org.diagbot.push.controller;

import org.diagbot.nlp.participle.ParticipleUtil;
import org.diagbot.pub.api.Response;
import org.diagbot.pub.web.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;

@Controller
@RequestMapping("/participle")
public class ParticipleController extends BaseController {
    {
        listView = "/pages/participle/sample.html";
    }
    @RequestMapping({"/index"})
    public String index() {
        return listView;
    }

    @ResponseBody
    @RequestMapping("/split_pacs")
    public Response split(String content) throws IOException {
        Response response = new Response();
        long start = System.currentTimeMillis();
        response.setData(ParticipleUtil.participlePacs(content));
        long end = System.currentTimeMillis();
        System.out.println("总耗时:........." + (end - start));
        return response;
    }

    @ResponseBody
    @RequestMapping("/split_and_highlight")
    public Response splitAndHighlight(String content) throws IOException {
        Response response = new Response();
        long start = System.currentTimeMillis();
        response.setData(ParticipleUtil.participleAndHighlight(content));
        long end = System.currentTimeMillis();
        System.out.println("总耗时:........." + (end - start));
        return response;
    }
}
