npm.io
2.1.0 • Published 7 months ago

lindera-wasm-cc-cedict

Licence
MIT
Version
2.1.0
Deps
0
Size
12.1 MB
Vulns
0
Weekly
0
Stars
642
DeprecatedThis package is deprecated

lindera-wasm

WebAssembly of Lindera

Screenshot from 2025-09-13 23-05-49

Demo Application

npm

Web
Node.js

Usage

init the wasm module before construct TokenizerBuilder:

import __wbg_init, { TokenizerBuilder } from 'lindera-wasm'

__wbg_init.then(() => {
    const builder = new TokenizerBuilder()
    //...
})
for Vite base project

You should exclude this package in the optimizeDeps:

// vite.config.js
import { defineConfig } from 'vite'

export default defineConfig({
  optimizeDeps: {
    exclude: [
      "lindera-wasm"
    ]
  },
})
for Browser extension development

Set the cors config in vite.config.js

// vite.config.js
import { defineConfig } from 'vite'

export default defineConfig({
  server: {
    cors: {
      origin: [
        /chrome-extension:\/\//,
      ],
    },
  },
})

and set the content_security_policy to contains wasm-unsafe-eval in manifest.json:

"content_security_policy": {
  "extension_pages": "script-src 'self' 'wasm-unsafe-eval';"
}

Development

Install project dependencies
Setup repository
# Clone the Lindera project repository
% git clone git@github.com:lindera/lindera.git
% cd lindera
Build project
% make wasm-build
Run tests
% make wasm-test
Build example web application
% cd example && npm install && npm run build && cp index.html dist/index.html
Run example web application
% cd example && npm run start

Keywords