feat: initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
namespace MaigoLabs.NeedLe.Common.Types;
|
||||
|
||||
#pragma warning disable IDE1006 // Naming rule violation
|
||||
|
||||
// For compatibility with TypeScript, we use camelCase property names here.
|
||||
|
||||
public class CompressedInvertedIndex
|
||||
{
|
||||
public required string[] documents { get; set; }
|
||||
public required int[] tokenTypes { get; set; } // Use int values here instead of TokenType enum to avoid JSON serialization issues.
|
||||
public required List<int[]>[] tokenReferences { get; set; } // tokenId -> [documentId, start1, end1, start2, end2, ...]
|
||||
public required CompressedInvertedIndexTries tries { get; set; }
|
||||
}
|
||||
|
||||
public class CompressedInvertedIndexTries
|
||||
{
|
||||
public required int[] romaji { get; set; }
|
||||
public required int[] kana { get; set; }
|
||||
public required int[] other { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace MaigoLabs.NeedLe.Common.Types;
|
||||
|
||||
public class OffsetSpan
|
||||
{
|
||||
public required int Start { get; init; }
|
||||
public required int End { get; init; }
|
||||
|
||||
public int Length => End - Start;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace MaigoLabs.NeedLe.Common.Types;
|
||||
|
||||
public class TokenDefinition
|
||||
{
|
||||
public required int Id { get; set; }
|
||||
public required TokenType Type { get; set; }
|
||||
public required string Text { get; set; }
|
||||
public required int CodePointLength { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace MaigoLabs.NeedLe.Common.Types;
|
||||
|
||||
public enum TokenType
|
||||
{
|
||||
Raw,
|
||||
Kana,
|
||||
Romaji,
|
||||
Han,
|
||||
Pinyin,
|
||||
}
|
||||
Reference in New Issue
Block a user