ToOrdinal builds compound ordinals with cardinal tens, as in English
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 73/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- rust, yaml
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Read hundreds_to_words in src/xpath_functions.rs and the definitions in Rules/Languages/es/definitions.yaml. Check how ToOrdinal selects words for compound numbers, then add the OrdinalCompound behavior described in the issue while preserving the default English output. Done when Spanish compound ordinals use ordinal words for each part and the existing English behavior remains unchanged; the issue does not name a test file.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
ToOrdinal builds 21–99 as cardinal + ordinal, which is right for English ("twenty first") but not for Spanish, where every part is an ordinal:
| n | Spanish today | expected |
|---|---|---|
| 21 | veinte primero | vigésimo primero |
| 45 | cuarenta quinto | cuadragésimo quinto |
| 99 | noventa noveno | nonagésimo noveno |
The cardinal words come from NumbersTens and NumbersHundreds in hundreds_to_words (src/xpath_functions.rs); the Spanish ordinal lists themselves are fine now (fixed in the es-ordinals PR).
Proposed patch: a new definition, OrdinalCompound: ["ordinal"], that a language can set so hundreds_to_words uses the ordinal lists for every part. Languages that don't set it keep today's behavior, so English doesn't change.
- let mut hundreds = definitions.get_vec("NumbersHundreds")?[number[0]].clone();
+ // in some languages (e.g., Spanish) every part of a compound ordinal is an ordinal ("vigésimo primero"),
+ // not a cardinal followed by an ordinal ("twenty first")
+ let all_ordinal = definitions.get_vec("OrdinalCompound")
+ .is_some_and(|v| v.first().is_some_and(|s| s == "ordinal"));
+ let mut hundreds = if all_ordinal {
+ words[0][number[0]].clone()
+ } else {
+ definitions.get_vec("NumbersHundreds")?[number[0]].clone()
+ };
@@
- return Some(hundreds + &definitions.get_vec("NumbersTens")?[number[1]] + " " + &words[2][number[2]]);
+ let tens = if all_ordinal {
+ words[1][number[1]].clone()
+ } else {
+ definitions.get_vec("NumbersTens")?[number[1]].clone()
+ };
+ return Some(hundreds + &tens + " " + &words[2][number[2]]);
and in Rules/Languages/es/definitions.yaml:
- OrdinalCompound: ["ordinal"]
Spanish doesn't call ToOrdinal for this today: the es-ordinals PR #999 uses two small maps of its own, because of this problem. With the fix, that rule could use ToOrdinal and drop them (the feminine "primera" and the apocope "primer" are built in the rule from the masculine word).
- Ngôn ngữ chính
- Rust
- Star
- 131
- Fork
- 97
- Merge trung bình
- 21 giờ 45 phút
- Pull request đã merge (30 ngày)
- 95
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của daisy/MathCAT
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của daisy/MathCAT
Issue tương tự
-
area:schema documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ElectronicWave/Elemental#252 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dekobon/big-code-analysis#1887 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Shell中文符号输入异常Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày