Code Monkey home page Code Monkey logo

Comments (8)

ZhymabekRoman avatar ZhymabekRoman commented on May 28, 2024 1

Hello, can you send example code in which exactly this error appears? Or can you please show the value of the translator variable?

from translate.

Animenosekai avatar Animenosekai commented on May 28, 2024 1
import pandas as pd
from translatepy.translators import GoogleTranslate

df = pd.read_csv("ru-en.csv")
translator = GoogleTranslate()
df['short_description EN'] = df['short_description'].apply(str).apply(lambda x: translator.translate(x, 'en', 'ru'))

Importing the entire translatepy gives the same result and does not change the behaviour/error message. The column is entirely in Russian and does not have any Null values.

I guess that there is quite a lot of data in ru-en.csv ?

Then, this might be why you hit the NoResult exception quite fast.

You should always use multiple translators, using translatepy.Translate, to avoid hitting the rate limits.

from translate.

Animenosekai avatar Animenosekai commented on May 28, 2024 1

How is the data at this column ? It seems weird that only this one encounters issues.

from translate.

octner avatar octner commented on May 28, 2024 1

How is the data at this column ? It seems weird that only this one encounters issues.

actually there was an empty line, it's just it was buried inside the csv file and for some reason I needed to find it manually myself + a couple of other strange rows. Deleting it fixed the issue. I guess can't have any empty lines in a pandas column?

Thanks for all your help!

from translate.

Animenosekai avatar Animenosekai commented on May 28, 2024 1

How is the data at this column ? It seems weird that only this one encounters issues.

actually there was an empty line, it's just it was buried inside the csv file and for some reason I needed to find it manually myself + a couple of other strange rows. Deleting it fixed the issue. I guess can't have any empty lines in a pandas column?

Thanks for all your help!

translatepy will try not to make any request when there is nothing to translate to avoid hitting rate limits

from translate.

octner avatar octner commented on May 28, 2024
import pandas as pd
from translatepy.translators import GoogleTranslate

df = pd.read_csv("ru-en.csv")
translator = GoogleTranslate()
df['short_description EN'] = df['short_description'].apply(str).apply(lambda x: translator.translate(x, 'en', 'ru'))

Importing the entire translatepy gives the same result and does not change the behaviour/error message. The column is entirely in Russian and does not have any Null values.

from translate.

Animenosekai avatar Animenosekai commented on May 28, 2024

(Also, don't run the translation every time you run the program and try to save the translated data)

from translate.

octner avatar octner commented on May 28, 2024
import pandas as pd
from translatepy.translators import GoogleTranslate

df = pd.read_csv("ru-en.csv")
translator = GoogleTranslate()
df['short_description EN'] = df['short_description'].apply(str).apply(lambda x: translator.translate(x, 'en', 'ru'))

Importing the entire translatepy gives the same result and does not change the behaviour/error message. The column is entirely in Russian and does not have any Null values.

I guess that there is quite a lot of data in ru-en.csv ?

Then, this might be why you hit the NoResult exception quite fast.

You should always use multiple translators, using translatepy.Translate, to avoid hitting the rate limits.

Thanks for the reply!

I do not think that the issue is related to the amount of data though. I ran the translation separately for each column (one of the columns had approx 5x times more text with the same number of rows), and it worked. However, it refuses to translate this one and throws this "NoResult" error.

Regarding the use of multiple translators: The first time I encountered this error, I was using multiple translators, but being more specific and picking GoogleTranslate worked for me and solved the issue. However, this time neither works. Maybe there is something problematic about this column, but I do not really see how it would be different from all the others that did get translated.

from translate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.