def get_namespace(tag):
    m = re.match("^{(.*?)}", tag)
    namespace = m.group(1) if m else ""
    if not namespace.startswith("http://www.mediawiki.org/xml/export-"):
        raise ValueError("%s not recognized as MediaWiki dump namespace"
                         % namespace)
    return namespace
Returns the namespace of tag.
dataset/ETHPy150Open largelymfs/topical_word_embeddings/TWE-1/gensim/corpora/wikicorpus.py/get_namespace