Return a morfessor model for `lang` and of version `version`

  Args:
    lang (string): language code.
    version (string): version of the parameters to be used.
337993
def load_morfessor_model(lang="en", version="2"):
  
  src_dir = "morph{}".format(version)
  p = locate_resource(src_dir, lang)
  file_handler = _open(p)
  tmp_file_ = NamedTemporaryFile(delete=False)
  tmp_file_.write(file_handler.read())
  tmp_file_.close()
  io = morfessor.MorfessorIO()
  model = io.read_any_model(tmp_file_.name)
  os.remove(tmp_file_.name)
  return model
1188457
def partition_version_classifiers(
        classifiers: t.Sequence[str], version_prefix: str = 'Programming Language :: Python :: ',
        only_suffix: str = ' :: Only') -> t.Tuple[t.List[str], t.List[str]]:
    """"""
    versions_min, versions_only = [], []
    for classifier in classifiers:
        version = classifier.replace(version_prefix, '')
        versions = versions_min
        if version.endswith(only_suffix):
            version = version.replace(only_suffix, '')
            versions = versions_only
        try:
            versions.append(tuple([int(_) for _ in version.split('.')]))
        except ValueError:
            pass
    return versions_min, versions_only
44668
def _parse_version(version):
        
        parsed_version = parse_version(version)
        return tuple(
            int(dot_version)
            for dot_version in parsed_version.base_version.split('.')
        ) + (parsed_version.is_prerelease,)
1102415
def get_description(self, lang=None):
        
        return self.metadata.get_single(key=RDF_NAMESPACES.CTS.description, lang=lang)
300379
def get_lang_dict(self):
        """"""
        r = self.yandex_translate_request("getLangs")
        self.handle_errors(r)

        return r.json()["langs"]
457493
public LanguageVersion languageVersion() {
        try {
            Object retVal;
            String methodName = "languageVersion";
            Class<?>[] paramTypes = new Class<?>[0];
            Object[] params = new Object[0];
            try {
                retVal = invoke(methodName, JAVA_1_1, paramTypes, params);
            } catch (DocletInvokeException exc) {
                return JAVA_1_1;
            }
            if (retVal instanceof LanguageVersion) {
                return (LanguageVersion)retVal;
            } else {
                messager.error(Messager.NOPOS, "main.must_return_languageversion",
                               docletClassName, methodName);
                return JAVA_1_1;
            }
        } catch (NoClassDefFoundError ex) { // for boostrapping, no Enum class.
            return null;
        }
    }
1287337
def get_language_progress(self, lang):
        """"""
        if not self._is_current_language(lang):
            self._switch_language(lang)

        fields = ['streak', 'language_string', 'level_progress',
                  'num_skills_learned', 'level_percent', 'level_points',
                  'points_rank', 'next_level', 'level_left', 'language',
                  'points', 'fluency_score', 'level']

        return self._make_dict(fields, self.user_data.language_data[lang])
1297294
def get_available_languages(self, obj):
        
        if obj:
            return obj.get_available_languages()
        else:
            return self.model._parler_meta.root_model.objects.none()
1354591
def get_language_details(self, language):
        """"""
        for lang in self.user_data.languages:
            if language == lang['language_string']:
                return lang

        return {}
588603
def get_language(language_name):
    

    langs = list(pkg_resources.iter_entry_points(group=LANG_EP,
                                                 name=language_name))

    if not langs:
        raise TextXError('Language "{}" is not registered.'
                         .format(language_name))

    if len(langs) > 1:
        # Multiple languages defined with the same name
        raise TextXError('Language "{}" registered multiple times:\n{}'
                         .format(language_name,
                                 "\n".join([l.dist for l in langs])))

    return langs[0].load()()
328229
def iter_format_modules(lang):
    
    if check_for_language(lang):
        format_locations = []
        for path in CUSTOM_FORMAT_MODULE_PATHS:
            format_locations.append(path + '.%s')
        format_locations.append('django.conf.locale.%s')
        locale = to_locale(lang)
        locales = [locale]
        if '_' in locale:
            locales.append(locale.split('_')[0])
        for location in format_locations:
            for loc in locales:
                try:
                    yield import_module('.formats', location % loc)
                except ImportError:
                    pass
76092
def load_pos_model(lang="en", version="2"):
  
  src_dir = "pos{}".format(version)
  p = locate_resource(src_dir, lang)
  fh = _open(p)
  return dict(np.load(fh))
1168497
def get_translation_from_instance(instance, lang):
        
        try:
            translation = get_translation(instance, lang)
        except (AttributeError, ObjectDoesNotExist):
            translation = None
        return translation
11858
def _clone(self, klass=None, **kwargs):
        
        clone = super(MultilingualModelQuerySet, self)._clone(klass, **kwargs)
        clone._default_language = getattr(self, '_default_language', None)
        return clone
181505
def get_languages_from_model(app_label, model_label):
        
        try:
            mod_lan = TransModelLanguage.objects.filter(model='{} - {}'.format(app_label, model_label)).get()
            languages = [lang.code for lang in mod_lan.languages.all()]
            return languages
        except TransModelLanguage.DoesNotExist:
            return []
946273
def get_engine_for_lang(self, lang):
        '''
        
        '''
        for eng in self.engines:
            if lang in eng.languages.keys():
                return eng
        raise TTSError('Could not match language')
36253
def get_version(model_instance, version):
    
    version_field = get_version_fieldname(model_instance)
    kwargs = {'pk': model_instance.pk, version_field: version}
    return model_instance.__class__.objects.get(**kwargs)