Hi Jean-Christophe,
Would it be possible for you to post your full script?
Following this exchange has been a great introductions to ASobjC and
managing XML. I have the need to performs conversions like this from
time to time either with TMX or XLIFF and having your script would
be a great place to start.
Up to now I've usually ended up doing some kind of kludge using
regex search and replace in TextWrangler.
It would be great to try doing it with some proper code.
TIA,
Denis
On 26/03/2017 10:06, Jean-Christophe
Helary wrote:
Regarding performance, and real use...
The application I use for that kind of conversion is a Java application that used to be proprietary and was GPLed once the company closed. The application itself is extremely useful for plenty of other things but I'm mostly using it these days to convert Excel data to TMX.
I wanted to compare the performance of my hack to that pro app with a big file. So I went to the European Union translation office and downloaded a big TM set. I took the biggest TM in the set (19mb), converted it to Excel with that app and used that Excel file as test data: more than 2000 rows with 23 different languages, with most of the cells full of legalese fat paragraphs (about 1,1 million words). The Excel file itself was about 4mb.
It took my script about 35 seconds for the conversion (which is actually less than it took Excel to just open it, with way less fan rotation).
The pro app was not able to do it. At first, it chocked on the language codes that seemingly were not ISO. I changed them all to ISO codes and it still did not accept them. After many attempts, I decided to try with only 2 languages with codes that I was sure worked. I got an index whatever error (presumably the data was too big). I cut the data to 1/10th, still got the same error. Eventually, I quit. It took me about 2 hours to try to debug the process.
So, the conclusion is that what I did over the course of 2 days ended up being better than a pro app that I had paid quite a bit a while back. There are plenty of things to polish in the script to make it fit my workflow (like save to the place where the Excel is located, with the same name, make sure I cover a few error cases with relevant messages, etc.) but basically it works perfectly well now.
This is extremely empowering. Thank you Shane and Steve, and Script Debugger.
Jean-Christophe
On Mar 26, 2017, at 16:02, Jean-Christophe Helary <email@hidden> wrote:
On Mar 26, 2017, at 10:54, Shane Stanley <email@hidden> wrote:
On 26 Mar 2017, at 11:38 am, Jean-Christophe Helary <email@hidden> wrote:
When I think that the whole thing was 2 loops with basically what amounts to a few text transformations, it's quite amazing that it took so much time to get everything working.
The first time at anything is always slower.
I just read a comment by Phil Stokes on the SD forum about how it took him learning Cocoa and Obj-C to be able to really use ASObj-C so I have a sense that my second time, and my third time are going to be just as slow as the first :) Because just like for natural languages, if you don't have a daily use of them, you can't just wrap your mind around their mechanics and you always stumble on grammar and vocabulary.
I guess I need to change of job and create myself more opportunities to write code. But this TMX thing was an excellent start (if I may say so), since it is 100% work related and 100% useful (although strictly limited to *1* use case I have).
Jean-Christophe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
|