gen_ai_hub.evaluations.utils.language_match_utils
index
/home/jenkins/agent/workspace/ation_generative-ai-hub-sdk_main/gen_ai_hub/evaluations/utils/language_match_utils.py

 
Modules
       
langcodes

 
Classes
       
builtins.object
LanguageMapper

 
class LanguageMapper(builtins.object)
    Uses the langcodes library to convert language strings to normalized 
ISO 639-1 strings, handling regional variants like zh-CN.
 
  Class methods defined here:
get_iso_code_639_1(code: str) -> Optional[str] from builtins.type
Converts a language code string to its ISO 639-1 two-letter code.
 
:param code: Language code string (e.g., 'zh-CN', 'en_US', 'en')
:type code: str
:return: Two-letter ISO 639-1 code (e.g., 'zh', 'en'), or None if the code is invalid, excluded, or empty
:rtype: Optional[str]

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
EXCLUDED_CODES = {'bs', 'ms'}

 
Data
        Optional = typing.Optional