Skip to content

Commit

Permalink
test: add test for x2h reduplication simplification
Browse files Browse the repository at this point in the history
@@__LNN_NO_BUILD__@@
  • Loading branch information
DGCK81LNN committed Jan 8, 2024
1 parent d1777dd commit 68405c9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions package/test/base_transcribers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,31 @@ describe("base_transcribers", function () {
])
})

it('obeys the "same-hanzi rule" for reduplicates', function () {
const t = new AlphaToHanziTranscriber({
dict: [
{ h: "用", x: "y3" },
{ h: "心", x: "53" },
{ h: "蕊", x: "y353" },
],
})
expect(t.transcribe("y353y353")).toEqual([
[
OW({
content: [OW({ h: "蕊", x: "y353" }), OW({ h: "蕊", x: "y353" })],
}),
OW({
content: [
OW({ h: "用", x: "y3" }),
OW({ h: "心", x: "53" }),
OW({ h: "用", x: "y3" }),
OW({ h: "心", x: "53" }),
],
}),
],
])
})

it("supports explicit separators", function () {
const t = new AlphaToHanziTranscriber({
dict: [
Expand Down

0 comments on commit 68405c9

Please # to comment.