fix: shorts duration parsing, playlist dates (no), number_nd_tokens (is)

This commit is contained in:
ThetaDev 2023-05-11 17:40:53 +02:00
parent b862d2d1f9
commit ef1cdbc91a
19 changed files with 302 additions and 230 deletions

View file

@ -2827,11 +2827,12 @@ pub(crate) fn entry(lang: Language) -> Entry {
],
},
number_nd_tokens: ::phf::Map {
key: 10121458955350035957,
key: 7485420634051515786,
disps: &[
(1, 0),
(2, 0),
],
entries: &[
("eitt", 1),
("ekkert", 0),
("einn", 1),
],
@ -4613,23 +4614,25 @@ pub(crate) fn entry(lang: Language) -> Entry {
months: ::phf::Map {
key: 15467950696543387533,
disps: &[
(0, 6),
(9, 10),
(4, 10),
(9, 6),
(0, 0),
],
entries: &[
("aug.", 8),
("jan.", 1),
("des.", 12),
("okt.", 10),
("mar.", 3),
("jun.", 6),
("jul.", 7),
("feb.", 2),
("juli", 7),
("nov.", 11),
("des.", 12),
("apr.", 4),
("mai", 5),
("nov.", 11),
("okt.", 10),
("juni", 6),
("feb.", 2),
("sep.", 9),
("aug.", 8),
("jan.", 1),
("jun.", 6),
("jul.", 7),
],
},
timeago_nd_tokens: ::phf::Map {

View file

@ -350,7 +350,7 @@ fn split_duration_txt(txt: &str, start_c: bool) -> Vec<DurationTxtSegment> {
let mut state: u8 = 0;
let mut seg = DurationTxtSegment::default();
for c in txt.chars() {
for c in txt.trim().chars() {
if c.is_ascii_digit() {
if state == 2 && (!seg.digits.is_empty() || (!start_c && segments.is_empty())) {
segments.push(seg);
@ -363,7 +363,7 @@ fn split_duration_txt(txt: &str, start_c: bool) -> Vec<DurationTxtSegment> {
segments.push(seg);
seg = DurationTxtSegment::default();
}
if c != ',' {
if !matches!(c, '.' | ',') {
c.to_lowercase().for_each(|c| seg.word.push(c));
}
state = 2;