Page MenuHomePhabricator

Efficient method for mapping a WikiProject template to the WikiProject Directory
Closed, ResolvedPublic

Description

Something like this:

def wptemplate2directory(template_name):
  """
  Convert a WikiProject template name to a path within the
  WikiProject Directory hierarchy.  

  :Parameters:
    template_name : str
      The name of a template (or redirected template) used to tag an article

  :Returns:
    A directory path as a list of strings ordered from top to bottom.  
    E.g. "maths rating" returns ["stem", "mathematics"]
  """
  pass

@functools.lru_cache(10240)
def resolve_title(page_name):
  """
  Get the canonical name for a page name by following 
  redirects.  This method keeps a cache of mappings for page 
  names it's already seen.
  
  :Parameter:
    page_name : str
      the page name to resolve
  
  :Returns:
    The string representing the canonical title of a page after redirects
  """
  pass

Regretfully, there's no machine-readable version of https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Council/Directory