package com.docus.server.service;

import com.docus.server.controller.KeyWordStrategy;
import com.docus.server.controller.SegmentResult;

import java.util.ArrayList;
import java.util.List;

public class Service {

    private List<KeyWordStrategy> keyWordStrategyHashMap;

    public void init() {
        //读取配置。并将初始化整个分段信息。
        keyWordStrategyHashMap = new ArrayList<>();

    }


    /**
     * 有找到则有，没有则为空
     *
     * @param keyword
     * @return
     */
    public SegmentResult find(String keyword) {
        for (KeyWordStrategy keyWordStrategy : keyWordStrategyHashMap) {
            return keyWordStrategy.isContain(keyword);
        }
        return null;
    }

}
