s.py
def translate(
        content: str = Query(default=None, description="This is the content"),
        provider: Optional[str] = Query(default='google', description="The cloud provider that conducts the translation"),
        fromlang: Optional[str] = Query(default='en', description="The language the content is in"),
        tolang: Optional[str] = Query(default='de', description="The language to which we want to translate"),):
    """
    Translate the content with a cloud NLP translation service. The default service used is google.

    * **content**: Content to be translated by user
    * **provider**: The cloud/service provider
    * **fromlang**: The language code representing in which the content is written
    * **tolang**: The language code that is being written to.

    :return:
    """

    from_language = fromlang
    to_language = tolang


    if provider == "google":
        from cloudmesh.nlp.provider.google.translate import Translate

    elif provider == "aws":
        from cloudmesh.nlp.provider.aws.translate import Translate

    elif provider == "azure":
        from cloudmesh.nlp.provider.azure.translate import Translate

    else:
        return {"error": f"provider {provider} not supported"}



    s = Translate()
    r = s.get(content, SourceLanguageCode=from_language, TargetLanguageCode=to_language)
    return r

    Translate the content with a cloud NLP translation service. The default service used is google.

    * **content**: Content to be translated by user
    * **provider**: The cloud/service provider
    * **fromlang**: The language code representing in which the content is written
    * **tolang**: The language code that is being written to.

    :return:
    
Translate the content with a cloud NLP translation service. The default service used is google.
Translate the content with a cloud NLP translation service . The default service used is google .
def translate(
        content: str = Query(default=None, description="This is the content"),
        provider: Optional[str] = Query(default='google', description="The cloud provider that conducts the translation"),
        fromlang: Optional[str] = Query(default='en', description="The language the content is in"),
        tolang: Optional[str] = Query(default='de', description="The language to which we want to translate"),):
    from_language = fromlang
    to_language = tolang
    if provider == "google":
        from cloudmesh.nlp.provider.google.translate import Translate
    elif provider == "aws":
        from cloudmesh.nlp.provider.aws.translate import Translate
    elif provider == "azure":
        from cloudmesh.nlp.provider.azure.translate import Translate
    else:
        return {"error": f"provider {provider} not supported"}
    s = Translate()
    r = s.get(content, SourceLanguageCode=from_language, TargetLanguageCode=to_language)
    return r
def translate ( content : str = Query ( default = None , description = "This is the content" ) , provider : Optional [ str ] = Query ( default = 'google' , description = "The cloud provider that conducts the translation" ) , fromlang : Optional [ str ] = Query ( default = 'en' , description = "The language the content is in" ) , tolang : Optional [ str ] = Query ( default = 'de' , description = "The language to which we want to translate" ) , ) : from_language = fromlang to_language = tolang if provider == "google" : from cloudmesh . nlp . provider . google . translate import Translate elif provider == "aws" : from cloudmesh . nlp . provider . aws . translate import Translate elif provider == "azure" : from cloudmesh . nlp . provider . azure . translate import Translate else : return { "error" : f"provider {provider} not supported" } s = Translate ( ) r = s . get ( content , SourceLanguageCode = from_language , TargetLanguageCode = to_language ) return r
Translate the content with a cloud NLP translation service.
Translate the content with a cloud NLP translation service .
"""
    Translate the content with a cloud NLP translation service. The default service used is google.

    * **content**: Content to be translated by user
    * **provider**: The cloud/service provider
    * **fromlang**: The language code representing in which the content is written
    * **tolang**: The language code that is being written to.

    :return:
    """
None
content
str
provider
Optional[str]
fromlang
Optional[str]
tolang
Optional[str]