EnglishTextTokenizer

internal class EnglishTextTokenizer(val ortEnvironmentProvider: OrtEnvironmentProvider, val fileProviderDescriptor: FileProviderDescriptor, val localModelIdProvider: LocalModelIdProvider, val preferenceManager: PreferenceManager) : LocalDiffusionTextTokenizer(source)

Coordinates EnglishTextTokenizer behavior in the SDAI ONNX local diffusion feature layer.

Author

Dmitriy Moroz

Constructors

Link copied to clipboard
constructor(ortEnvironmentProvider: OrtEnvironmentProvider, fileProviderDescriptor: FileProviderDescriptor, localModelIdProvider: LocalModelIdProvider, preferenceManager: PreferenceManager)

Types

Link copied to clipboard
object Companion

Provides the companion object singleton used by the SDAI ONNX local diffusion feature layer.

Properties

Link copied to clipboard

Exposes the bpeRanks value used by the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
private val decoder: MutableMap<Int, String>

Exposes the decoder value used by the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
private val encoder: MutableMap<String, Int>

Exposes the encoder value used by the SDAI ONNX local diffusion feature layer.

Link copied to clipboard

Exposes the fileProviderDescriptor value used by the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
private var isInitMap: Boolean

Exposes the isInitMap value used by the SDAI ONNX local diffusion feature layer.

Link copied to clipboard

Exposes the localModelIdProvider value used by the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
open override val maxLength: Int = 77

Exposes the maxLength value used by the SDAI ONNX local diffusion feature layer.

Link copied to clipboard

Exposes the ortEnvironmentProvider value used by the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
private val pattern: Pattern?

Exposes the pattern value used by the SDAI ONNX local diffusion feature layer.

Link copied to clipboard

Exposes the preferenceManager value used by the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
private var session: OrtSession?

Exposes the session value used by the SDAI ONNX local diffusion feature layer.

Functions

Link copied to clipboard
private fun bpe(token: String): List<String>

Executes the bpe step in the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
open override fun close()

Executes the close step in the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
open override fun createUnconditionalInput(text: String?): IntArray

Creates the SDAI value produced by createUnconditionalInput.

Link copied to clipboard
open override fun decode(ids: IntArray?): String

Executes the decode step in the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
open override fun encode(text: String?): IntArray

Executes the encode step in the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
private fun getPairs(word: List<String?>): Set<Pair<String, String>>

Loads SDAI data through getPairs.

Link copied to clipboard
open override fun initialize()

Executes the initialize step in the SDAI ONNX local diffusion feature layer.

Link copied to clipboard
private fun loadBpeRanks(): Map<Pair<String, String>, Int?>

Loads SDAI data through loadBpeRanks.

Link copied to clipboard
private fun loadDecoder(encoder: Map<String, Int>): Map<Int, String>

Loads SDAI data through loadDecoder.

Link copied to clipboard
private fun loadEncoder(): Map<String, Int>

Loads SDAI data through loadEncoder.

Link copied to clipboard
open override fun tensor(ids: IntArray?): OnnxTensor?

Executes the tensor step in the SDAI ONNX local diffusion feature layer.