/* auto-generated by NAPI-RS */
/* eslint-disable */
/**
 * Pre-parsed shared dictionary that can be reused across multiple tokenizers.
 * The ~150 MB DoubleArrayTrie is shared via Arc, so creating additional
 * tokenizers from this handle is nearly free.
 */
export declare class NativeSharedDictionary {
  /** Load a dictionary from disk and pre-parse the trie for sharing. */
  constructor(dictPath: string, inhibitedConnections?: Array<Array<number>> | undefined | null)
}

export declare class NativeTokenizer {
  /** Load a system dictionary and create the native tokenizer. */
  constructor(dictPath: string, options?: NativeTokenizerOptions | undefined | null)
  /**
   * Create a tokenizer from a shared dictionary handle.
   * The ~150 MB trie is shared via Arc (16-byte refcount bump, not a copy).
   */
  static fromShared(shared: NativeSharedDictionary, options?: NativeTokenizerOptions | undefined | null): NativeTokenizer
  /** Add a user dictionary. */
  addUserDictionary(dictPath: string): void
  /** The hot path — builds lattice and returns best path nodes. */
  tokenize(bytes: Uint8Array, canBow: Uint8Array, charCategories: Uint32Array, wordCandidateLengths: Uint32Array, continuousLengths: Uint32Array, codePointByteLengthsFlat: Uint8Array, codePointOffsets: Uint32Array): Array<NativePathNode>
  /** Get word info by packed word ID. Called during TS post-processing. */
  getWordInfo(wordId: number): NativeWordInfo
  /** Get POS tags by ID. */
  getPos(posId: number): Array<string>
  /** Total number of POS entries. */
  get posCount(): number
}

/** MeCab OOV options passed from JS. */
export interface NativeMecabCategory {
  categoryType: number
  isInvoke: boolean
  isGroup: boolean
  length: number
}

export interface NativeMecabOov {
  categoryType: number
  leftId: number
  rightId: number
  cost: number
  posId: number
}

/** PathNode returned to JS. */
export interface NativePathNode {
  begin: number
  end: number
  wordId: number
  leftId: number
  rightId: number
  cost: number
  totalCost: number
  isOov: boolean
  oovPosId?: number
}

export interface NativeTokenizerOptions {
  oovLeftId?: number
  oovRightId?: number
  oovCost?: number
  oovPosId?: number
  mecabCategories?: Array<NativeMecabCategory>
  mecabOovs?: Array<NativeMecabOov>
  inhibitedConnections?: Array<Array<number>>
}

/** WordInfo returned to JS. */
export interface NativeWordInfo {
  surface: string
  headwordLength: number
  posId: number
  normalizedForm: string
  dictionaryFormWordId: number
  dictionaryForm: string
  readingForm: string
  aUnitSplit: Array<number>
  bUnitSplit: Array<number>
  wordStructure: Array<number>
  synonymGids: Array<number>
}
