Class Token
Represents a generic, abstract token, which is a sequence of characters in the input. A
token is identified using a tokenizer, which breaks up the sequence of characters in the
input into a sequence of tokens. That token sequence is non-overlapping, but not necessarily
contiguous.
Namespace: SdlSdl.LanguagePlatformCoreTokenization
Assembly: Sdl.LanguagePlatform.Core.dll
[DataContract]
[KnownType(typeof(DateTimeToken))]
[KnownType(typeof(NumberToken))]
[KnownType(typeof(MeasureToken))]
[KnownType(typeof(SimpleToken))]
[KnownType(typeof(GenericPlaceableToken))]
[KnownType(typeof(TagToken))]
public abstract class Token : SegmentElement
Constructors
Initializes a new instance with default values.
Declaration
Initializes a new instance with the values from another instance, creating a deep copy.
Declaration
public Token(Token other)
Parameters
Type |
Name |
Description |
Token |
other |
The instance to copy
|
Initializes a new instance with the specified token text.
Declaration
public Token(string text)
Parameters
Type |
Name |
Description |
string |
text |
The token text
|
Properties
Declaration
public CultureCode Culture { get; set; }
Property Value
Gets a boolean value indicating whether this token represents a placeable.
Always returns false
for this class. Derived
classes should override appropriately.
Declaration
public virtual bool IsPlaceable { get; }
Property Value
true iff the token is a general punctuation, an opening punctuation, or a closing punctuation
Declaration
public bool IsPunctuation { get; }
Property Value
Gets a boolean value indicating whether this token can be substituted (e.g. auto-localized) across segments.
All substitutables are placeables, but not all placeables can be substituted (e.g. acronyms).
Declaration
public virtual bool IsSubstitutable { get; }
Property Value
Gets a value which indicates whether this token is a whitespace token or not.
Declaration
public bool IsWhitespace { get; }
Property Value
true iff the token is a word, an abbreviation, or an acronym
Declaration
public bool IsWord { get; }
Property Value
Gets or sets the span covered by this token in the original segment.
Declaration
[DataMember]
public SegmentRange Span { get; set; }
Property Value
Text
Gets or sets the token's text.
Declaration
[DataMember]
public virtual string Text { get; set; }
Property Value
TokenizationContext
Declaration
public TokenizationContext TokenizationContext { get; set; }
Property Value
Declaration
[DataMember]
public TokenType Type { get; set; }
Property Value
Methods
System.Object.Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
object |
obj |
The object to compare with the current object.
|
Returns
Type |
Description |
bool |
true if the specified object is equal to the current object;
otherwise, false.
|
Overrides
Declaration
protected SegmentElement.Similarity GetBundleSimilarity(SegmentElement other)
Parameters
Returns
System.Object.GetHashCode(object)
Declaration
public override int GetHashCode()
Returns
Overrides
Declaration
public Task<string> GetIdentityStringAsync()
Returns
Declaration
protected abstract TokenType GetTokenType()
Returns
Declaration
public override int GetWeakHashCode()
Returns
Type |
Description |
int |
A hash code
|
Overrides
Declaration
protected virtual void SetTokenType(TokenType tokenType)
Parameters