install the package google-api-python-client
sudo jython pip install --upgrade google-api-python-client
Source : This page.
#!/bin/bash
Files = path_to_png_files
for f in $Files
do
echo "Processing $f file..."
tesseract -l ara $f $f.txt
done
ls -d -l $PWD/*.txt > listing.csv
[
{
"op": "core/text-transform",
"description": "Text transform on cells in column Column 1 using expression grel:'file://'+value",
"engineConfig": {
"mode": "row-based",
"facets": []
},
"columnName": "Column 1",
"expression": "grel:'file://'+value",
"onError": "keep-original",
"repeat": false,
"repeatCount": 10
},
{
"op": "core/column-addition-by-fetching-urls",
"description": "Create column content at index 1 by fetching URLs based on column Column 1 using expression grel:value",
"engineConfig": {
"mode": "row-based",
"facets": []
},
"newColumnName": "content",
"columnInsertIndex": 1,
"baseColumnName": "Column 1",
"urlExpression": "grel:value",
"onError": "store-error",
"delay": 200,
"cacheResponses": true
}
]# coding: utf8
import sys
sys.path.append(r'/opt/jython2.7.0/Lib/site-packages/') #replace the path by your path to jython
import json
key ='YOUR_KEY_HERE'
from apiclient.discovery import build
target_language = 'fr'
service = build('translate','v2',developerKey=key)
collection = service.translations()
request = collection.list(q=value, source='ar', target=target_language)
response = request.execute()
response_json = json.dumps(response)
ascii_translation = ((response['translations'][0])['translatedText']).encode('utf-8').decode('ascii', 'ignore')
utf_translation = ((response['translations'][0])['translatedText']).encode('utf-8')
return(utf_translation)--
You received this message because you are subscribed to the Google Groups "OpenRefine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openrefine+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.