mirror of
https://github.com/geekwenjie/SmartJavaAI.git
synced 2026-09-20 09:39:18 +00:00
新增翻译模块:支持200多语言翻译
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package cn.smartjavaai.translation.enums;
|
||||
/**
|
||||
* 机器翻译模型枚举
|
||||
* @author lwx
|
||||
* @date 2025/6/05
|
||||
*/
|
||||
public enum TranslationModeEnum {
|
||||
|
||||
NLLB_MODEL;
|
||||
|
||||
/**
|
||||
* 根据名称获取枚举 (忽略大小写和下划线变体)
|
||||
*/
|
||||
public static TranslationModeEnum fromName(String name) {
|
||||
String formatted = name.trim().toUpperCase().replaceAll("[-_]", "");
|
||||
for (TranslationModeEnum model : values()) {
|
||||
if (model.name().replaceAll("_", "").equals(formatted)) {
|
||||
return model;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("未知模型名称: " + name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user