예제 #1
0
 public EditAffixViewModel(Segmenter segmenter, Affix affix)
 {
     _title = "Edit Affix";
     _segmenter = segmenter;
     _strRep = affix.StrRep;
     switch (affix.Type)
     {
         case AffixType.Prefix:
             _type = AffixViewModelType.Prefix;
             break;
         case AffixType.Suffix:
             _type = AffixViewModelType.Suffix;
             break;
     }
     _category = affix.Category;
 }
예제 #2
0
파일: Segmenter.cs 프로젝트: JRetza/cog
        public void Segment(Affix affix)
        {
            if (string.IsNullOrEmpty(affix.StrRep))
            {
                affix.Shape = _emptyShape;
                return;
            }

            var shape = new Shape(begin => new ShapeNode(FeatureStruct.New().Symbol(CogFeatureSystem.AnchorType).Feature(CogFeatureSystem.StrRep).EqualTo("#").Value));

            if (SegmentString(shape, affix.StrRep))
            {
                shape.Freeze();
                affix.Shape = shape;
            }
            else
            {
                affix.Shape = _emptyShape;
            }
        }
예제 #3
0
파일: AffixViewModel.cs 프로젝트: rmunn/cog
 public AffixViewModel(Affix affix)
 {
     _affix = affix;
     _isValid = _affix.Shape.Count > 0;
     _affix.PropertyChanged += AffixPropertyChanged;
 }
예제 #4
0
 private void NewAffix()
 {
     var vm = new EditAffixViewModel(_projectService.Project.Segmenter);
     if (_dialogService.ShowModalDialog(this, vm) == true)
     {
         var affix = new Affix(vm.StrRep, vm.Type == AffixViewModelType.Prefix ? AffixType.Prefix : AffixType.Suffix, vm.Category);
         _projectService.Project.Segmenter.Segment(affix);
         DomainVariety.Affixes.Add(affix);
         Messenger.Default.Send(new DomainModelChangedMessage(false));
         SelectedAffix = _affixes.Single(a => a.DomainAffix == affix);
     }
 }
예제 #5
0
파일: Segmenter.cs 프로젝트: rmunn/cog
        public void Segment(Affix affix)
        {
            if (string.IsNullOrEmpty(affix.StrRep))
            {
                affix.Shape = _emptyShape;
                return;
            }

            var shape = new Shape(_spanFactory, begin => new ShapeNode(_spanFactory, FeatureStruct.New().Symbol(CogFeatureSystem.AnchorType).Feature(CogFeatureSystem.StrRep).EqualTo("#").Value));
            if (SegmentString(shape, affix.StrRep))
            {
                shape.Freeze();
                affix.Shape = shape;
            }
            else
            {
                affix.Shape = _emptyShape;
            }
        }