translate text using spacy

The comment to your question is correct. You cannot use spaCy to translate text. A good open-source solution could be this library. Sample code:

from translate import Translator
translator = Translator(from_lang='el', to_lang='en')
translation = translator.translate("Ο όμορφος άντρας")
'''

You can the use spacy to perform comon NLP tasks, such as tokenization and
lemmatization in your desired language.

'''
import spacy
nlp = spacy.load('en')
doc = nlp(translation)
for token in doc:
    print(token, token.lemma_)

Output:

The the

handsome handsome

man man

Hope it helps!

Tags:

Nltk

Spacy