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

com.taotao.boot.pinyin.api.IPinyin Maven / Gradle / Ivy

The 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.api;

import java.util.List;

/** 拼音核心用户 api */
public interface IPinyin {

    /**
     * 获取指定字符串的拼音
     *
     * @param string 原始字符串
     * @param context 上下文
     * @return 转换后的结果
     */
    String toPinyin(final String string, final IPinyinContext context);

    /**
     * 返回所有拼音列表 (1)返回当前汉字的所有拼音列表 (2)如果不是汉字,返回其本身
     *
     * @param chinese 中文汉字
     * @param context 上下文
     * @return 返回所有拼音列表
     */
    List toPinyinList(final char chinese, final IPinyinContext context);

    /**
     * 是否为同音字
     *
     * @param chineseOne 中文一
     * @param chineseTwo 中文二
     * @param context 上下文
     * @return 是否相同
     */
    boolean hasSamePinyin(final char chineseOne, final char chineseTwo, final IPinyinContext context);

    /**
     * 获取拼音的音调编号 12345
     *
     * @param chinese 中文拼音
     * @param context 上下文
     * @return 结果
     */
    @Deprecated
    List toneNumList(final String chinese, final IPinyinContext context);

    /**
     * 获取拼音的音调编号 12345
     *
     * @param chinese 中文字符
     * @param context 上下文
     * @return 结果
     */
    @Deprecated
    List toneNumList(final char chinese, final IPinyinContext context);

    /**
     * 获取声母字符
     *
     * @param chinese 中文汉字
     * @param context 上下文
     * @return 结果
     */
    @Deprecated
    List shengMuList(final String chinese, final IPinyinContext context);

    /**
     * 获取韵母字符
     *
     * @param chinese 中文字符
     * @param context 上下文
     * @return 结果
     */
    @Deprecated
    List yunMuList(final String chinese, final IPinyinContext context);

    /**
     * 相同的拼音列表
     *
     * @param pinyin 拼音
     * @param sameToneNum 相同的声调
     * @param context 上下文
     * @return 结果
     */
    List samePinyinList(String pinyin, final boolean sameToneNum, final IPinyinContext context);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy