示例#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
 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;
            }
        }