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.
Inheritance
System.Object
Token
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Sdl.LanguagePlatform.Core.dll
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 |
System.String |
text |
The token text
|
Properties
Declaration
public CultureCode Culture { get; set; }
Property Value
Type |
Description |
Sdl.Core.Globalization.CultureCode |
|
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
Type |
Description |
System.Boolean |
|
true iff the token is a general punctuation, an opening punctuation, or a closing punctuation
Declaration
public bool IsPunctuation { get; }
Property Value
Type |
Description |
System.Boolean |
|
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
Type |
Description |
System.Boolean |
|
Gets a value which indicates whether this token is a whitespace token or not.
Declaration
public bool IsWhitespace { get; }
Property Value
Type |
Description |
System.Boolean |
|
true iff the token is a word, an abbreviation, or an acronym
Declaration
public bool IsWord { get; }
Property Value
Type |
Description |
System.Boolean |
|
Gets or sets the span covered by this token in the original segment.
Declaration
public SegmentRange Span { get; set; }
Property Value
Text
Gets or sets the token's text.
Declaration
public virtual string Text { get; set; }
Property Value
Type |
Description |
System.String |
|
TokenizationContext
Declaration
public TokenizationContext TokenizationContext { get; set; }
Property Value
Declaration
public TokenType Type { get; set; }
Property Value
Methods
System.Object.Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
The object to compare with the current object.
|
Returns
Type |
Description |
System.Boolean |
true if the specified object is equal to the current object;
otherwise, false.
|
Overrides
System.Object.Equals(System.Object)
Declaration
protected SegmentElement.Similarity GetBundleSimilarity(SegmentElement other)
Parameters
Returns
System.Object.GetHashCode(object)
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.Object.GetHashCode()
See Sdl.LanguagePlatform.Core.Tokenization.IToken.GetIdentityStringAsync
Declaration
public Task<string> GetIdentityStringAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task<System.String> |
|
Declaration
protected abstract TokenType GetTokenType()
Returns
Declaration
public override int GetWeakHashCode()
Returns
Type |
Description |
System.Int32 |
A hash code
|
Overrides
Declaration
protected virtual void SetTokenType(TokenType tokenType)
Parameters