feat(tlk): cartoon/anime sections and alias-aware search
This commit is contained in:
1 parent
c2947bed32
commit
75880e5ac7
3 files changed
+134
-11
No files matched your search
@@ -0,0 +1,22 @@
|
||||
// Toloka release names often carry the original (romanized) title instead of the English one,
|
||||
// so "attack on titan" does not match "Shingeki no Kyojin (Season 1) ...". Keys are normalized
|
||||
// TMDB titles (lowercase, straight apostrophes folded to U+2019, no trailing year/period); values
|
||||
// are the queries to additionally run against Toloka.
|
||||
const ALIASES: Record<string, string> = {
|
||||
'attack on titan': 'shingeki no kyojin',
|
||||
'fire force': 'enen no shouboutai',
|
||||
'howl’s moving castle': 'ugoku shiro',
|
||||
'princess mononoke': 'mononoke hime',
|
||||
'spirited away': 'sen to chihiro',
|
||||
'your name': 'kimi no na wa'
|
||||
};
|
||||
|
||||
export const normalizeQuery = (query: string) =>
|
||||
query
|
||||
.toLowerCase()
|
||||
.replace(/'/g, '’')
|
||||
.replace(/\s\d{4}$/, '')
|
||||
.replace(/\.$/, '')
|
||||
.trim();
|
||||
|
||||
export const aliasFor = (query: string) => ALIASES[normalizeQuery(query)];
|
||||
Reference in new issue
Block a user