All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.taotao.boot.pinyin.support.segment.CharPinyinSegment Maven / Gradle / Ivy

There is a newer version: 2025.01
Show newest version
/*
 * Copyright (c) 2020-2030, Shuigedeng ([email protected] & https://blog.taotaocloud.top/).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.taotao.boot.pinyin.support.segment;

import com.taotao.boot.common.support.handler.IHandler;
import com.taotao.boot.common.utils.collection.ArrayPrimitiveUtils;
import com.taotao.boot.pinyin.spi.IPinyinSegment;

import java.util.List;

/**
 * 直接基于字符切分 (1)不具有分词准确性 (2)性能较好
 *
 * 

TODO: 后期替换为分词框架 * *

分词应该保持中立,因为涉及到繁简体转换。 */ public class CharPinyinSegment implements IPinyinSegment { @Override public List segment(String string) { char[] chars = string.toCharArray(); return ArrayPrimitiveUtils.toList(chars, new IHandler() { @Override public String handle(Character character) { return String.valueOf(character); } }); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy