Exemplo n.º 1
0
        public WordPairViewModel(IProjectService projectService, IAnalysisService analysisService, WordPair wordPair, bool areVarietiesInOrder)
        {
            _projectService      = projectService;
            _analysisService     = analysisService;
            _wordPair            = wordPair;
            _areVarietiesInOrder = areVarietiesInOrder;
            _meaning             = new MeaningViewModel(_wordPair.Word1.Meaning);
            _variety1            = new VarietyViewModel(_wordPair.VarietyPair.Variety1);
            _variety2            = new VarietyViewModel(_wordPair.VarietyPair.Variety2);

            IWordAlignerResult results = _projectService.Project.WordAligners[ComponentIdentifiers.PrimaryWordAligner].Compute(_wordPair);

            _alignment  = results.GetAlignments().First();
            _prefixNode = new AlignedNodeViewModel(_alignment.Prefixes[0], _alignment.Prefixes[1]);
            var nodes = new List <AlignedNodeViewModel>();
            int i     = 0;

            for (int column = 0; column < _alignment.ColumnCount; column++)
            {
                string note = null;
                if (i < _wordPair.AlignmentNotes.Count)
                {
                    note = _wordPair.AlignmentNotes[i];
                }
                nodes.Add(new AlignedNodeViewModel(column, _alignment[0, column], _alignment[1, column], note));
                i++;
            }
            _suffixNode = new AlignedNodeViewModel(_alignment.Suffixes[0], _alignment.Suffixes[1]);

            _alignedNodes = new ReadOnlyCollection <AlignedNodeViewModel>(nodes);

            _showInMultipleWordAlignmentCommand = new RelayCommand(ShowInMultipleWordAlignment);
            _pinUnpinCommand = new RelayCommand(PinUnpin);
        }
Exemplo n.º 2
0
        public WordPairViewModel(IWordAligner aligner, WordPair wordPair, bool areVarietiesInOrder)
        {
            _wordPair = wordPair;
            _areVarietiesInOrder = areVarietiesInOrder;
            _meaning = new MeaningViewModel(_wordPair.Word1.Meaning);
            _variety1 = new VarietyViewModel(_wordPair.VarietyPair.Variety1);
            _variety2 = new VarietyViewModel(_wordPair.VarietyPair.Variety2);

            IWordAlignerResult results = aligner.Compute(_wordPair);
            _alignment = results.GetAlignments().First();
            _prefixNode = new AlignedNodeViewModel(_alignment.Prefixes[0], _alignment.Prefixes[1]);
            var nodes = new List<AlignedNodeViewModel>();
            int i = 0;
            for (int column = 0; column < _alignment.ColumnCount; column++)
            {
                string note = null;
                if (i < _wordPair.AlignmentNotes.Count)
                    note = _wordPair.AlignmentNotes[i];
                nodes.Add(new AlignedNodeViewModel(column, _alignment[0, column], _alignment[1, column], note));
                i++;
            }
            _suffixNode = new AlignedNodeViewModel(_alignment.Suffixes[0], _alignment.Suffixes[1]);

            _alignedNodes = new ReadOnlyCollection<AlignedNodeViewModel>(nodes);

            _showInMultipleWordAlignmentCommand = new RelayCommand(ShowInMultipleWordAlignment);
        }
Exemplo n.º 3
0
        public WordPairViewModel(IWordAligner aligner, WordPair wordPair, bool areVarietiesInOrder)
        {
            _wordPair            = wordPair;
            _areVarietiesInOrder = areVarietiesInOrder;
            _meaning             = new MeaningViewModel(_wordPair.Word1.Meaning);
            _variety1            = new VarietyViewModel(_wordPair.VarietyPair.Variety1);
            _variety2            = new VarietyViewModel(_wordPair.VarietyPair.Variety2);

            IWordAlignerResult results = aligner.Compute(_wordPair);

            _alignment  = results.GetAlignments().First();
            _prefixNode = new AlignedNodeViewModel(_alignment.Prefixes[0], _alignment.Prefixes[1]);
            var nodes = new List <AlignedNodeViewModel>();
            int i     = 0;

            for (int column = 0; column < _alignment.ColumnCount; column++)
            {
                string note = null;
                if (i < _wordPair.AlignmentNotes.Count)
                {
                    note = _wordPair.AlignmentNotes[i];
                }
                nodes.Add(new AlignedNodeViewModel(column, _alignment[0, column], _alignment[1, column], note));
                i++;
            }
            _suffixNode = new AlignedNodeViewModel(_alignment.Suffixes[0], _alignment.Suffixes[1]);

            _alignedNodes = new ReadOnlyCollection <AlignedNodeViewModel>(nodes);
        }