Skip to the content

Hikidashi引き出し

Era dates (和暦) and kanji numerals both ways, the dictionary forms of a conjugated word, a reading shared out over its kanji, words pulled from pasted text, and how hard a sentence is to read.

Hikidashi (引き出し) is a drawer: each tool is pulled out when it is wanted. About the name

Contents

Reference · Pasted text

ExtractResulttype

The words found, then the kanji, each once, in the order they first appear; and what the paste held. What extractFromText gives.

Import it

import type { ExtractResult } from "@johnmorrisdotca/hikidashi/extract";

Also exported from: @johnmorrisdotca/hikidashi

Definition

type ExtractResult = {
    words: string[];
    kanji: string[];
    stats: {
        characters: number;
        truncated: boolean;
        kanji: number;
        words: number;
    };
};

Members

NameTypeDescription
wordsstring[]

Dictionary forms: 行きます is 行く.

kanjistring[]

Single kanji, whether or not they belong to a word.

stats{ characters: number; truncated: boolean; kanji: number; words: number; }

What the paste held, for the line that says what happened.

Examples

import { extractFromText, type ExtractResult } from "@johnmorrisdotca/hikidashi/extract";

const result: ExtractResult = extractFromText({ text: "先生と学校", known: new Map([["先生", []]]) });
console.log(result.words, result.kanji, result.stats);
[ '先生' ] [ '先', '生', '学', '校' ] { characters: 5, truncated: false, kanji: 4, words: 1 }

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hikidashi 1.1.0.