Closed ClintonNwokocha closed 1 year ago
@ClintonNwokocha Hi, friend
The number of words you typed in to be translated exceeds the limit for a single translation service. To avoid this error, you need to break up long articles and translate them multiple times. If you want to ignore the error directly, use parameters if_ignore_limit_of_length=True
.
Thanks for the reply, I appreciate
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: UlionTse @.> Sent: Friday, October 7, 2022 6:34:18 PM To: UlionTse/translators @.> Cc: Clinton Nwokocha @.>; Mention @.> Subject: Re: [UlionTse/translators] lenght of text exceeds limit (Issue #86)
@ClintonNwokochahttps://github.com/ClintonNwokocha Hi, friend The number of words you typed in to be translated exceeds the limit for a single translation service. To avoid this error, you need to break up long articles and translate them multiple times. If you want to ignore the error directly, use parameters if_ignore_limit_of_length=True.
— Reply to this email directly, view it on GitHubhttps://github.com/UlionTse/translators/issues/86#issuecomment-1271864230, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALKR3QYRVGXCEH44S3DSKHLWCBNJVANCNFSM6AAAAAAQ7N47EE. You are receiving this because you were mentioned.Message ID: @.***>
Thanks for this, I am trying to translate values in a pandas dataframe column but i get the below warning:
TranslatorError Traceback (most recent call last) C:\Users\LEOCLI~1\AppData\Local\Temp/ipykernel_15976/187497209.py in
----> 1 energy_data['project_purpose'] = energy_data['project_purpose'].apply(lambda x: ts.google(x, to_language='en'))
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\series.py in apply(self, func, convert_dtype, args, **kwargs) 4355 dtype: float64 4356 """ -> 4357 return SeriesApply(self, func, convert_dtype, args, kwargs).apply() 4358 4359 def _reduce(
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\apply.py in apply(self) 1041 return self.apply_str() 1042 -> 1043 return self.apply_standard() 1044 1045 def agg(self):
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\apply.py in apply_standard(self) 1096 # List[Union[Callable[..., Any], str]]]]]"; expected 1097 # "Callable[[Any], Any]" -> 1098 mapped = lib.map_infer( 1099 values, 1100 f, # type: ignore[arg-type]
C:\ProgramData\Anaconda3\lib\site-packages\pandas_libs\lib.pyx in pandas._libs.lib.map_infer()
C:\Users\LEOCLI~1\AppData\Local\Temp/ipykernel_15976/187497209.py in(x)
----> 1 energy_data['project_purpose'] = energy_data['project_purpose'].apply(lambda x: ts.google(x, to_language='en'))
C:\ProgramData\Anaconda3\lib\site-packages\translators-5.4.2-py3.9.egg\translators\apis.py in google_api(self, query_text, from_language, to_language, **kwargs) 405 sleep_seconds = kwargs.get('sleep_seconds', random.random()) 406 if_ignore_limit_of_length = kwargs.get('if_ignore_limit_of_length', False) --> 407 query_text = self.check_query_text(query_text, if_ignore_limit_of_length, limit_of_length=self.input_limit) 408 delete_temp_language_map_label = 0 409 if not query_text:
C:\ProgramData\Anaconda3\lib\site-packages\translators-5.4.2-py3.9.egg\translators\apis.py in check_query_text(query_text, if_ignore_limit_of_length, limit_of_length) 145 length = len(query_text) 146 if length >= limit_of_length and not if_ignore_limit_of_length: --> 147 raise TranslatorError('The length of the text to be translated exceeds the limit.') 148 else: 149 if length >= limit_of_length:
TranslatorError: The length of the text to be translated exceeds the limit.