![]() This little script was developed much further by cienislaw and Yu Tang, and here’s a link to a much cleaner final solution that incorporates all the developments: I realize, there’s plenty of room for improvements, and I’m eager to get any ideas, hints, comments and criticism. Also a big thank you is due to Yu Tang for sharing invaluable programming ideas in a layman’s language. I want to thank Marco Cevoli at Qabiria for sponsoring the development of this script. I need to admit, it was somewhat above my head, and I jumped into it without fully understanding what is involved. You may want to disable automatic insertion of good matches ( Options → Editing Behaviour → Insert the best fuzzy match), because once the script is invoked you won’t have much control over what is going on, till it finishes. To fix that, one can use TMXCleaner or prepare a temporary source file that will contain only unique segments: updated script here. The script writes TMX file that can contain same entries if it runs through non-unique segments. It might be worth trying to time how fast matches appear by going from segment to segment and setting this value accordingly. Translated segments get processed much faster though and the pause interval is not taken into consideration for them. While the script is running, you cannot use OmegaT, so if you need to prepare TMX for a rather big project, be ready to run the script and let OmegaT do the work for some time. If there are a lot of TU’s in the legacy TMX file(s), or the computer where OmegaT runs is somewhat slow, this value has to be increased (which means longer processing time). It means that if the project is 1000 segments long, the script will take almost 10 minutes (500 seconds or 8 minutes 20 seconds) to process it. Currently it’s set to 500 milliseconds (line 33). Maybe I can dig it out myself too, but don’t hold your breath just yet.Īnother vital value to keep in mind is the time the script pauses at each segment to wait for its matches to appear. This might be changed in future to be more inclusive, but someone would have to hint me as to how to get a total number of matches for any given segment in a script. It needs to be noted that only the best match per segment gets exported, not all the ones that score. Otherwise segments without matches are skipped, and the matches whose similarity is above threshold (line 26) make it into the exported files. If the segment is translated, its source and translation is exported to the resultant TMX. This script runs through your whole project or only through selected files (triggered in line 20) and gets fuzzy matches for each segment. $hitcount TU were exported to $relevant_mem.\ The script has processed $count segments.Įmpty file $relevant_mem has been deleted.\ If(fc.showOpenDialog() != JFileChooser.APPROVE_OPTION) " the file filter must show also directories, in order to be able to look into them Sourceroot = prop.getSourceRoot().toString() as StringįileSelectionMode: JFileChooser.FILES_ONLY, ShowMessageDialog null, msg, title, INFORMATION_MESSAGEĭef sourceLocale = prop.getSourceLanguage().toString()ĭef targetLocale = prop.getTargetLanguage().toString()ĭef folder = prop.projectRoot '/tmx_export'ĭef fileloc = folder '/exported_relevant.tmx' from previous segments) exported.įinal def title = 'Export relevant TU\'s'įinal def msg = 'Please try again after you open a project.' * keeping in mind that if it's too low, you may end up having wrong TU's * the script will wait for match pane to update. * Specify wait time (in milliseconds) for each segment. * above it will make into the exported TMX file * Specify similarity threshold for found matches. ![]() If anything else is specified, the script * Set "select_files" to 'yes' if you want to use file selector ![]() * in subfolder 'tmx_export" in current project's root * from TMX files in /tm into a new TMX file * Purpose:Ğxport only those TU's that are relevant for the current project * Development of this script has been sponsored by Qabiria - * The problem has been (or still is) discussed on OmegaT Yahoo Group. The problem is evident - you need OmegaT to get matches for each segment, and if they are any good, store them somewhere handy, in a separate TMX file. Somehow you need to extract from your TMX files only those TU’s that have matches in the current project. ![]() You need to give this project to someone else, but you don’t want to give away all of your previous translation. You have a new project and legacy translation memory files that usually go to /tm folder of OmegaT project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |