+ 2

Translating of the words

Hi! I have table of words, that were written in one language, and I need translation of this words to another language. Can you please recommend me decision with using such PL as Python? And this thing is my trial to construct the method for the solution, but I study python for some weeks and I don't know how it can be resolved. def translate = ... # It's the function for translation or maybe more than one function f = open ('words.csv', 'a') for line in f: # And now we should read first word, copy it, "go" to the translating site, copy the translation of the word, put it in our document and start with next word. Of course we use our function f.close ()

1st Nov 2019, 4:07 PM
Vitalii Frolov
Vitalii Frolov - avatar
7 Respostas
+ 7
Hi, we have had some similar requests some months ago. If you take a view on the entire workflow, there are some possible solutions. Some question raises which has to be answered before starting: Do you want to have the translation in both directions or not? Will it be a single user app ? How many pairs of words do you expect? Independent of the answers I can point you some directions. One would be to us a dictionary for the words in both languages. Dictionary can be saved in Jason format which is human readable and very close to the dict An other possible solution would be to use a (local) sql database to store data. So if you have some thoughts about it, we can see how to proceed.
1st Nov 2019, 4:52 PM
Lothar
Lothar - avatar
+ 5
Vitalii, an other quetsion about the data: can any side of the word list have duplicates? And does one word on one side have exactly one representation on the other side? i ask this question because a dict needs to have unique keys. search in keys is no problem, but it's not made to search for values and then show a key. an other way could be to use a pandas dataframe, but i haven't did much so far with it.
1st Nov 2019, 6:00 PM
Lothar
Lothar - avatar
+ 5
Vitalii, from all the information we have gatherd now, i personally would recommend you to use sqlite, which is a part of the supplied python distribution. You may have to learn a bit about sqlite, but it keeps away from you all the hazzle with readind, writing and managing your data. sqlite is availlable on playground. There are tutorials and management tools availlable for sqlite. But to make it clear: sqlite is not a multi user db and does only work on local hard drives not with network devices.
2nd Nov 2019, 10:14 AM
Lothar
Lothar - avatar
+ 4
The cleanest way for the translation would be to use a public API. There is Google Translate though I think their service has some cost. Free alternative could be https://tech.yandex.com/translate/ Or something similar. Another - programmatically dirtier option would be the use of web scraping / content parsing, basically simulating how you visit the translation site and read the result. Python is a solid and simple choice for this project, you can even build a prototype on SoloLearn. These python modules can be used: Data management, csv, excel support: pandas Web api: urllib, requests Scraping: BeautifulSoup (not on SL) The rest would be really trivial, but if you need help to build this I am happy to give you a hand. You can message me directly about this.
1st Nov 2019, 6:40 PM
Tibor Santa
Tibor Santa - avatar
+ 2
Hi. I need translation in both directions. This app will be a single user app. Expected number of the words is approximately 200-400.
1st Nov 2019, 5:00 PM
Vitalii Frolov
Vitalii Frolov - avatar
+ 2
In my table one word in the first language would be correspond to one word in the second language. And vice versa.
1st Nov 2019, 6:11 PM
Vitalii Frolov
Vitalii Frolov - avatar
+ 2
Give a sample of your "table". As I understand from your last comment, you've already done the translation, you just want to input some text from somewhere and output the translated text?
1st Nov 2019, 10:02 PM
rodwynnejones
rodwynnejones - avatar