Class SegmentElement
Base abstract class representing a segment element. A Segment consists of a sequence of segment elements.
Inherited Members
Namespace: SdlSdl.LanguagePlatformCore
Assembly: Sdl.LanguagePlatform.Core.dll
Syntax
[DataContract]
[KnownType(typeof(Tag))]
[KnownType(typeof(Text))]
[KnownType(typeof(Token))]
public abstract class SegmentElement
Constructors
SegmentElement()
Declaration
protected SegmentElement()
Methods
AcceptSegmentElementVisitor(ISegmentElementVisitor)
Visitor pattern implementation. Derived classes should call back on the appropriate method on the visitor.
Declaration
public abstract void AcceptSegmentElementVisitor(ISegmentElementVisitor visitor)
Parameters
Type | Name | Description |
---|---|---|
ISegmentElementVisitor | visitor | The visitor instance (must not be |
Duplicate()
Creates a new instance that is a deep copy of this instance.
Declaration
public abstract SegmentElement Duplicate()
Returns
Type | Description |
---|---|
SegmentElement | A new instance that is a deep copy of this instance. |
GetSimilarity(SegmentElement)
Declaration
public SegmentElement.Similarity GetSimilarity(SegmentElement other)
Parameters
Type | Name | Description |
---|---|---|
SegmentElement | other |
Returns
Type | Description |
---|---|
SegmentElementSimilarity |
GetSimilarity(SegmentElement, bool)
Declaration
public SegmentElement.Similarity GetSimilarity(SegmentElement other, bool allowCompatibility)
Parameters
Type | Name | Description |
---|---|---|
SegmentElement | other | |
bool | allowCompatibility |
Returns
Type | Description |
---|---|
SegmentElementSimilarity |
GetSimilarityAsync(SegmentElement)
Computes the degree of similarity to another instance.
Declaration
public Task<SegmentElement.Similarity> GetSimilarityAsync(SegmentElement other)
Parameters
Type | Name | Description |
---|---|---|
SegmentElement | other | The other instance. |
Returns
Type | Description |
---|---|
TaskSegmentElementSimilarity | A value indicating the degree of similarity to the provided segment element. |
GetSimilarityAsync(SegmentElement, bool)
Computes the degree of similarity to another instance, with the option of more flexible type compatibility (e.g. treat 'cm' and 'ft' as same type, because both measure length)
Declaration
public Task<SegmentElement.Similarity> GetSimilarityAsync(SegmentElement other, bool allowCompatibility)
Parameters
Type | Name | Description |
---|---|---|
SegmentElement | other | The other instance. |
bool | allowCompatibility | If True, more flexible type compatibility will be used if available for the comparison |
Returns
Type | Description |
---|---|
TaskSegmentElementSimilarity |
GetWeakHashCode()
Returns a hash code which does not depend on tag anchors in the segment. This can be used for translation tracking in bilingual scenarios.
Declaration
public abstract int GetWeakHashCode()
Returns
Type | Description |
---|---|
int | A hash code which is independent of tag anchors. |