From c3f82f765bf1e957e8efad10acd0d050f4f0cf17 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Sun, 7 May 2023 19:29:19 +0200 Subject: [PATCH] fix: add "1 video" tokens to dict --- src/client/music_search.rs | 2 +- src/util/dictionary.rs | 8 ++++++-- testfiles/dict/dictionary.json | 10 +++++++--- testfiles/dict/dictionary_override.json | 12 ++++++++++-- tests/youtube.rs | 3 ++- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/client/music_search.rs b/src/client/music_search.rs index be55c12..bddaf11 100644 --- a/src/client/music_search.rs +++ b/src/client/music_search.rs @@ -407,7 +407,7 @@ mod tests { #[case::default("default")] #[case::typo("typo")] #[case::radio("radio")] - #[case::radio("artist")] + #[case::artist("artist")] fn map_music_search_main(#[case] name: &str) { let json_path = path!(*TESTFILES / "music_search" / format!("main_{name}.json")); let json_file = File::open(json_path).unwrap(); diff --git a/src/util/dictionary.rs b/src/util/dictionary.rs index 7d2d2b3..e0049a8 100644 --- a/src/util/dictionary.rs +++ b/src/util/dictionary.rs @@ -393,13 +393,14 @@ pub(crate) fn entry(lang: Language) -> Entry { ], }, number_nd_tokens: ::phf::Map { - key: 15467950696543387533, + key: 12913932095322966823, disps: &[ (0, 0), ], entries: &[ - ("ন\u{9be}ই", 0), ("১", 1), + ("ন\u{9be}ই", 0), + ("১ট\u{9be}", 1), ], }, album_types: ::phf::Map { @@ -4659,6 +4660,7 @@ pub(crate) fn entry(lang: Language) -> Entry { ], entries: &[ ("ingen", 0), + ("én", 1), ], }, album_types: ::phf::Map { @@ -5032,8 +5034,10 @@ pub(crate) fn entry(lang: Language) -> Entry { number_nd_tokens: ::phf::Map { key: 12913932095322966823, disps: &[ + (0, 0), ], entries: &[ + ("um", 1), ], }, album_types: ::phf::Map { diff --git a/testfiles/dict/dictionary.json b/testfiles/dict/dictionary.json index 8487db5..1f62381 100644 --- a/testfiles/dict/dictionary.json +++ b/testfiles/dict/dictionary.json @@ -201,7 +201,8 @@ }, "number_nd_tokens": { "নাই": 0, - "১": 1 + "১": 1, + "১টা": 1 }, "album_types": { "ep": "Ep", @@ -2662,7 +2663,8 @@ "mrd": 9 }, "number_nd_tokens": { - "ingen": 0 + "ingen": 0, + "én": 1 }, "album_types": { "album": "Album", @@ -2885,7 +2887,9 @@ "mi": 6, "mil": 3 }, - "number_nd_tokens": {}, + "number_nd_tokens": { + "um": 1 + }, "album_types": { "audiolivro": "Audiobook", "ep": "Ep", diff --git a/testfiles/dict/dictionary_override.json b/testfiles/dict/dictionary_override.json index e162a96..bc02b05 100644 --- a/testfiles/dict/dictionary_override.json +++ b/testfiles/dict/dictionary_override.json @@ -16,7 +16,9 @@ "শঃ": null }, "number_nd_tokens": { - "কোনো": null + "কোনো": null, + "ভিডিঅ’": null, + "১টা": 1 } }, "bn": { @@ -111,7 +113,8 @@ }, "no": { "number_nd_tokens": { - "avspillinger": null + "avspillinger": null, + "én": 1 } }, "or": { @@ -129,6 +132,11 @@ "ਨੇ": null } }, + "pt": { + "number_nd_tokens": { + "um": 1 + } + }, "ro": { "number_nd_tokens": { "abonat": null, diff --git a/tests/youtube.rs b/tests/youtube.rs index 1d5abe5..706c257 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -1108,7 +1108,8 @@ fn search_empty(rp: RustyPipe) { fn search_suggestion(rp: RustyPipe) { let result = tokio_test::block_on(rp.query().search_suggestion("hunger ga")).unwrap(); - assert!(result.contains(&"hunger games".to_owned())); + assert!(result.iter().any(|s| s.starts_with("hunger games "))); + assert_gte(result.len(), 10, "search suggestions"); } #[rstest]