af7469f7a0be086eb469a14e7e8392b67d56a323,textblob/translate.py,Translator,translate,#Translator#Any#Any#Any#Any#Any#,35
Before Change
data = {"client": "p", "ie": "UTF-8", "oe": "UTF-8",
"sl": from_lang, "tl": to_lang, "text": source}
json5 = self._get_json5(self.url, host=host, type_=type_, data=data)
if self._translation_successful(json5):
return self._get_translation_from_json5(json5)
else:
raise NotTranslated("Translation API returned the input string unchanged.")
def detect(self, source, host=None, type_=None):
Detect the source text"s language.
if PY2:
source = source.encode("utf-8")
After Change
"ie": "UTF-8", "oe": "UTF-8",
"sl": from_lang, "tl": to_lang, "text": source}
response = self._request(self.url, host=host, type_=type_, data=data)
result = json.loads(response)
try:
result, _ = json.loads(response)
except ValueError:
pass
self._validate_translation(source, result)
return result
def detect(self, source, host=None, type_=None):
Detect the source text"s language.
if PY2:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: sloria/TextBlob
Commit Name: af7469f7a0be086eb469a14e7e8392b67d56a323
Time: 2016-02-16
Author: alopez@smartvel.com
File Name: textblob/translate.py
Class Name: Translator
Method Name: translate
Project Name: sahana/eden
Commit Name: 247ca1182c954505af528cc3673ed6d55cbd1a7c
Time: 2020-01-06
Author: dominic@nursix.org
File Name: modules/geojson/mapping.py
Class Name:
Method Name: to_mapping
Project Name: mlflow/mlflow
Commit Name: b7222818e9dd4d33ee933388e73a11ad8d0bf89b
Time: 2018-09-06
Author: 33237569+tomasatdatabricks@users.noreply.github.com
File Name: tests/helper_functions.py
Class Name:
Method Name: score_model_in_sagemaker_docker_container