Return a named entity extractor parameters for `lang` and of version `version`

  Args:
    lang (string): language code.
    version (string): version of the parameters to be used.
175901
def load_ner_model(lang="en", version="2"):
  
  src_dir = "ner{}".format(version)
  p = locate_resource(src_dir, lang)
  fh = _open(p)
  try:
    return pickle.load(fh)
  except UnicodeDecodeError:
    fh.seek(0)
    return pickle.load(fh, encoding='latin1')
481532
def versions_from_trove(trove):
    
    versions = set()
    for classifier in trove:
        if 'Programming Language :: Python ::' in classifier:
            ver = classifier.split('::')[-1]
            major = ver.split('.')[0].strip()
            if major:
                versions.add(major)
    return sorted(
        set([v for v in versions if v.replace('.', '', 1).isdigit()]))
586879
def get_title(self, lang=None):
        
        return self.metadata.get_single(key=DC.title, lang=lang)
844975
def get_translations(self, language=None):
        
        from .models import Translation

        if not self.pk:
            return Translation.objects.none()

        return Translation.objects.get_translations(obj=self, language=language)
307164
def namedb_get_version(con):
    
    sql = 'SELECT version FROM db_version;'
    args = ()

    try:
        rowdata = namedb_query_execute(con, sql, args, abort=False)
        row = rowdata.fetchone()
        return row['version']
    except:
        # no version defined
        return '0.0.0.0'
732493
def python_version_matchers():
    """"""
    version = sys.version_info
    patterns = [
        "{0}",
        "{0}{1}",
        "{0}.{1}",
    ]
    matchers = [
        pattern.format(*version)
        for pattern in patterns
    ] + [None]
    return set(matchers)
883643
def _parse_local_version(local):
    
    if local is not None:
        return tuple(
            part.lower() if not part.isdigit() else int(part)
            for part in _local_version_separators.split(local)
        )
522524
def get_version(version=None):
    
    if version is None:
        from modeltranslation import VERSION as version
    else:
        assert len(version) == 5
        assert version[3] in ('alpha', 'beta', 'rc', 'final')

    # Now build the two parts of the version number:
    # main = X.Y[.Z]
    # sub = .devN - for pre-alpha releases
    #     | {a|b|c}N - for alpha, beta and rc releases

    parts = 2 if version[2] == 0 else 3
    main = '.'.join(str(x) for x in version[:parts])

    sub = ''
    if version[3] == 'alpha' and version[4] == 0:
        git_changeset = get_git_changeset()
        if git_changeset:
            sub = '.dev%s' % git_changeset

    elif version[3] != 'final':
        mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'rc'}
        sub = mapping[version[3]] + str(version[4])

    return str(main + sub)
1153571
def version(package, encoding='utf-8'):
    
    path = os.path.join(os.path.dirname(__file__), package, '__init__.py')
    with io.open(path, encoding=encoding) as fp:
        version_info = fp.read()
    version_match = re.search(r"""^__version__ = ['"]([^'"]*)['"]""",
                              version_info, re.M)
    if not version_match:
        raise RuntimeError("Unable to find version string.")
    return version_match.group(1)
328629
def get(self, lang, instance):
        
        instance_key = TransCache._create_key(lang, instance)
        return self.cache[instance_key]
591099
def get_version_details(self, version_name):
    
    name = ('%s/versions/%s' % (self._full_model_name, version_name))
    return self._api.projects().models().versions().get(name=name).execute()
66356
def extract_version(txt):
    """"""
    words = txt.replace(',', ' ').split()
    version = None
    for x in reversed(words):
        if len(x) > 2:
            if x[0].lower() == 'v':
                x = x[1:]
            if '.' in x and x[0].isdigit():
                version = x
                break
    return version
1316616
def babelfy(self, text, params=None):
        
        self._entities = list()
        self._all_entities = list()
        self._merged_entities = list()
        self._all_merged_entities = list()
        self._text = " ".join(word.strip() for word in text.split())

        params = params or self._params
        params['key'] = self._api_key
        params['text'] = self._text
        if (sys.version < '3' and isinstance(params['text'], unicode)) or (sys.version >= '3' and isinstance(params['text'], bytes)): #pylint: disable=undefined-variable
            params['text'] = params['text'].encode('utf-8')
        url = BABELFY_API_URL + '?' + urlencode(params)

        request = Request(url)
        request.add_header('Accept-encoding', 'gzip')
        response = urlopen(request)
        if sys.version < '3':
            buf = StringIO(response.read())
        else:
            buf = BytesIO(response.read())
        f = gzip.GzipFile(fileobj=buf)
        reader = codecs.getreader('utf-8')
        self._data = json.load(reader(f))
1139018
def get_version(filename, encoding='utf8'):
    

    with io.open(filename, encoding=encoding) as sourcecode:
        for line in sourcecode:
            version = RE_VERSION.match(line)
            if version:
                return version.group(1)

    return None
959561
def get_missing_languages(self, field_name, db_table):
        
        db_table_fields = self.get_table_fields(db_table)
        for lang_code in AVAILABLE_LANGUAGES:
            if build_localized_fieldname(field_name, lang_code) not in db_table_fields:
                yield lang_code
1064663
function versionName( $lang = false )
    {
        if ( !$lang )
        {
            $lang = $this->initialLanguageCode();
        }

        if ( isset( $this->VersionNameCache[$lang] ) )
            return $this->VersionNameCache[$lang];

        $object = $this->attribute( 'contentobject' );
        if ( !$object )
        {
            $retValue = false;
            return $retValue;
        }

        $class = $object->attribute( 'content_class' );
        if ( !$class )
        {
            $retValue = false;
            return $retValue;
        }

        $this->VersionNameCache[$lang] = $class->contentObjectName( $object,
                                                                    $this->attribute( 'version' ),
                                                                    $lang );
        return $this->VersionNameCache[$lang];
    }
836819
def semantic_version(tag):
    
    try:
        version = list(map(int, tag.split('.')))
        assert len(version) == 3
        return tuple(version)
    except Exception as exc:
        raise CommandError(
            'Could not parse "%s", please use '
            'MAJOR.MINOR.PATCH' % tag
        ) from exc