本文整理汇总了C#中Shape.Freeze方法的典型用法代码示例。如果您正苦于以下问题:C# Shape.Freeze方法的具体用法?C# Shape.Freeze怎么用?C# Shape.Freeze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shape
的用法示例。
在下文中一共展示了Shape.Freeze方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Segments
public Segments(CharacterDefinitionTable table, string representation, Shape shape)
{
_representation = representation;
_table = table;
_shape = shape;
_shape.Freeze();
}
示例2: Segmenter
public Segmenter(SpanFactory<ShapeNode> spanFactory)
{
_spanFactory = spanFactory;
_vowels = new SymbolCollection();
_vowels.CollectionChanged += SymbolCollectionChanged;
_consonants = new SymbolCollection();
_consonants.CollectionChanged += SymbolCollectionChanged;
_modifiers = new SymbolCollection();
_modifiers.CollectionChanged += SymbolCollectionChanged;
_joiners = new SymbolCollection();
_joiners.CollectionChanged += SymbolCollectionChanged;
_toneLetters = new SymbolCollection();
_toneLetters.CollectionChanged += SymbolCollectionChanged;
_boundaries = new SymbolCollection();
_boundaries.CollectionChanged += SymbolCollectionChanged;
_emptyShape = new Shape(_spanFactory, begin => new ShapeNode(_spanFactory, FeatureStruct.New().Symbol(CogFeatureSystem.AnchorType).Feature(CogFeatureSystem.StrRep).EqualTo("#").Value));
_emptyShape.Freeze();
}
示例3: TrySegment
public bool TrySegment(string str, out Shape shape)
{
if (string.IsNullOrEmpty(str))
{
shape = _emptyShape;
return true;
}
shape = new Shape(_spanFactory, begin => new ShapeNode(_spanFactory, FeatureStruct.New().Symbol(CogFeatureSystem.AnchorType).Feature(CogFeatureSystem.StrRep).EqualTo("#").Value));
if (SegmentString(shape, str))
{
shape.Freeze();
return true;
}
shape = null;
return false;
}
示例4: Segment
public void Segment(Word word)
{
if (string.IsNullOrEmpty(word.StrRep))
{
word.Shape = _emptyShape;
return;
}
var shape = new Shape(_spanFactory, begin => new ShapeNode(_spanFactory, FeatureStruct.New().Symbol(CogFeatureSystem.AnchorType).Feature(CogFeatureSystem.StrRep).EqualTo("#").Value));
string prefix = word.StrRep.Substring(0, word.StemIndex);
ShapeNode start = shape.Begin;
if (!string.IsNullOrEmpty(prefix))
{
if (SegmentString(shape, prefix))
{
shape.Annotations.Add(start.Next, shape.Last, FeatureStruct.New().Symbol(CogFeatureSystem.PrefixType).Value);
start = shape.Last;
}
else
{
word.Shape = _emptyShape;
return;
}
}
string stem = word.StrRep.Substring(word.StemIndex, word.StemLength);
if (SegmentString(shape, stem))
{
shape.Annotations.Add(start.Next, shape.Last, FeatureStruct.New().Symbol(CogFeatureSystem.StemType).Value);
start = shape.Last;
}
else
{
word.Shape = _emptyShape;
return;
}
string suffix = word.StrRep.Substring(word.StemIndex + word.StemLength);
if (!string.IsNullOrEmpty(suffix))
{
if (SegmentString(shape, suffix))
{
shape.Annotations.Add(start.Next, shape.Last, FeatureStruct.New().Symbol(CogFeatureSystem.SuffixType).Value);
}
else
{
word.Shape = _emptyShape;
return;
}
}
shape.Freeze();
word.Shape = shape;
}