【问题标题】:Using a collating sequence specified in an LDML file for doing a line sort使用 LDML 文件中指定的整理顺序进行行排序
【发布时间】:2021-12-04 12:35:27
【问题描述】:

我有一个 LDML 文件,它为 /usr/share/locale 中未列出的语言指定了整理顺序。

我想使用 LDML 文件中的整理顺序在 Linux 中进行行排序。

我首选的工具是 bash 排序命令

如果我了解如何使用 LDML 文件中的信息进行设置,我也可以使用 Perl Unicode::ICU::Collator

【问题讨论】:

  • 我认为 GNU 排序除了语言环境之外不会做任何事情。 Unicode::ICU::Collat​​or 只支持ucol_open,不支持ucol_openRules(即它只能访问ICU的内置排序规则)但是如果你sent a feature requestTonyC可能会帮助你:)
  • 您是否需要对大量数据进行排序,或者只是将哪些数据放入内存中?
  • @Shawn,文件可以加载到内存中。

标签: sorting perl unicode icu


【解决方案1】:

使用 icu 库提供了一个 python(而不是 perl)解决方案,该库记录在:

https://github.com/silnrsi/collation

https://scriptsource.org/cms/scripts/page.php?item_id=entry_detail&uid=lcepuup9ga

示例代码位于:

https://github.com/WesPeacock/ldml-sort

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-20
    • 1970-01-01
    • 1970-01-01
    • 2016-10-14
    • 1970-01-01
    相关资源
    最近更新 更多