Example #1
0
 private void CloseProject()
 {
     CurrentText = null;
     _texts.Clear();
     CurrentText   = new TextViewModel(_tokenizer);
     _sourceCorpus = null;
     _targetCorpus = null;
     if (_hybridEngine != null)
     {
         _hybridEngine.Dispose();
         _hybridEngine = null;
     }
     if (_smtModel != null)
     {
         _smtModel.Dispose();
         _smtModel = null;
     }
     _saveProjectCommand.UpdateCanExecute();
     RebuildTask.UpdateCanExecute();
 }
Example #2
0
        private void PopulateSegments()
        {
            var segmentComparer  = new SegmentComparer();
            var categoryComparer = new SegmentCategoryComparer();

            _busyService.ShowBusyIndicatorUntilFinishDrawing();
            using (_domainSegments.BulkUpdate())
                using (_segments.BulkUpdate())
                {
                    _domainSegments.Clear();
                    _segments.Clear();
                    foreach (Segment segment in _projectService.Project.Varieties
                             .SelectMany(v => v.SyllablePositionSegmentFrequencyDistributions[DomainSyllablePosition].ObservedSamples)
                             .Distinct().OrderBy(s => s.Category(), categoryComparer).ThenBy(s => s, segmentComparer))
                    {
                        _domainSegments.Add(segment);
                        _segments.Add(new SegmentViewModel(segment));
                    }
                }

            _categories.ReplaceAll(_segments.GroupBy(s => s.DomainSegment.Category()).OrderBy(g => g.Key, categoryComparer).Select(g => new SegmentCategoryViewModel(g.Key, g)));
            HasSegments = _segments.Count > 0;
        }