Registry / data / lindera-wasm-ko-dic-bundler

lindera-wasm-ko-dic-bundler

JSON →
library2.3.4jsnpmunverified

The `lindera-wasm-ko-dic-bundler` package provides the Lindera morphological analysis library compiled to WebAssembly, specifically bundled with the Korean dictionary (ko-dic) and optimized for use within modern JavaScript bundler environments (e.g., webpack, Rollup, Vite). Lindera is a high-performance, multi-dictionary capable morphological analyzer originally written in Rust. The current stable version for the v3 series is `3.0.5` across the Lindera WASM ecosystem, with `2.3.4` being the last significant release in the v2 series for this specific bundler package. The project exhibits an active release cadence, frequently publishing patch and minor updates. Its primary differentiators include its WebAssembly compilation for efficient client-side or server-side (via bundler) execution, the convenience of pre-packaged dictionaries for various languages like Korean, and the inherent performance advantages offered by a Rust-native implementation. It maintains a well-structured package ecosystem with distinct targets for web browsers, Node.js, and bundlers, each offering different pre-loaded dictionary configurations.

npm install lindera-wasm-ko-dic-bundler
INSTALL
IMPORT
SIG · LINDERA-WASM-KO-DI
L
lindera-wasm-ko-dic-bundler
datajavascriptv2.3.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

__wbg_init
import __wbg_init from 'lindera-wasm-ko-dic-bundler';
import { __wbg_init } from 'lindera-wasm-ko-dic-bundler';
This is typically a default export function required to initialize the WebAssembly module before any other module exports can be used.
TokenizerBuilder
import { TokenizerBuilder } from 'lindera-wasm-ko-dic-bundler';
const { TokenizerBuilder } = require('lindera-wasm-ko-dic-bundler');
Since v3, Lindera WASM packages are primarily ESM-first. CommonJS `require` should be avoided in modern bundler setups.
Token
import type { Token } from 'lindera-wasm-ko-dic-bundler';
Import the `Token` type for TypeScript applications to correctly type the tokenizer's output, which is an array of `Token` objects.

Initializes the WebAssembly module and demonstrates basic Korean morphological analysis using the embedded `ko-dic` dictionary with a bundler-compatible import.

import __wbg_init, { TokenizerBuilder } from 'lindera-wasm-ko-dic-bundler'; async function main() { // Initialize the WebAssembly module await __wbg_init(); // Create a new tokenizer builder const builder = new TokenizerBuilder(); // Set the dictionary to the embedded Korean dictionary builder.setDictionary("embedded://ko-dic"); // Set the tokenization mode (e.g., "normal", "decompose", "concatenate") builder.setMode("normal"); // Build the tokenizer const tokenizer = builder.build(); // Text to tokenize const text = "안녕하세요 한국어 형태소 분석입니다. Lindera는 빠르고 정확합니다."; // Tokenize the text const tokens = tokenizer.tokenize(text); console.log(`Original text: "${text}"`); console.log("\nTokenized results:"); tokens.forEach(token => { console.log(`- Surface: '${token.surface}', Details: [${token.details.join(", ")}]`); }); } main();
Debug
Known issues
breakingVersion 3.0.0 introduced significant breaking changes across the Lindera WASM ecosystem, including renaming npm packages (e.g., `-web` for browser, `-nodejs` for Node.js, `-bundler` for bundlers) and restructuring target environments. This package (`lindera-wasm-ko-dic-bundler`) is part of the new naming convention.
fix
Review the new package names and target environments (e.g., `lindera-wasm-ko-dic-web` for browsers, `lindera-wasm-ko-dic-nodejs` for Node.js, `lindera-wasm-ko-dic-bundler` for bundlers) and update your `package.json` and import paths accordingly. For Node.js-only applications not requiring bundling, consider the `lindera-nodejs` crate for potentially better performance via NAPI-RS bindings.
affects: >=3.0.0
breakingThe `lindera-wasm` ecosystem generally moved towards ESM-first imports since v3, especially for bundler and web targets. Direct CommonJS `require()` might not work or could lead to compatibility issues in certain bundler configurations without proper transpilation.
fix
Ensure your project uses `import` statements for `lindera-wasm-ko-dic-bundler`. If you are in a CommonJS environment that needs to consume ESM, you might need dynamic `import()` or specific bundler configurations (e.g., setting `"type": "module"` in your `package.json`).
affects: >=3.0.0
gotchaThe `__wbg_init()` function must be called and awaited exactly once before any other functions (like `TokenizerBuilder`) from the WASM module can be used. Failing to do so will result in runtime errors as the WASM module will not be properly loaded and instantiated.
fix
Always `await __wbg_init();` at the very start of your application or before the first usage of `TokenizerBuilder` or other Lindera WASM module exports. Wrap your initialization and usage logic in an `async` function.
affects: >=2.0.0
gotchaEach `lindera-wasm-*` package comes with a specific pre-embedded dictionary. Using the wrong package for your target language (e.g., using `lindera-wasm-ipadic-bundler` for Korean text) will result in incorrect or suboptimal morphological analysis due to a mismatch between the dictionary and the input language.
fix
Select the appropriate `lindera-wasm-*` package that specifically bundles the dictionary for the language you intend to analyze. For Korean text analysis, ensure you are using a package like `lindera-wasm-ko-dic-bundler` and call `builder.setDictionary("embedded://ko-dic");`.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'TokenizerBuilder')
This error typically occurs because the WebAssembly module has not been initialized by calling `__wbg_init()`, or the import path for the module is incorrect.
fix
Ensure you `await __wbg_init();` once at the beginning of your application before attempting to use any other exports like `TokenizerBuilder`. Verify the import path `lindera-wasm-ko-dic-bundler` is correctly specified.
Error: dictionary loading error: Dictionary file not found.
The `setDictionary()` method was called with an incorrect dictionary identifier string, or a dictionary that is not actually embedded within the specific `lindera-wasm-*` package you are using.
fix
For the `lindera-wasm-ko-dic-bundler` package, the correct identifier is `"embedded://ko-dic"`. Double-check the README or package documentation for the exact dictionary string if using a different Lindera WASM package.
SyntaxError: Named export 'TokenizerBuilder' not found. The requested module 'lindera-wasm-ko-dic-bundler' does not provide an export named 'TokenizerBuilder'
You are attempting to use CommonJS `require()` syntax or your bundler is configured to treat the `lindera-wasm-ko-dic-bundler` package as CommonJS, but it is an ESM-first module.
fix
Ensure you are using `import { TokenizerBuilder } from 'lindera-wasm-ko-dic-bundler';` syntax. If in a Node.js project, ensure your `package.json` includes `"type": "module"` for ESM compatibility, or use dynamic `import()` for CJS environments.
Upgrade
Version history
2.3.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
Amazon
1
OpenAI (training)
1
Resources