protected override void OnInitializeTask() { var fileLanguageDirections = TaskFiles.Select(x => x.GetLanguageDirection().TargetLanguage.IsoAbbreviation).Distinct(); if (fileLanguageDirections.Count() > 1) { throw new Exception( $"This batch task can only be applied to one language direction at a time. Select only files with same language direction and try again."); } else if (fileLanguageDirections.Count() == 0) { throw new Exception( $"No target files selected."); } this.collectedSentencePairCount = 0; this.settings = GetSetting <FinetuneBatchTaskSettings>(); this.opusCatOptions = new OpusCatOptions(new Uri(this.settings.ProviderOptions)); //Use project guid in case no model tag specified if (this.opusCatOptions.modelTag == "") { this.opusCatOptions.modelTag = this.Project.GetProjectInfo().Id.ToString(); } //Get instances of the translation memories included in the project. this.tms = this.InstantiateProjectTms(); this.ProjectTranslations = new Dictionary <Language, List <Tuple <string, string> > >(); this.ProjectNewSegments = new Dictionary <Language, List <string> >(); this.ProjectFuzzies = new Dictionary <Language, List <TranslationUnit> >(); this.sourceVisitor = new OpusCatProviderElementVisitor(); this.targetVisitor = new OpusCatProviderElementVisitor(); base.OnInitializeTask(); }
public FileReader(FinetuneBatchTaskSettings settings) { this.settings = settings; this.FileTranslations = new List <Tuple <string, string> >(); this.FileNewSegments = new List <string>(); this.sourceVisitor = new OpusCatMarkupDataVisitor(); this.targetVisitor = new OpusCatMarkupDataVisitor(); }
public FinetuneWpfControl(FinetuneBatchTaskSettings Settings) { this.DataContext = this; //Settings is the object that is passed on to the batch task. this.Settings = Settings; //Mode defaults, changeable with radio buttons this.Settings.Finetune = true; this.Settings.PreOrderMtForNewSegments = true; //Some settings are initially held in a OpusCatOptions object (the shared properties //with the translation provider settings). this.Options = new OpusCatOptions(); //Whenever the options change, also update the option URI string in settings this.Options.PropertyChanged += Options_PropertyChanged; InitializeComponent(); this.TagBox.ItemsSource = new ObservableCollection <string>() { "<new tag>" }; }