Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化模组翻译匹配 #3231

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

zkitefly
Copy link
Member

@zkitefly zkitefly commented Aug 12, 2024

image

image

image

image

image

image

image

image

image

原理是更换成本地模组 name 和 mod_data.txt 的 subname 进行配对,因为这俩很多模组都是匹配的

顺便搞定了没有中文就不显示的情况

@zkitefly zkitefly marked this pull request as ready for review August 12, 2024 16:47
@zkitefly zkitefly requested review from Glavo and burningtnt August 12, 2024 16:47
解决特殊情况:`EntityCulling`与`Entity Culling `
@zkitefly

This comment was marked as outdated.

Copy link
Member

@burningtnt burningtnt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要做模糊匹配

@zkitefly zkitefly mentioned this pull request Dec 28, 2024
@zkitefly zkitefly marked this pull request as draft January 8, 2025 01:45
@zkitefly zkitefly requested a review from yushijinhun January 8, 2025 17:43
@zkitefly zkitefly marked this pull request as ready for review January 8, 2025 17:43

return modIdMap.get(id);
String filteredName = name.replaceAll("[^a-zA-Z0-9]", "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以解释下这行代码吗?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

去掉除英文字母和数字的字符进行匹配,modSubnameMap 中的内容也是过滤后的内容

@yushijinhun
Copy link
Member

我觉得用 subname 匹配不是个好主意。mod_data.txt 的 13825 个条目中,有 7769 个条目都没有 subname。

分析 mod_data.txt 可以发现:

  • 总共条目数为 13825。
  • 1167 个条目没有 modid。如果使用 modid 分类,有 1307 个冲突。
  • 7769 个条目没有 subname。如果使用 subname 分类,有 68 个冲突。
  • 662 条目既没有 modid 又没有 subname。如果先使用 modid 分类,再使用 subname 分类,有 403 个冲突。

因此,比较好的匹配方法可能是 同时匹配 modid 和 subname

Comment on lines +91 to +100
if (StringUtils.isNotBlank(subname)) {
String filteredSubName = "subname-" + subname.replaceAll("[^a-zA-Z]", "");
return modMap.get(filteredSubName);
}

if (StringUtils.isNotBlank(id)) {
return modMap.get(id);
}

return null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yushijinhun 已改成优先使用 subname 匹配,如果没有 subname 则使用 id 进行匹配

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants