I have the title and I want to see if it's a Director's Cut title. I'm doing that in the following way:
VERSIONS = {
"DIRECTOR'S CUT": ["director's cut", "directors cut", "director’s cut", "versão do diretor", "director's edition", "montaje del director", "director corte",
"version du réalisateur", "directors' cut", "director edition", "dictator's cut", "ディレクターズカット", "director´s cut", "Режиссерская версия", "감독판"],
}
title = title.lower()
is_director = False
for term in VERSIONS["DIRECTOR'S CUT"]:
if term in name:
is_director = True; break
This works fine. However, I'd like to add more version types as well as add many more patterns (in different languages) for the different version type. Is there a more performant way to do that than the for loop for each version I want to check? Given 1 million names and 1000 terms for various versions, I'm afraid this may become a bottleneck if I'm doing a forloop for each term.