class_docstr: Provides methods that implement functionality of route guide server.
class_docstr_tok: ["Provides","methods","that","implement","functionality","of","route","guide","server","."]
code: def TranslateText(self, request, context):
      logging.info(
          f"Request received w/ {len(request.texts)} utterances"
      )
      results = []
  
      if request.source_language not in self._models:
          context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
          context.set_details(
              f"Could not find source-target language pair {request.source_language}-{request.target_language} in list of models."
          )
          return nmt.TranslateTextResponse()
  
      if (
          request.target_language
          not in self._models[request.source_language]
      ):
          context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
          context.set_details(
              f"Could not find source-target language pair {request.source_language}-{request.target_language} in list of models."
          )
          return nmt.TranslateTextResponse()
  
      request_strings = [x for x in request.texts]
  
      for batch in batches(request_strings, self._batch_size):
          if self._punctuation_model_path != "":
              batch = (
                  self.punctuation_model.add_punctuation_capitalization(
                      batch
                  )
              )
          batch_results = self._models[request.source_language][
              request.target_language
          ].translate(text=batch)
          translations = [
              nmt.Translation(translation=x) for x in batch_results
          ]
          results.extend(translations)
  
      return nmt.TranslateTextResponse(translations=results)
  
file_path: NeMo/tools/nmt_grpc_service/server.py
imports: import argparse
  import os
  from concurrent import futures
  import api.nmt_pb2
  import api.nmt_pb2_grpc
  import grpc
  import torch
  import nemo.collections.nlp
  from nemo.utils import logging
label_desc: Use image node_id 4 for calling the RivaTranslateServicer obj's underlying member method code with example usage: obj.TranslateText(request, context) and returns: nmt, nmt, nmt