public IcuRulesCollationDefinition(string type) : base(type) { _imports = new BulkObservableList <IcuCollationImport>(); IsValid = true; SetupCollectionChangeListeners(); }
public IcuRulesCollationDefinition(string type) : base(type) { _imports = new BulkObservableList<IcuCollationImport>(); IsValid = true; SetupCollectionChangeListeners(); }
public void MoveRange_InvalidNewIndex_Throws() { var list = new BulkObservableList <string> { "a", "b", "c", "d", "e" }; Assert.That(() => list.MoveRange(0, 2, 4), Throws.InstanceOf <ArgumentOutOfRangeException>()); }
public IcuRulesCollationDefinition(IcuRulesCollationDefinition ircd) : base(ircd) { WritingSystemFactory = ircd.WritingSystemFactory; OwningWritingSystemDefinition = ircd.OwningWritingSystemDefinition; _imports = new BulkObservableList<IcuCollationImport>(ircd._imports); _icuRules = ircd._icuRules; SetupCollectionChangeListeners(); }
public void MoveRange_OldIndexLessThanNewIndex_ItemsMoved() { var list = new BulkObservableList <string> { "a", "b", "c", "d", "e" }; list.MoveRange(0, 2, 3); Assert.That(list, Is.EqualTo(new[] { "c", "d", "e", "a", "b" })); }
public void MoveRange_OldIndexEqualToNewIndex_ItemsNotMoved() { var list = new BulkObservableList <string> { "a", "b", "c", "d", "e" }; list.MoveRange(1, 2, 1); Assert.That(list, Is.EqualTo(new[] { "a", "b", "c", "d", "e" })); }
public IcuRulesCollationDefinition(IcuRulesCollationDefinition ircd) : base(ircd) { WritingSystemFactory = ircd.WritingSystemFactory; OwningWritingSystemDefinition = ircd.OwningWritingSystemDefinition; _imports = new BulkObservableList <IcuCollationImport>(ircd._imports); _icuRules = ircd._icuRules; SetupCollectionChangeListeners(); }
public Variety(string name) { _name = name; _words = new WordCollection(this); _varietyPairs = new VarietyVarietyPairCollection(this); _affixes = new BulkObservableList<Affix>(); _regions = new BulkObservableList<GeographicRegion>(); _syllablePositionSegmentFreqDists = new ObservableDictionary<FeatureSymbol, FrequencyDistribution<Segment>>(); }
public Variety(string name) { _name = name; Words = new WordCollection(this); VarietyPairs = new VarietyVarietyPairCollection(this); Affixes = new BulkObservableList <Affix>(); Regions = new BulkObservableList <GeographicRegion>(); SyllablePositionSegmentFrequencyDistributions = new ObservableDictionary <FeatureSymbol, FrequencyDistribution <Segment> >(); }
public MainFormViewModel() { _tokenizer = new LatinWordTokenizer(); _openProjectCommand = new RelayCommand(OpenProject); _saveProjectCommand = new RelayCommand(SaveProject, CanSaveProject); CloseCommand = new RelayCommand(Close, CanClose); _hcTraceManager = new TraceManager(); _confidenceThreshold = 20; _texts = new BulkObservableList <TextViewModel>(); Texts = new ReadOnlyObservableList <TextViewModel>(_texts); _currentText = new TextViewModel(_tokenizer); RebuildTask = new TaskViewModel(RebuildAsync, () => _hybridEngine != null); }
public SegmentsViewModel(IProjectService projectService, IDialogService dialogService, IBusyService busyService, IExportService exportService, WordsViewModel.Factory wordsFactory, WordViewModel.Factory wordFactory) : base("Segments") { _projectService = projectService; _busyService = busyService; _dialogService = dialogService; _exportService = exportService; _wordFactory = wordFactory; _findCommand = new RelayCommand(Find); TaskAreas.Add(new TaskAreaCommandGroupViewModel("Syllable position", new TaskAreaCommandViewModel("Onset", new RelayCommand(() => SyllablePosition = SyllablePosition.Onset)), new TaskAreaCommandViewModel("Nucleus", new RelayCommand(() => SyllablePosition = SyllablePosition.Nucleus)), new TaskAreaCommandViewModel("Coda", new RelayCommand(() => SyllablePosition = SyllablePosition.Coda)))); TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Find words", _findCommand), new TaskAreaItemsViewModel("Sort words by", new TaskAreaCommandGroupViewModel( new TaskAreaCommandViewModel("Meaning", new RelayCommand(() => SortWordsBy("Meaning.Gloss", ListSortDirection.Ascending))), new TaskAreaCommandViewModel("Form", new RelayCommand(() => SortWordsBy("StrRep", ListSortDirection.Ascending))))))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Export segment frequencies", new RelayCommand(() => _exportService.ExportSegmentFrequencies(this, _syllablePosition))))); _projectService.ProjectOpened += _projectService_ProjectOpened; Messenger.Default.Register <DomainModelChangedMessage>(this, msg => { if (msg.AffectsComparison) { PopulateSegments(); } }); _currentWords = new BulkObservableList <WordViewModel>(); _observedWords = wordsFactory(new ReadOnlyBindableList <WordViewModel>(_currentWords)); _domainSegments = new BulkObservableList <Segment>(); _segments = new BulkObservableList <SegmentViewModel>(); _readonlySegments = new ReadOnlyBindableList <SegmentViewModel>(_segments); _categories = new BulkObservableList <SegmentCategoryViewModel>(); _readonlyCategories = new ReadOnlyBindableList <SegmentCategoryViewModel>(_categories); }
public SegmentsViewModel(IProjectService projectService, IDialogService dialogService, IBusyService busyService, IExportService exportService, WordsViewModel.Factory wordsFactory, WordViewModel.Factory wordFactory) : base("Segments") { _projectService = projectService; _busyService = busyService; _dialogService = dialogService; _exportService = exportService; _wordFactory = wordFactory; _findCommand = new RelayCommand(Find); TaskAreas.Add(new TaskAreaCommandGroupViewModel("Syllable position", new TaskAreaCommandViewModel("Onset", new RelayCommand(() => SyllablePosition = SyllablePosition.Onset)), new TaskAreaCommandViewModel("Nucleus", new RelayCommand(() => SyllablePosition = SyllablePosition.Nucleus)), new TaskAreaCommandViewModel("Coda", new RelayCommand(() => SyllablePosition = SyllablePosition.Coda)))); TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaCommandViewModel("Find words", _findCommand), new TaskAreaItemsViewModel("Sort words by", new TaskAreaCommandGroupViewModel( new TaskAreaCommandViewModel("Meaning", new RelayCommand(() => SortWordsBy("Meaning.Gloss", ListSortDirection.Ascending))), new TaskAreaCommandViewModel("Form", new RelayCommand(() => SortWordsBy("StrRep", ListSortDirection.Ascending))))))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Export segment frequencies", new RelayCommand(ExportSegmentFrequencies, CanExportSegmentFrequencies)))); _projectService.ProjectOpened += _projectService_ProjectOpened; Messenger.Default.Register<DomainModelChangedMessage>(this, msg => { if (msg.AffectsComparison) PopulateSegments(); }); _currentWords = new BulkObservableList<WordViewModel>(); _observedWords = wordsFactory(new ReadOnlyBindableList<WordViewModel>(_currentWords)); _domainSegments = new BulkObservableList<Segment>(); _segments = new BulkObservableList<SegmentViewModel>(); _readonlySegments = new ReadOnlyBindableList<SegmentViewModel>(_segments); _categories = new BulkObservableList<SegmentCategoryViewModel>(); _readonlyCategories = new ReadOnlyBindableList<SegmentCategoryViewModel>(_categories); }
public TextViewModel(ITokenizer <string, int> tokenizer, string name, string metadataFileName, string sourceFileName, string targetFileName, string alignmentFileName) { Name = name; _metadataFileName = metadataFileName; _targetFileName = targetFileName; _alignmentFileName = alignmentFileName; _tokenizer = tokenizer; _sourceSegments = new List <Segment>(); _targetSegments = new List <Segment>(); _approvedSegments = new HashSet <int>(); _paragraphs = new HashSet <int>(); _goToNextSegmentCommand = new RelayCommand(GoToNextSegment, CanGoToNextSegment); _goToPrevSegmentCommand = new RelayCommand(GoToPrevSegment, CanGoToPrevSegment); _approveSegmentCommand = new RelayCommand(ApproveSegment, CanApproveSegment); _applyAllSuggestionsCommand = new RelayCommand(ApplyAllSuggestions, CanApplyAllSuggestions); _selectSourceSegmentCommand = new RelayCommand <int>(SelectSourceSegment); _selectTargetSegmentCommand = new RelayCommand <int>(SelectTargetSegment); _suggestions = new BulkObservableList <SuggestionViewModel>(); Suggestions = new ReadOnlyObservableList <SuggestionViewModel>(_suggestions); _sourceSegmentWords = new List <string>(); _unapprovedTargetSegmentRanges = new BulkObservableList <Range <int> >(); UnapprovedTargetSegmentRanges = new ReadOnlyObservableList <Range <int> >( _unapprovedTargetSegmentRanges); _alignedSourceWords = new BulkObservableList <AlignedWordViewModel>(); AlignedSourceWords = new ReadOnlyObservableList <AlignedWordViewModel>(_alignedSourceWords); _suggester = new WordTranslationSuggester() { ConfidenceThreshold = 0.2 }; LoadMetadataFile(); LoadTextFile(sourceFileName, _sourceSegments); SourceText = GenerateText(_sourceSegments); LoadTextFile(_targetFileName, _targetSegments); TargetText = GenerateText(_targetSegments); UpdateUnapprovedTargetSegmentRanges(); }
public VarietiesVarietyViewModel(IProjectService projectService, IDialogService dialogService, WordsViewModel.Factory wordsFactory, WordViewModel.Factory wordFactory, Variety variety) : base(variety) { _projectService = projectService; _dialogService = dialogService; IEnumerable<Segment> segments = variety.SegmentFrequencyDistribution == null ? Enumerable.Empty<Segment>() : variety.SegmentFrequencyDistribution.ObservedSamples; _segments = new BulkObservableList<VarietySegmentViewModel>(segments.Select(seg => new VarietySegmentViewModel(this, seg))); _maxSegProb = _segments.Select(seg => seg.Probability).Concat(0).Max(); _readOnlySegments = new ReadOnlyBindableList<VarietySegmentViewModel>(_segments); variety.PropertyChanged += variety_PropertyChanged; _affixes = new MirroredBindableList<Affix, AffixViewModel>(DomainVariety.Affixes, affix => new AffixViewModel(affix), vm => vm.DomainAffix); _words = new MirroredBindableCollection<Word, WordViewModel>(variety.Words, word => { WordViewModel vm = wordFactory(word); SelectWordSegments(vm); return vm; }, vm => vm.DomainWord); _wordsViewModel = wordsFactory(_words); _newAffixCommand = new RelayCommand(NewAffix); _editAffixCommand = new RelayCommand(EditAffix, CanEditAffix); _removeAffixCommand = new RelayCommand(RemoveAffix, CanRemoveAffix); }
public VarietiesVarietyViewModel(IProjectService projectService, IDialogService dialogService, WordsViewModel.Factory wordsFactory, WordViewModel.Factory wordFactory, Variety variety) : base(variety) { _projectService = projectService; _dialogService = dialogService; IEnumerable <Segment> segments = variety.SegmentFrequencyDistribution == null?Enumerable.Empty <Segment>() : variety.SegmentFrequencyDistribution.ObservedSamples; _segments = new BulkObservableList <VarietySegmentViewModel>(segments.Select(seg => new VarietySegmentViewModel(this, seg))); _maxSegProb = _segments.Select(seg => seg.Probability).Concat(0).Max(); _readOnlySegments = new ReadOnlyBindableList <VarietySegmentViewModel>(_segments); variety.PropertyChanged += variety_PropertyChanged; _affixes = new MirroredBindableList <Affix, AffixViewModel>(DomainVariety.Affixes, affix => new AffixViewModel(affix), vm => vm.DomainAffix); _words = new MirroredBindableCollection <Word, WordViewModel>(variety.Words, word => { WordViewModel vm = wordFactory(word); SelectWordSegments(vm); return(vm); }, vm => vm.DomainWord); _wordsViewModel = wordsFactory(_words); _newAffixCommand = new RelayCommand(NewAffix); _editAffixCommand = new RelayCommand(EditAffix, CanEditAffix); _removeAffixCommand = new RelayCommand(RemoveAffix, CanRemoveAffix); }
public QuoteSystem(BulkObservableList <QuotationMark> allLevels) : this() { AllLevels = allLevels; }
public QuoteSystem() { AllLevels = new BulkObservableList <QuotationMark>(); }
public void MoveRange_OldIndexLessThanNewIndex_ItemsMoved() { var list = new BulkObservableList<string> {"a", "b", "c", "d", "e"}; list.MoveRange(0, 2, 3); Assert.That(list, Is.EqualTo(new[] {"c", "d", "e", "a", "b"})); }
public void MoveRange_OldIndexEqualToNewIndex_ItemsNotMoved() { var list = new BulkObservableList<string> {"a", "b", "c", "d", "e"}; list.MoveRange(1, 2, 1); Assert.That(list, Is.EqualTo(new[] {"a", "b", "c", "d", "e"})); }
public SoundCorrespondence(Segment segment1, Segment segment2) { _segment1 = segment1; _segment2 = segment2; _wordPairs = new BulkObservableList<WordPair>(); }
public SoundCorrespondence(Segment segment1, Segment segment2) { _segment1 = segment1; _segment2 = segment2; _wordPairs = new BulkObservableList <WordPair>(); }
public void MoveRange_InvalidOldIndex_Throws() { var list = new BulkObservableList<string> {"a", "b", "c", "d", "e"}; Assert.That(() => list.MoveRange(5, 2, 1), Throws.InstanceOf<ArgumentOutOfRangeException>()); }