ONE - On-device Neural Engine
Loading...
Searching...
No Matches
ggma_tokenize.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
21#ifndef __GGMA_GGMA_TOKENIZE_H__
22#define __GGMA_GGMA_TOKENIZE_H__
23
24#include "ggma_types.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
37
51GGMA_STATUS ggma_create_tokenizer(ggma_tokenizer **tokenizer, const char *tokenizer_path);
52
60
79GGMA_STATUS ggma_tokenize(const ggma_tokenizer *tokenizer, const char *text, size_t text_len,
80 int32_t *tokens, size_t n_tokens_max, size_t *n_tokens);
81
97GGMA_STATUS ggma_detokenize(const ggma_tokenizer *tokenizer, const int32_t *tokens, size_t n_tokens,
98 char *text, size_t text_len);
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif // __GGMA_GGMA_TOKENIZE_H__
struct ggma_tokenizer ggma_tokenizer
Opaque handle to a GGMA tokenizer.
GGMA_STATUS ggma_create_tokenizer(ggma_tokenizer **tokenizer, const char *tokenizer_path)
Creates a GGMA tokenizer from a specified tokenizer path.
GGMA_STATUS ggma_free_tokenizer(ggma_tokenizer *tokenizer)
Frees all resources associated with a GGMA tokenizer.
GGMA_STATUS ggma_detokenize(const ggma_tokenizer *tokenizer, const int32_t *tokens, size_t n_tokens, char *text, size_t text_len)
Detokenizes a sequence of token IDs back into a text string.
GGMA_STATUS ggma_tokenize(const ggma_tokenizer *tokenizer, const char *text, size_t text_len, int32_t *tokens, size_t n_tokens_max, size_t *n_tokens)
Tokenizes an input text string into a sequence of token IDs.
This file defines the core types and status codes for GGMA API.
GGMA_STATUS
Enumeration of status codes returned by GGMA API functions.
Definition ggma_types.h:35