Hi all,
we're introducing some functions, in the imdb.helpers module, to play a
little with titles AKAs (most of the code is a work of Alberto Malagoli;
refactoring, bugs and misuses of the original idea are mine).

The functions:
# akasLanguages(movie)
Returns  a list of tuples in (lang, AKA) format; lang can be None, if
unable to guess.


# sortAKAsBySimilarity(movie, title, _titlesOnly=True, _preferredLang=None)
Return a list of AKAs for the movie (a Movie instance), sorted on
similarity with
the given title (a string).  This is useful to get most similar title
to the one you
searched, for example.
If _preferredLang is given, titles in that languages are preferred.
If _titlesOnly is False, the returned values is no longer a list of
titles (unicode strings),
but a list of (score, title, language) tuples.


# getAKAsInLanguage(movie, lang, _searchedTitle=None)
Return all AKAs of the movie object, for the given language.
If _searchedTitle is given, the results are sorted based on their
similarity to it.


Notice that "language" is the English, capitalized, representation of
the language.
So "English", "Italian", "Turkish" and so on, as defined in the LANG_COUNTRIES
of the 'imdb.linguistics' modules (I've renamed the 'imdb.articles' module).


If you have ideas for improvements, bug reports and so on, let us know!


-- 
Davide Alberani <davide.alber...@gmail.com>  [PGP KeyID: 0x465BFD47]
http://www.mimante.net/

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel

Reply via email to