跳到主要内容

chai

Classes

Interfaces

Type Aliases

Algebra

Ƭ Algebra: Record<string, Rule[]>

Defined in

hanzi-chai/src/lib/config.ts:203


AssemblyResult

Ƭ AssemblyResult: Map<string, IndexedElement[][]>

Defined in

hanzi-chai/src/lib/assembly.ts:89


BinaryOp

Ƭ BinaryOp: typeof binaryOps[number]

Defined in

hanzi-chai/src/lib/config.ts:76


CharacterResult

Ƭ CharacterResult: ComponentAnalysis | CompoundAnalysis & { char: string ; pinyin: string }

代表了一个有字音、有字形的汉字的中间结果 由拆分结果 ComponentResultCompoundResult 与字音组成

Defined in

hanzi-chai/src/lib/assembly.ts:40


Classifier

Ƭ Classifier: typeof classifier

Defined in

hanzi-chai/src/lib/classifier.ts:58


ClassifierType

Ƭ ClassifierType: typeof classifierTypes[number]

Defined in

hanzi-chai/src/lib/templates.ts:25


CodableObject

Ƭ CodableObject: This | Constant | Structure | Pronunciation | Root | Stroke | StrokePair

Defined in

hanzi-chai/src/lib/element.ts:107


Component

Ƭ Component: BasicComponent | DerivedComponent

部件,包括基本部件和派生部件

Defined in

hanzi-chai/src/lib/data.ts:85


ComponentAnalysis

Ƭ ComponentAnalysis: ComponentBasicAnalysis | ComponentGenuineAnalysis

部件的拆分结果

Defined in

hanzi-chai/src/lib/component.ts:130


ComponentResults

Ƭ ComponentResults: Map<string, ComponentAnalysis>

Defined in

hanzi-chai/src/lib/component.ts:158


CompoundAnalysis

Ƭ CompoundAnalysis: CompoundBasicAnalysis | CompoundGenuineAnalysis

Defined in

hanzi-chai/src/lib/compound.ts:22


CompoundResults

Ƭ CompoundResults: Map<string, CompoundAnalysis>

Defined in

hanzi-chai/src/lib/compound.ts:18


Condition

Ƭ Condition: UnaryCondition | BinaryCondition

Defined in

hanzi-chai/src/lib/config.ts:94


Curve

Ƭ Curve: LinearCurve | CubicCurve

Bezier 曲线,可能为一次或者三次

Defined in

hanzi-chai/src/lib/bezier.ts:42


CurveRelation

Ƭ CurveRelation: CrossRelation | AttachRelation | DisjointRelation

Defined in

hanzi-chai/src/lib/topology.ts:52


CustomGlyph

Ƭ CustomGlyph: Record<string, Component | Compound>

Defined in

hanzi-chai/src/lib/config.ts:216


CustomReadings

Ƭ CustomReadings: Record<string, string[]>

Defined in

hanzi-chai/src/lib/config.ts:217


Draw

Ƭ Draw: { command: "h" | "v" ; parameterList: N1 } | { command: "c" | "z" ; parameterList: N6 }

一条 SVG 路径命令 h, v, c 的含义参见 SVG 规范 z 和 c 的含义相同,但是只用于表示平撇、平点、平捺,这是为了区分

Defined in

hanzi-chai/src/lib/data.ts:13


Element

Ƭ Element: string

Defined in

hanzi-chai/src/lib/config.ts:27


EncoderTypes

Ƭ EncoderTypes: typeof encoderTypes[number]

Defined in

hanzi-chai/src/lib/templates.ts:49


Example

Ƭ Example: "mswb" | "flypy" | "yima" | "zhengma"

Defined in

hanzi-chai/src/lib/templates.ts:11


ExampleConfig

Ƭ ExampleConfig: Required<Config>

Defined in

hanzi-chai/src/lib/config.ts:239


Feature

Ƭ Feature: keyof typeof classifier

Defined in

hanzi-chai/src/lib/classifier.ts:56


Grouping

Ƭ Grouping: Record<Element, Element>

Defined in

hanzi-chai/src/lib/config.ts:33


IndexedElement

Ƭ IndexedElement: string | { element: string ; index: number }

Defined in

hanzi-chai/src/lib/assembly.ts:88


Interval

Ƭ Interval: [number, number]

Defined in

hanzi-chai/src/lib/bezier.ts:136


Key

Ƭ Key: string | { element: string ; index: number }

Defined in

hanzi-chai/src/lib/config.ts:29


KeyboardTypes

Ƭ KeyboardTypes: typeof keyboardTypes[number]

Defined in

hanzi-chai/src/lib/templates.ts:33


Mapping

Ƭ Mapping: Record<Element, string | Key[]>

Defined in

hanzi-chai/src/lib/config.ts:31


N1

Ƭ N1: [number]

Defined in

hanzi-chai/src/lib/data.ts:3


N2

Ƭ N2: [number, number]

Defined in

hanzi-chai/src/lib/data.ts:4


N3

Ƭ N3: [number, number, number]

Defined in

hanzi-chai/src/lib/data.ts:5


N6

Ƭ N6: [number, number, number, number, number, number]

Defined in

hanzi-chai/src/lib/data.ts:6


Op

Ƭ Op: UnaryOp | BinaryOp

Defined in

hanzi-chai/src/lib/config.ts:77


Operator

Ƭ Operator: typeof operators[number]

结构表示符 例如 ⿰、⿱ 等 符合 Unicode 中的 Ideography Description Characters 参见 https://en.wikipedia.org/wiki/Ideographic_Description_Characters_(Unicode_block)

Defined in

hanzi-chai/src/lib/data.ts:108


Point

Ƭ Point: N2

Defined in

hanzi-chai/src/lib/data.ts:23


Position

Ƭ Position: -1 | -0.5 | 0 | 0.5 | 1

Defined in

hanzi-chai/src/lib/bezier.ts:138


PrimitiveRepertoire

Ƭ PrimitiveRepertoire: Record<string, PrimitiveCharacter>

原始字符集,为字符名称到原始字符的映射

Defined in

hanzi-chai/src/lib/data.ts:165


PronunciationElementTypes

Ƭ PronunciationElementTypes: typeof pronunciationElementTypes[number]

Defined in

hanzi-chai/src/lib/element.ts:22


RenderedGlyph

Ƭ RenderedGlyph: RenderedStroke[]

Defined in

hanzi-chai/src/lib/topology.ts:20


Repertoire

Ƭ Repertoire: Record<string, Character>

字符集,为字符名称到字符的映射

Defined in

hanzi-chai/src/lib/data.ts:168


Rule

Ƭ Rule: Transformation | Transliteration

Defined in

hanzi-chai/src/lib/config.ts:182


SVGGlyph

Ƭ SVGGlyph: SVGStroke[]

SVG 字形是一系列 SVG 笔画的列表

Defined in

hanzi-chai/src/lib/data.ts:49


Scheme

Ƭ Scheme: number[]

Defined in

hanzi-chai/src/lib/selector.ts:21


Selector

Ƭ Selector: SieveName[]

Defined in

hanzi-chai/src/lib/config.ts:25


SieveName

Ƭ SieveName: "根少优先" | "连续笔顺" | "全符笔顺" | "能连不交" | "能散不连" | "同向笔画" | "取大优先" | "取小优先" | "结构完整" | "多强字根" | "少弱字根" | "非形近根"

Defined in

hanzi-chai/src/lib/config.ts:11


Stroke

Ƭ Stroke: SVGStroke | ReferenceStroke

广义的笔画,包括 SVG 笔画和引用笔画

Defined in

hanzi-chai/src/lib/data.ts:54


StrokeRelation

Ƭ StrokeRelation: CurveRelation[]

Defined in

hanzi-chai/src/lib/topology.ts:158


UnaryOp

Ƭ UnaryOp: typeof unaryOps[number]

Defined in

hanzi-chai/src/lib/config.ts:75


UserData

Ƭ UserData: Object

Type declaration

NameType
glyph_customization?CustomGlyph
reading_customization?CustomReadings
repertoire?PrimitiveRepertoire
tags?string[]

Defined in

hanzi-chai/src/lib/config.ts:219


WordRule

Ƭ WordRule: { formula: string } & { length_equal: number } | { length_in_range: number[] }

Defined in

hanzi-chai/src/lib/config.ts:96

Variables

attaching

Const attaching: Sieve<number>

规则:能散不连

尽量让字根不相连。该规则采集自五笔

Defined in

hanzi-chai/src/lib/selector.ts:206


bias

Const bias: Sieve<number[]>

规则:取大优先

让顺序靠前的字根尽量取到更多的笔画

Defined in

hanzi-chai/src/lib/selector.ts:64


binaryOps

Const binaryOps: readonly ["是", "不是", "匹配", "不匹配", "编码匹配", "编码不匹配"]

Defined in

hanzi-chai/src/lib/config.ts:65


classifier

Const classifier: Object

GF2001-2001 给出的笔画分类规范,将 31 种笔画分为 5 类 类别用数字表示 在本系统中,出于字根认同的考虑,在撇中分出了平撇、捺中分出了平捺、点中分出了平点 所以比 GF2001-2001 中的分类多了 3 种,一共 34 种

Type declaration

NameType
平捺number
平撇number
平点number
弯钩number
number
number
number
撇折number
撇点number
斜钩number
number
横折number
横折弯number
横折弯钩number
横折折number
横折折折number
横折折折钩number
横折折撇number
横折提number
横折钩number
横撇number
横撇弯钩number
横斜钩number
横钩number
number
number
竖弯number
竖弯钩number
竖折number
竖折折number
竖折折钩number
竖折撇number
竖提number
竖钩number

Defined in

hanzi-chai/src/lib/classifier.ts:9


classifierTypes

Const classifierTypes: readonly ["国标五分类", "表形码六分类", "郑码七分类"]

Defined in

hanzi-chai/src/lib/templates.ts:20


crossing

Const crossing: Sieve<number>

规则:能连不交

尽量让字根不交叉。该规则采集自五笔

Defined in

hanzi-chai/src/lib/selector.ts:199


defaultAlgebra

Const defaultAlgebra: Record<PronunciationElementTypes, Rule[]>

Defined in

hanzi-chai/src/lib/element.ts:27


defaultConfig

Const defaultConfig: Config

Defined in

hanzi-chai/src/lib/templates.ts:83


defaultDegenerator

Const defaultDegenerator: Degenerator

Defined in

hanzi-chai/src/lib/degenerator.ts:27


defaultOptimization

Const defaultOptimization: Optimization

Defined in

hanzi-chai/src/lib/config.ts:153


defaultSelector

Const defaultSelector: SieveName[]

Defined in

hanzi-chai/src/lib/selector.ts:12


encoderTypes

Const encoderTypes: readonly ["形音码", "双编形码(郑码)", "双编形码(易码)"]

Defined in

hanzi-chai/src/lib/templates.ts:44


examples

Const examples: Record<Example, ExampleConfig>

Defined in

hanzi-chai/src/lib/templates.ts:13


integrity

Const integrity: Sieve<number>

规则:结构完整

避免框类部件被拆散。该规则采集自宇浩输入法的文档

See

https://zhuyuhao.com/yuhao/docs/learn.html#结构完整

Defined in

hanzi-chai/src/lib/selector.ts:253


keyboardTypes

Const keyboardTypes: readonly ["郑码字根", "米十五笔字根", "无"]

Defined in

hanzi-chai/src/lib/templates.ts:32


length

Const length: Sieve<number>

Defined in

hanzi-chai/src/lib/selector.ts:51


operators

Const operators: readonly ["⿰", "⿱", "⿲", "⿳", "⿴", "⿵", "⿶", "⿷", "⿸", "⿹", "⿺", "⿻"]

Defined in

hanzi-chai/src/lib/data.ts:87


ops

Const ops: Op[]

Defined in

hanzi-chai/src/lib/config.ts:74


order

Const order: Sieve<number>

规则:全符笔顺

各个字根中笔画的顺序连在一起是否与整个部件的笔顺相同,相同者优先 该规则采集自三码郑码的文档

See

https://www.yuque.com/smzm/zhengma/otb32d

Defined in

hanzi-chai/src/lib/selector.ts:89


order2

Const order2: Sieve<number>

规则:连续笔顺

字根是否由部件中连续的几个笔画构成,不符合此特点的字根数量少者优先。该规则采集自宇浩输入法的文档。

See

https://zhuyuhao.com/yuhao/docs/learn.html#符合笔顺

Defined in

hanzi-chai/src/lib/selector.ts:107


orientation

Const orientation: Sieve<number>

规则:同向笔画

尽量让方向相同的笔画包含在同一个字根里。该规则采集自五笔

Defined in

hanzi-chai/src/lib/selector.ts:213


printableAscii

Const printableAscii: string[]

Defined in

hanzi-chai/src/lib/utils.ts:16


pronunciationElementTypes

Const pronunciationElementTypes: readonly ["声母", "双拼声母", "韵母", "双拼韵母", "声调", "首字母", "末字母"]

Defined in

hanzi-chai/src/lib/element.ts:12


schema

Const schema: Record<Feature, Draw["command"][]>

特定类型的笔画在数据库中的表示所包含的 SVG 命令的类别和数量是固定的 比如,横折折折钩的表示一定是 h v h v,不会有其他可能性 另外,平撇、平点、平捺的命令是 z,这个不是规范的 SVG 命令,只是为了和撇、点、捺的 c 区分 z 和 c 的实际效果是一样的

Defined in

hanzi-chai/src/lib/classifier.ts:66


sieveMap

Const sieveMap: Map<SieveName, Sieve<number> | Sieve<number[]>>

Defined in

hanzi-chai/src/lib/selector.ts:277


similar

Const similar: Sieve<number>

规则:非形近根

尽量少使用被归并到其他字根的字根。该规则采集自三码郑码的文档

See

https://www.yuque.com/smzm/zhengma/otb32d

Defined in

hanzi-chai/src/lib/selector.ts:127


strong

Const strong: Sieve<number>

规则:强字根

尽量多使用特定的一些字根。该规则采集自郑码的文档

Defined in

hanzi-chai/src/lib/selector.ts:140


unaryOps

Const unaryOps: readonly ["存在", "不存在"]

Defined in

hanzi-chai/src/lib/config.ts:73


unbias

Const unbias: Sieve<number[]>

规则:取小优先

让顺序靠前的字根尽量取到更少的笔画

Defined in

hanzi-chai/src/lib/selector.ts:75


weak

Const weak: Sieve<number>

规则:弱字根

尽量避免使用特定的一些字根

Defined in

hanzi-chai/src/lib/selector.ts:154

Functions

affineMerge

affineMerge(compound, glyphList): SVGStroke[]

给定复合体数据和各部分渲染后的 SVG 图形,返回合并后的 SVG 图形

Parameters

NameTypeDescription
compoundCompound复合体数据
glyphListSVGGlyph[]各部分渲染后的 SVG 图形

Returns

SVGStroke[]

合并后的 SVG 图形

Defined in

hanzi-chai/src/lib/affine.ts:88


analysis

analysis(repertoire, config): AnalysisResult

对整个字符集中的字符进行拆分

Parameters

NameTypeDescription
repertoireRepertoire字符集
configConfig配置

Returns

AnalysisResult

Defined in

hanzi-chai/src/lib/repertoire.ts:92


applyRules

applyRules(name, rules, syllable): string

Parameters

NameType
namestring
rulesRule[]
syllablestring

Returns

string

Defined in

hanzi-chai/src/lib/element.ts:54


area

area(p, q): number

Parameters

NameType
pN2
qN2

Returns

number

Defined in

hanzi-chai/src/lib/bezier.ts:133


assemble

assemble(repertoire, config, characters, analysisResult): AssemblyResult

给定一个拆分结果,返回所有可能的编码

Parameters

NameTypeDescription
repertoireRepertoire字符集
configConfig配置
charactersstring[]需要编码的汉字列表
analysisResultAnalysisResult分析结果

Returns

AssemblyResult

组装结果

Defined in

hanzi-chai/src/lib/assembly.ts:191


binaryToIndices

binaryToIndices(n): (binary: number) => number[]

Parameters

NameType
nnumber

Returns

fn

▸ (binary): number[]

Parameters
NameType
binarynumber
Returns

number[]

Defined in

hanzi-chai/src/lib/degenerator.ts:22


chars

chars(s): number

Parameters

NameType
sstring

Returns

number

Defined in

hanzi-chai/src/lib/utils.ts:43


computeComponent

computeComponent(name, glyph): ComputedComponent

把一个基本部件从 SVG 图形出发,先渲染成 Bezier 图形,然后计算拓扑

这样,便于后续的字根认同计算

Parameters

NameType
namestring
glyphSVGGlyph

Returns

ComputedComponent

Defined in

hanzi-chai/src/lib/component.ts:205


createConfig

createConfig(starter): Config

Parameters

NameType
starterStarterType

Returns

Config

Defined in

hanzi-chai/src/lib/templates.ts:63


curveLength

curveLength(curve): number

Parameters

NameType
curveCurve

Returns

number

Defined in

hanzi-chai/src/lib/bezier.ts:203


curveRelation

curveRelation(c1, c2): CurveRelation

Parameters

NameType
c1Curve
c2Curve

Returns

CurveRelation

Defined in

hanzi-chai/src/lib/topology.ts:136


degenerate

degenerate(degenerator, glyph): readonly [("横" | "提" | "竖" | "竖钩" | "撇" | "平撇" | "点" | "平点" | "捺" | "平捺" | "横钩" | "横撇" | "横折" | "横折钩" | "横斜钩" | "横折提" | "横折折" | "横折弯" | "横撇弯钩" | "横折弯钩" | "横折折撇" | "横折折折" | "横折折折钩" | "竖提" | "竖折" | "竖弯" | "竖弯钩" | "竖折撇" | "竖折折钩" | "竖折折" | "撇点" | "撇折" | "弯钩" | "斜钩")[], Topology]

字根认同的另一种算法,和上面的算法等价且更简单,但是效率比较差 这个算法是直接计算出一个部件在某个退化映射下的结果,然后和字根的结果比较 这种方式要求穷举一个部件中所有的笔画取幂集,复杂度为 O(2^n),所以目前只用于测试

Parameters

NameType
degeneratorDegenerator
glyphRenderedGlyph

Returns

readonly [("横" | "提" | "竖" | "竖钩" | "撇" | "平撇" | "点" | "平点" | "捺" | "平捺" | "横钩" | "横撇" | "横折" | "横折钩" | "横斜钩" | "横折提" | "横折折" | "横折弯" | "横撇弯钩" | "横折弯钩" | "横折折撇" | "横折折折" | "横折折折钩" | "竖提" | "竖折" | "竖弯" | "竖弯钩" | "竖折撇" | "竖折折钩" | "竖折折" | "撇点" | "撇折" | "弯钩" | "斜钩")[], Topology]

Defined in

hanzi-chai/src/lib/degenerator.ts:167


determine

determine(repertoire, customization?, tags?): Repertoire

将原始字符集转换为字符集 主要的工作是对每个字符,在数据库中的多个字形中选取一个

Parameters

NameTypeDefault valueDescription
repertoirePrimitiveRepertoireundefined原始字符集
customizationCustomGlyph{}自定义字形
tagsstring[][]用户选择的标签 基本逻辑为,对于每个字符, - 如果用户指定了字形,则使用用户指定的字形 - 如果用户指定的某个标签匹配上了这个字符的某个字形,则使用这个字形 - 如果都没有,就使用默认字形

Returns

Repertoire

Defined in

hanzi-chai/src/lib/repertoire.ts:42


disassembleComponents

disassembleComponents(repertoire, config): [ComponentResults, string[]]

对所有部件进行拆分

Parameters

NameTypeDescription
repertoireRepertoire字符集
configConfig配置

Returns

[ComponentResults, string[]]

拆分结果和无法拆分的汉字列表

Defined in

hanzi-chai/src/lib/component.ts:253


disassembleCompounds

disassembleCompounds(repertoire, config, componentResults): readonly [CompoundResults, string[]]

对复合体进行拆分

Parameters

NameTypeDescription
repertoireRepertoire字符集
configConfig配置
componentResultsComponentResults部件拆分结果

Returns

readonly [CompoundResults, string[]]

Defined in

hanzi-chai/src/lib/compound.ts:153


distance

distance(p, q): number

Parameters

NameType
pN2
qN2

Returns

number

Defined in

hanzi-chai/src/lib/bezier.ts:134


findCrossPoint

findCrossPoint(a, at, b, bt): undefined | N2

Parameters

NameType
aCurve
atInterval
bCurve
btInterval

Returns

undefined | N2

Defined in

hanzi-chai/src/lib/bezier.ts:152


findElement

findElement(object, result, config, extra): undefined | string

Parameters

NameType
objectCodableObject
resultCharacterResult
configConfig
extraExtra

Returns

undefined | string

Defined in

hanzi-chai/src/lib/element.ts:184


findGlyphIndex

findGlyphIndex(glyphs, tags): number

Parameters

NameType
glyphs(Component | Compound)[]
tagsstring[]

Returns

number

Defined in

hanzi-chai/src/lib/repertoire.ts:18


findTopology

findTopology(renderedGlyph): Topology

Parameters

NameType
renderedGlyphRenderedGlyph

Returns

Topology

Defined in

hanzi-chai/src/lib/topology.ts:203


generateSchemes

generateSchemes(strokes, roots): number[][]

根据一个部件中包含的所有字根的情况,导出所有可能的拆分方案

Parameters

NameTypeDescription
strokesnumber部件笔画数
rootsnumber[]部件包含的字根列表,其中每个字根用二进制表示 函数通过递归的方式,每次选取剩余部分的第一笔,然后在字根列表中找到包含这个笔画的所有字根 将这些可能性与此前已经拆分的部分组合,得到新的拆分方案 直到所有的笔画都使用完毕

Returns

number[][]

Defined in

hanzi-chai/src/lib/component.ts:29


generateSliceBinaries

generateSliceBinaries(config, component, root): number[]

给定一个部件和一个字根,找出这个部件所有包含这个字根的方式 如果部件不包含这个字根,就返回空列表

Parameters

NameTypeDescription
configConfig配置
componentComputedComponent待拆分部件
rootComputedComponent字根

Returns

number[]

Defined in

hanzi-chai/src/lib/degenerator.ts:115


getBoundingBox

getBoundingBox(a): [N2, N2]

Parameters

NameType
aCurve

Returns

[N2, N2]

Defined in

hanzi-chai/src/lib/bezier.ts:57


getComponentScheme

getComponentScheme(component, rootData, config, classifier): MultipleSchemeError | NoSchemeError | ComponentAnalysis

通过自动拆分算法,给定字根列表,对部件进行拆分

Parameters

NameTypeDefault valueDescription
componentComputedComponentundefined部件
rootDataComputedComponent[]undefined字根列表
configConfigundefined配置
classifierObjectundefined笔画分类器 如果拆分唯一,则返回拆分结果;否则返回错误
classifier.平捺number4-
classifier.平撇number3-
classifier.平点number4-
classifier.弯钩number5-
classifier.捺number4-
classifier.提number1-
classifier.撇number3-
classifier.撇折number5-
classifier.撇点number5-
classifier.斜钩number5-
classifier.横number1-
classifier.横折number5-
classifier.横折弯number5-
classifier.横折弯钩number5-
classifier.横折折number5-
classifier.横折折折number5-
classifier.横折折折钩number5-
classifier.横折折撇number5-
classifier.横折提number5-
classifier.横折钩number5-
classifier.横撇number5-
classifier.横撇弯钩number5-
classifier.横斜钩number5-
classifier.横钩number5-
classifier.点number4-
classifier.竖number2-
classifier.竖弯number5-
classifier.竖弯钩number5-
classifier.竖折number5-
classifier.竖折折number5-
classifier.竖折折钩number5-
classifier.竖折撇number5-
classifier.竖提number5-
classifier.竖钩number2-

Returns

MultipleSchemeError | NoSchemeError | ComponentAnalysis

拆分结果

Throws

NoSchemeError 无拆分方案

Throws

MultipleSchemeError 多个拆分方案

Defined in

hanzi-chai/src/lib/component.ts:79


getDummyBasicComponent

getDummyBasicComponent(): BasicComponent

Returns

BasicComponent

Defined in

hanzi-chai/src/lib/utils.ts:47


getDummyCompound

getDummyCompound(operator): Compound

Parameters

NameType
operator"⿰" | "⿱" | "⿲" | "⿳" | "⿴" | "⿵" | "⿶" | "⿷" | "⿸" | "⿹" | "⿺" | "⿻"

Returns

Compound

Defined in

hanzi-chai/src/lib/utils.ts:94


getDummyDerivedComponent

getDummyDerivedComponent(): DerivedComponent

Returns

DerivedComponent

Defined in

hanzi-chai/src/lib/utils.ts:54


getDummyReferenceStroke

getDummyReferenceStroke(): ReferenceStroke

Returns

ReferenceStroke

Defined in

hanzi-chai/src/lib/utils.ts:62


getDummySVGStroke

getDummySVGStroke(feature, start?, oldCurveList?): SVGStroke

Parameters

NameTypeDefault value
feature"横" | "提" | "竖" | "竖钩" | "撇" | "平撇" | "点" | "平点" | "捺" | "平捺" | "横钩" | "横撇" | "横折" | "横折钩" | "横斜钩" | "横折提" | "横折折" | "横折弯" | "横撇弯钩" | "横折弯钩" | "横折折撇" | "横折折折" | "横折折折钩" | "竖提" | "竖折" | "竖弯" | "竖弯钩" | "竖折撇" | "竖折折钩" | "竖折折" | "撇点" | "撇折" | "弯钩" | "斜钩"undefined
startN2undefined
oldCurveListDraw[][]

Returns

SVGStroke

Defined in

hanzi-chai/src/lib/utils.ts:69


getIntervalOnOrientation

getIntervalOnOrientation(a): [Interval, Interval]

Parameters

NameType
aCurve

Returns

[Interval, Interval]

Defined in

hanzi-chai/src/lib/bezier.ts:60


getIntervalPosition

getIntervalPosition(i, j): Position

Parameters

NameType
iInterval
jInterval

Returns

Position

Defined in

hanzi-chai/src/lib/bezier.ts:140


getSupplemental

getSupplemental(repertoire, list): string[]

Parameters

NameType
repertoireRepertoire
liststring[]

Returns

string[]

Defined in

hanzi-chai/src/lib/utils.ts:104


getTSV

getTSV(collection): [string, string][]

Parameters

NameType
collectionAssemblyResult

Returns

[string, string][]

Defined in

hanzi-chai/src/lib/assembly.ts:219


indicesToBinary

indicesToBinary(n): (indices: number[]) => number

Parameters

NameType
nnumber

Returns

fn

▸ (indices): number

Parameters
NameType
indicesnumber[]
Returns

number

Defined in

hanzi-chai/src/lib/degenerator.ts:14


isBoundedBy

isBoundedBy(stroke, xrange, yrange): boolean

Parameters

NameType
strokeRenderedStroke
xrangeInterval
yrangeInterval

Returns

boolean

Defined in

hanzi-chai/src/lib/bezier.ts:223


isCollinear

isCollinear(from, to, point): boolean

Determine if the point is on a given segment

Parameters

NameTypeDescription
fromN2starting point
toN2end point
pointN2another point

Returns

boolean

Defined in

hanzi-chai/src/lib/bezier.ts:198


isComponent

isComponent(glyph): glyph is BasicComponent | DerivedComponent

Parameters

NameType
glyphBasicComponent | DerivedComponent | Compound

Returns

glyph is BasicComponent | DerivedComponent

Defined in

hanzi-chai/src/lib/utils.ts:98


isPUA

isPUA(char): boolean

Parameters

NameType
charstring

Returns

boolean

Defined in

hanzi-chai/src/lib/utils.ts:38


isValidCJKChar

isValidCJKChar(char): boolean

Parameters

NameType
charstring

Returns

boolean

Defined in

hanzi-chai/src/lib/utils.ts:32


listToObject

listToObject<T>(list): Object

Type parameters

NameType
Textends Object

Parameters

NameType
listT[]

Returns

Object

Defined in

hanzi-chai/src/lib/utils.ts:129


makeCurve

makeCurve(start, «destructured»): Curve

Parameters

NameType
startN2
«destructured»Draw

Returns

Curve

Defined in

hanzi-chai/src/lib/bezier.ts:91


mergeClassifier

mergeClassifier(partialClassifier?): Object

给定方案配置文件中的不完整的分类器,将其与默认的分类器合并 得到一个完整的分类器

Parameters

NameType
partialClassifier?Record<"横" | "提" | "竖" | "竖钩" | "撇" | "平撇" | "点" | "平点" | "捺" | "平捺" | "横钩" | "横撇" | "横折" | "横折钩" | "横斜钩" | "横折提" | "横折折" | "横折弯" | "横撇弯钩" | "横折弯钩" | "横折折撇" | "横折折折" | "横折折折钩" | "竖提" | "竖折" | "竖弯" | "竖弯钩" | "竖折撇" | "竖折折钩" | "竖折折" | "撇点" | "撇折" | "弯钩" | "斜钩", number>

Returns

Object

NameType
平捺number
平撇number
平点number
弯钩number
number
number
number
撇折number
撇点number
斜钩number
number
横折number
横折弯number
横折弯钩number
横折折number
横折折折number
横折折折钩number
横折折撇number
横折提number
横折钩number
横撇number
横撇弯钩number
横斜钩number
横钩number
number
number
竖弯number
竖弯钩number
竖折number
竖折折number
竖折折钩number
竖折撇number
竖提number
竖钩number

Defined in

hanzi-chai/src/lib/classifier.ts:50


parseList

parseList(value): CodableObject

Parameters

NameType
value(string | number)[]

Returns

CodableObject

Defined in

hanzi-chai/src/lib/element.ts:155


parseTSV

parseTSV(text): Record<string, number>

Parameters

NameType
textstring

Returns

Record<string, number>

Defined in

hanzi-chai/src/lib/utils.ts:137


recursiveRenderComponent

recursiveRenderComponent(component, repertoire, glyphCache?): SVGGlyph | InvalidGlyphError

递归渲染一个部件(基本部件或者衍生部件) 如果是基本部件就直接返回,如果是衍生部件则先渲染源字的图形,然后解引用得到这个部件的图形

Parameters

NameTypeDescription
componentComponent部件
repertoirePrimitiveRepertoire原始字符集
glyphCacheMap<string, SVGGlyph>部件缓存

Returns

SVGGlyph | InvalidGlyphError

部件的 SVG 图形

Throws

InvalidGlyphError 无法渲染

Defined in

hanzi-chai/src/lib/component.ts:171


recursiveRenderCompound

recursiveRenderCompound(compound, repertoire, glyphCache?): SVGGlyph | InvalidGlyphError

将复合体递归渲染为 SVG 图形

Parameters

NameTypeDescription
compoundCompound复合体
repertoireRepertoire原始字符集
glyphCacheMap<string, SVGGlyph>-

Returns

SVGGlyph | InvalidGlyphError

SVG 图形

Throws

InvalidGlyphError 无法渲染

Defined in

hanzi-chai/src/lib/compound.ts:51


render

render(«destructured»): RenderedStroke

Parameters

NameType
«destructured»SVGStroke

Returns

RenderedStroke

Defined in

hanzi-chai/src/lib/bezier.ts:121


renderList

renderList(object): (string | number)[]

Parameters

NameType
objectCodableObject

Returns

(string | number)[]

Defined in

hanzi-chai/src/lib/element.ts:136


renderName

renderName(object): string

Parameters

NameType
objectCodableObject

Returns

string

Defined in

hanzi-chai/src/lib/element.ts:116


renderRootList

renderRootList(repertoire, config): ComputedComponent[]

将所有的字根都计算成 ComputedComponent

Parameters

NameTypeDescription
repertoireRepertoire字符集
configConfig配置

Returns

ComputedComponent[]

所有计算后字根的列表

Defined in

hanzi-chai/src/lib/component.ts:224


renderSVGGlyph

renderSVGGlyph(glyph): RenderedStroke[]

Parameters

NameType
glyphSVGGlyph

Returns

RenderedStroke[]

Defined in

hanzi-chai/src/lib/topology.ts:172


renderSVGStroke

renderSVGStroke(«destructured»): RenderedStroke

Parameters

NameType
«destructured»SVGStroke

Returns

RenderedStroke

Defined in

hanzi-chai/src/lib/topology.ts:160


select

select(config, component, schemeList, rootMap): MultipleSchemeError | NoSchemeError | readonly [Scheme, { evaluation: Map<SieveName, number | number[]> ; excluded: boolean = false; scheme: Scheme }[]]

选择最优的拆分方案

Parameters

NameTypeDescription
configConfig配置
componentComputedComponent待拆分部件
schemeListScheme[]拆分方案列表
rootMapMap<number, string>字根映射,从切片的二进制表示到字根名称的映射

Returns

MultipleSchemeError | NoSchemeError | readonly [Scheme, { evaluation: Map<SieveName, number | number[]> ; excluded: boolean = false; scheme: Scheme }[]]

Defined in

hanzi-chai/src/lib/selector.ts:302


sortTwoNumbers

sortTwoNumbers(ar): [number, number]

Parameters

NameType
ar[number, number]

Returns

[number, number]

Defined in

hanzi-chai/src/lib/bezier.ts:54


strokeRelation

strokeRelation(stroke1, stroke2): StrokeRelation

Parameters

NameType
stroke1RenderedStroke
stroke2RenderedStroke

Returns

StrokeRelation

Defined in

hanzi-chai/src/lib/topology.ts:145


unicodeBlock

unicodeBlock(code): "ascii" | "cjk" | "cjk-a" | "pua" | "unknown"

Parameters

NameType
codenumber

Returns

"ascii" | "cjk" | "cjk-a" | "pua" | "unknown"

Defined in

hanzi-chai/src/lib/utils.ts:20