23 lines
867 B
TypeScript
23 lines
867 B
TypeScript
// 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)];
|