本文へ移動

Hikidashi引き出し

和暦と漢数字の相互変換、活用した語の辞書形、漢字への読みの割り当て、貼り付けた文からの単語の抽出、文の難しさ。日本語のテキストを扱う小さな道具を集めた引き出しです。

「引き出し」という名前は、道具が一つずつしまってあり、必要なときに取り出して使える、という意味です。 名前について(英語)

目次

リファレンス · 貼り付けた文

EXTRACT_LIMITS定数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

What a paste is held to: read to 20,000 characters and then cut, words of up to 8 characters, and at most 4,000 candidates asked of a dictionary.

インポート

import { EXTRACT_LIMITS } from "@johnmorrisdotca/hikidashi/extract";

ほかのエクスポート元: @johnmorrisdotca/hikidashi

定義

const EXTRACT_LIMITS: { readonly characters: 20000; readonly wordLength: 8; readonly candidates: 4000; } = {
    characters: 20000,
    wordLength: 8,
    candidates: 4000,
} as const

メンバー

名前型説明
characters20000

A chapter is about this long. Past it the paste is cut, and says so.

wordLength8

The longest run treated as one word.

candidates4000

How many distinct candidates a paste may ask the dictionary about.

例

import { EXTRACT_LIMITS, sanitizePastedText } from "@johnmorrisdotca/hikidashi/extract";

console.log(EXTRACT_LIMITS);
console.log(sanitizePastedText("あ".repeat(EXTRACT_LIMITS.characters + 5)).truncated);
{ characters: 20000, wordLength: 8, candidates: 4000 }
true

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/hikidashi 1.1.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。