mirror of
https://github.com/mii443/AzooKeyKanaKanjiConverter.git
synced 2025-08-22 15:05:26 +00:00
[Experimental] 削除操作についてもグラフベースに変更 (#79)
* switch to ComposingTextV2 * delete操作を実装
This commit is contained in:
@ -28,6 +28,11 @@ struct ComposingTextV2: Hashable, Sendable {
|
||||
self.convertTarget = Self.buildConvertTarget(input)
|
||||
}
|
||||
|
||||
mutating func append(_ string: String, inputStyle: InputGraphInputStyle.ID) {
|
||||
self.input.append(contentsOf: string.map {.init(value: $0, inputStyle: inputStyle)})
|
||||
self.convertTarget = Self.buildConvertTarget(input)
|
||||
}
|
||||
|
||||
mutating func removeLast(_ k: Int = 1) {
|
||||
let rest = self.convertTarget.dropLast(k)
|
||||
typealias Item = (value: String, inputStyle: InputGraphInputStyle.ID)
|
||||
|
@ -86,16 +86,16 @@ struct CorrectGraph {
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
mutating func update(with item: ComposingText.InputElement, index: Int, input: [ComposingText.InputElement]) -> IndexSet {
|
||||
mutating func update(with item: ComposingTextV2.InputElement, index: Int, input: [ComposingTextV2.InputElement]) -> IndexSet {
|
||||
var insertedIndexSet = IndexSet()
|
||||
// 訂正のない候補を追加
|
||||
do {
|
||||
let nodeIndex = self.insert(
|
||||
Node(
|
||||
inputElementsRange: .range(index, index + 1),
|
||||
inputStyle: InputGraphInputStyle(from: input[index].inputStyle).id,
|
||||
inputStyle: input[index].inputStyle,
|
||||
correction: .none,
|
||||
value: item.character
|
||||
value: item.value
|
||||
),
|
||||
nextTo: self.inputIndexToEndNodeIndices[index, default: IndexSet()]
|
||||
)
|
||||
@ -123,7 +123,7 @@ struct CorrectGraph {
|
||||
guard cInputStyleId.isCompatible(with: inputStyleId) else {
|
||||
continue
|
||||
}
|
||||
if let nNode = cNode.find(key: input[cIndex].character) {
|
||||
if let nNode = cNode.find(key: input[cIndex].value) {
|
||||
stack.append((nNode, cIndex - 1, cRouteCount + 1, inputStyleId))
|
||||
for value in nNode.value {
|
||||
if value.isEmpty {
|
||||
@ -157,7 +157,7 @@ struct CorrectGraph {
|
||||
return insertedIndexSet
|
||||
}
|
||||
|
||||
static func build(input: [ComposingText.InputElement]) -> Self {
|
||||
static func build(input: [ComposingTextV2.InputElement]) -> Self {
|
||||
var correctGraph = Self()
|
||||
for (index, item) in zip(input.indices, input) {
|
||||
correctGraph.update(with: item, index: index, input: input)
|
||||
|
@ -13,7 +13,7 @@ import XCTest
|
||||
final class CorrectGraphTests: XCTestCase {
|
||||
func testBuildSimpleDirectInput() throws {
|
||||
let graph = CorrectGraph.build(input: [
|
||||
.init(character: "あ", inputStyle: .direct)
|
||||
.init(value: "あ", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
XCTAssertEqual(
|
||||
graph.nodes.first(where: {$0.value == "あ"}),
|
||||
@ -22,7 +22,7 @@ final class CorrectGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleDirectInputWithTypo() throws {
|
||||
let graph = CorrectGraph.build(input: [
|
||||
.init(character: "か", inputStyle: .direct)
|
||||
.init(value: "か", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
XCTAssertEqual(
|
||||
graph.nodes.first(where: {$0.value == "か"}),
|
||||
@ -35,9 +35,9 @@ final class CorrectGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildMultipleDirectInputWithTypo() throws {
|
||||
let graph = CorrectGraph.build(input: [
|
||||
.init(character: "あ", inputStyle: .direct),
|
||||
.init(character: "か", inputStyle: .direct),
|
||||
.init(character: "う", inputStyle: .direct)
|
||||
.init(value: "あ", inputStyle: .systemFlickDirect),
|
||||
.init(value: "か", inputStyle: .systemFlickDirect),
|
||||
.init(value: "う", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
XCTAssertEqual(
|
||||
graph.nodes.first(where: {$0.value == "か"}),
|
||||
@ -59,8 +59,8 @@ final class CorrectGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleRomanInput() throws {
|
||||
let graph = CorrectGraph.build(input: [
|
||||
.init(character: "k", inputStyle: .roman2kana),
|
||||
.init(character: "a", inputStyle: .roman2kana)
|
||||
.init(value: "k", inputStyle: .systemRomanKana),
|
||||
.init(value: "a", inputStyle: .systemRomanKana)
|
||||
])
|
||||
XCTAssertEqual(
|
||||
graph.nodes.first(where: {$0.value == "k"}),
|
||||
@ -73,8 +73,8 @@ final class CorrectGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleRomanInputWithTypo() throws {
|
||||
let graph = CorrectGraph.build(input: [
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "s", inputStyle: .roman2kana)
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "s", inputStyle: .systemRomanKana)
|
||||
])
|
||||
XCTAssertEqual(
|
||||
graph.nodes.first(where: {$0.value == "t" && $0.inputElementsRange == .range(0, 1)}),
|
||||
|
@ -13,18 +13,18 @@ import XCTest
|
||||
final class InputGraphTests: XCTestCase {
|
||||
func testBuildSimpleDirectInput() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "あ", inputStyle: .direct),
|
||||
.init(character: "い", inputStyle: .direct),
|
||||
.init(character: "う", inputStyle: .direct)
|
||||
.init(value: "あ", inputStyle: .systemFlickDirect),
|
||||
.init(value: "い", inputStyle: .systemFlickDirect),
|
||||
.init(value: "う", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(inputGraph.nodes.count, 4) // Root nodes
|
||||
}
|
||||
func testBuildSimpleDirectInput_あかう() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "あ", inputStyle: .direct),
|
||||
.init(character: "か", inputStyle: .direct),
|
||||
.init(character: "う", inputStyle: .direct)
|
||||
.init(value: "あ", inputStyle: .systemFlickDirect),
|
||||
.init(value: "か", inputStyle: .systemFlickDirect),
|
||||
.init(value: "う", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(inputGraph.nodes.count, 5) // Root nodes
|
||||
@ -32,9 +32,9 @@ final class InputGraphTests: XCTestCase {
|
||||
|
||||
func testBuildSimpleDirectInput_たいか() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "た", inputStyle: .direct),
|
||||
.init(character: "い", inputStyle: .direct),
|
||||
.init(character: "か", inputStyle: .direct)
|
||||
.init(value: "た", inputStyle: .systemFlickDirect),
|
||||
.init(value: "い", inputStyle: .systemFlickDirect),
|
||||
.init(value: "か", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -49,7 +49,7 @@ final class InputGraphTests: XCTestCase {
|
||||
|
||||
func testBuildSimpleRoman2KanaInput_1文字だけ() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "i", inputStyle: .roman2kana)
|
||||
.init(value: "i", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -59,8 +59,8 @@ final class InputGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleRoman2KanaInput_2文字_it() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "i", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana)
|
||||
.init(value: "i", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -74,9 +74,9 @@ final class InputGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleRoman2KanaInput_3文字_ita() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "i", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "a", inputStyle: .roman2kana)
|
||||
.init(value: "i", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "a", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -90,10 +90,10 @@ final class InputGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleRoman2KanaInput_4文字_sits() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "s", inputStyle: .roman2kana),
|
||||
.init(character: "i", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "s", inputStyle: .roman2kana)
|
||||
.init(value: "s", inputStyle: .systemRomanKana),
|
||||
.init(value: "i", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "s", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -111,9 +111,9 @@ final class InputGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleRoman2KanaInput_3文字_its() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "i", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "s", inputStyle: .roman2kana)
|
||||
.init(value: "i", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "s", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -139,10 +139,10 @@ final class InputGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleRoman2KanaInput_4文字_itsa() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "i", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "s", inputStyle: .roman2kana),
|
||||
.init(character: "a", inputStyle: .roman2kana)
|
||||
.init(value: "i", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "s", inputStyle: .systemRomanKana),
|
||||
.init(value: "a", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -183,13 +183,13 @@ final class InputGraphTests: XCTestCase {
|
||||
|
||||
func testBuildSimpleRoman2KanaInput_7文字_youshou() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "y", inputStyle: .roman2kana),
|
||||
.init(character: "o", inputStyle: .roman2kana),
|
||||
.init(character: "u", inputStyle: .roman2kana),
|
||||
.init(character: "s", inputStyle: .roman2kana),
|
||||
.init(character: "h", inputStyle: .roman2kana),
|
||||
.init(character: "o", inputStyle: .roman2kana),
|
||||
.init(character: "u", inputStyle: .roman2kana)
|
||||
.init(value: "y", inputStyle: .systemRomanKana),
|
||||
.init(value: "o", inputStyle: .systemRomanKana),
|
||||
.init(value: "u", inputStyle: .systemRomanKana),
|
||||
.init(value: "s", inputStyle: .systemRomanKana),
|
||||
.init(value: "h", inputStyle: .systemRomanKana),
|
||||
.init(value: "o", inputStyle: .systemRomanKana),
|
||||
.init(value: "u", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -217,8 +217,8 @@ final class InputGraphTests: XCTestCase {
|
||||
|
||||
func testBuildSimpleRoman2KanaInput_2文字_tt() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana)
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -240,9 +240,9 @@ final class InputGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleRoman2KanaInput_3文字_tta() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "a", inputStyle: .roman2kana)
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "a", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -258,9 +258,9 @@ final class InputGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleRoman2KanaInput_3文字_nta() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "n", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "a", inputStyle: .roman2kana)
|
||||
.init(value: "n", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "a", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -274,10 +274,10 @@ final class InputGraphTests: XCTestCase {
|
||||
}
|
||||
func testBuildSimpleRoman2KanaInput_4文字_itta() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "i", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "a", inputStyle: .roman2kana)
|
||||
.init(value: "i", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "a", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -296,11 +296,11 @@ final class InputGraphTests: XCTestCase {
|
||||
|
||||
func testBuildSimpleRoman2KanaInput_5文字_sitsi() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "s", inputStyle: .roman2kana),
|
||||
.init(character: "i", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "s", inputStyle: .roman2kana),
|
||||
.init(character: "i", inputStyle: .roman2kana)
|
||||
.init(value: "s", inputStyle: .systemRomanKana),
|
||||
.init(value: "i", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "s", inputStyle: .systemRomanKana),
|
||||
.init(value: "i", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -320,9 +320,9 @@ final class InputGraphTests: XCTestCase {
|
||||
|
||||
func testBuildSimpleRoman2KanaInput_3文字_tts() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "s", inputStyle: .roman2kana)
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "s", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
@ -346,10 +346,10 @@ final class InputGraphTests: XCTestCase {
|
||||
func testBuildSimpleRoman2KanaInput_4文字_tysa() throws {
|
||||
// ちゃあ/tyさ
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "y", inputStyle: .roman2kana),
|
||||
.init(character: "s", inputStyle: .roman2kana),
|
||||
.init(character: "a", inputStyle: .roman2kana)
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "y", inputStyle: .systemRomanKana),
|
||||
.init(value: "s", inputStyle: .systemRomanKana),
|
||||
.init(value: "a", inputStyle: .systemRomanKana)
|
||||
])
|
||||
// cleanで壊れる
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
@ -381,8 +381,8 @@ final class InputGraphTests: XCTestCase {
|
||||
|
||||
func testBuildMixedInput_2文字_ts() throws {
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "s", inputStyle: .direct)
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "s", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph).clean()
|
||||
XCTAssertEqual(
|
||||
|
@ -27,9 +27,9 @@ final class LookupGraphTests: XCTestCase {
|
||||
return
|
||||
}
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "し", inputStyle: .direct),
|
||||
.init(character: "か", inputStyle: .direct),
|
||||
.init(character: "い", inputStyle: .direct)
|
||||
.init(value: "し", inputStyle: .systemFlickDirect),
|
||||
.init(value: "か", inputStyle: .systemFlickDirect),
|
||||
.init(value: "い", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph)
|
||||
var lookupGraph = LookupGraph.build(input: inputGraph, character2CharId: values.character2CharId)
|
||||
@ -68,9 +68,9 @@ final class LookupGraphTests: XCTestCase {
|
||||
return
|
||||
}
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "み", inputStyle: .direct),
|
||||
.init(character: "ら", inputStyle: .direct),
|
||||
.init(character: "い", inputStyle: .direct)
|
||||
.init(value: "み", inputStyle: .systemFlickDirect),
|
||||
.init(value: "ら", inputStyle: .systemFlickDirect),
|
||||
.init(value: "い", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph)
|
||||
var lookupGraph = LookupGraph.build(input: inputGraph, character2CharId: values.character2CharId)
|
||||
@ -100,10 +100,10 @@ final class LookupGraphTests: XCTestCase {
|
||||
return
|
||||
}
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "た", inputStyle: .direct),
|
||||
.init(character: "い", inputStyle: .direct),
|
||||
.init(character: "か", inputStyle: .direct),
|
||||
.init(character: "く", inputStyle: .direct)
|
||||
.init(value: "た", inputStyle: .systemFlickDirect),
|
||||
.init(value: "い", inputStyle: .systemFlickDirect),
|
||||
.init(value: "か", inputStyle: .systemFlickDirect),
|
||||
.init(value: "く", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph)
|
||||
var lookupGraph = LookupGraph.build(input: inputGraph, character2CharId: values.character2CharId)
|
||||
@ -140,12 +140,12 @@ final class LookupGraphTests: XCTestCase {
|
||||
}
|
||||
// 「しっ」の候補が存在するかどうかを確認
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "s", inputStyle: .roman2kana),
|
||||
.init(character: "i", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "a", inputStyle: .roman2kana),
|
||||
.init(character: "i", inputStyle: .roman2kana)
|
||||
.init(value: "s", inputStyle: .systemRomanKana),
|
||||
.init(value: "i", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "a", inputStyle: .systemRomanKana),
|
||||
.init(value: "i", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph)
|
||||
var lookupGraph = LookupGraph.build(input: inputGraph, character2CharId: values.character2CharId)
|
||||
@ -178,11 +178,11 @@ final class LookupGraphTests: XCTestCase {
|
||||
}
|
||||
// ts -> ta
|
||||
let correctGraph = CorrectGraph.build(input: [
|
||||
.init(character: "s", inputStyle: .roman2kana),
|
||||
.init(character: "i", inputStyle: .roman2kana),
|
||||
.init(character: "t", inputStyle: .roman2kana),
|
||||
.init(character: "s", inputStyle: .roman2kana),
|
||||
.init(character: "i", inputStyle: .roman2kana)
|
||||
.init(value: "s", inputStyle: .systemRomanKana),
|
||||
.init(value: "i", inputStyle: .systemRomanKana),
|
||||
.init(value: "t", inputStyle: .systemRomanKana),
|
||||
.init(value: "s", inputStyle: .systemRomanKana),
|
||||
.init(value: "i", inputStyle: .systemRomanKana)
|
||||
])
|
||||
let inputGraph = InputGraph.build(input: correctGraph)
|
||||
var lookupGraph = LookupGraph.build(input: inputGraph, character2CharId: values.character2CharId)
|
||||
@ -216,9 +216,9 @@ final class LookupGraphTests: XCTestCase {
|
||||
return
|
||||
}
|
||||
let correctGraph1 = CorrectGraph.build(input: [
|
||||
.init(character: "た", inputStyle: .direct),
|
||||
.init(character: "い", inputStyle: .direct),
|
||||
.init(character: "か", inputStyle: .direct)
|
||||
.init(value: "た", inputStyle: .systemFlickDirect),
|
||||
.init(value: "い", inputStyle: .systemFlickDirect),
|
||||
.init(value: "か", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
let inputGraph1 = InputGraph.build(input: correctGraph1)
|
||||
var lookupGraph1 = LookupGraph.build(input: inputGraph1, character2CharId: values.character2CharId)
|
||||
@ -227,10 +227,10 @@ final class LookupGraphTests: XCTestCase {
|
||||
_ = lookupGraph1.byfixNodeIndices(in: louds, startGraphNodeIndex: startNodeIndex1 ?? 0)
|
||||
|
||||
let correctGraph2 = CorrectGraph.build(input: [
|
||||
.init(character: "た", inputStyle: .direct),
|
||||
.init(character: "い", inputStyle: .direct),
|
||||
.init(character: "か", inputStyle: .direct),
|
||||
.init(character: "く", inputStyle: .direct) // added
|
||||
.init(value: "た", inputStyle: .systemFlickDirect),
|
||||
.init(value: "い", inputStyle: .systemFlickDirect),
|
||||
.init(value: "か", inputStyle: .systemFlickDirect),
|
||||
.init(value: "く", inputStyle: .systemFlickDirect) // added
|
||||
])
|
||||
let inputGraph2 = InputGraph.build(input: correctGraph2)
|
||||
var lookupGraph2 = LookupGraph.build(input: inputGraph2, character2CharId: values.character2CharId)
|
||||
@ -267,9 +267,9 @@ final class LookupGraphTests: XCTestCase {
|
||||
return
|
||||
}
|
||||
let correctGraph1 = CorrectGraph.build(input: [
|
||||
.init(character: "た", inputStyle: .direct),
|
||||
.init(character: "い", inputStyle: .direct),
|
||||
.init(character: "か", inputStyle: .direct)
|
||||
.init(value: "た", inputStyle: .systemFlickDirect),
|
||||
.init(value: "い", inputStyle: .systemFlickDirect),
|
||||
.init(value: "か", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
let inputGraph1 = InputGraph.build(input: correctGraph1)
|
||||
var lookupGraph1 = LookupGraph.build(input: inputGraph1, character2CharId: values.character2CharId)
|
||||
@ -278,8 +278,8 @@ final class LookupGraphTests: XCTestCase {
|
||||
_ = lookupGraph1.byfixNodeIndices(in: louds, startGraphNodeIndex: startNodeIndex1 ?? 0)
|
||||
|
||||
let correctGraph2 = CorrectGraph.build(input: [
|
||||
.init(character: "た", inputStyle: .direct),
|
||||
.init(character: "い", inputStyle: .direct)
|
||||
.init(value: "た", inputStyle: .systemFlickDirect),
|
||||
.init(value: "い", inputStyle: .systemFlickDirect)
|
||||
])
|
||||
let inputGraph2 = InputGraph.build(input: correctGraph2)
|
||||
var lookupGraph2 = LookupGraph.build(input: inputGraph2, character2CharId: values.character2CharId)
|
||||
|
@ -18,7 +18,7 @@ extension Kana2Kanji {
|
||||
var lookupGraph: LookupGraph
|
||||
var convertGraph: ConvertGraph
|
||||
}
|
||||
func _experimental_all(_ inputData: ComposingText, option: ConvertRequestOptions) -> Result {
|
||||
func _experimental_all(_ inputData: ComposingTextV2, option: ConvertRequestOptions) -> Result {
|
||||
// グラフ構築
|
||||
print(#file, "start")
|
||||
let correctGraph = CorrectGraph.build(input: inputData.input)
|
||||
@ -32,7 +32,7 @@ extension Kana2Kanji {
|
||||
}
|
||||
|
||||
func _experimental_additional(
|
||||
composingText: ComposingText,
|
||||
composingText: ComposingTextV2,
|
||||
additionalInputsStartIndex: Int,
|
||||
previousResult: consuming Result,
|
||||
option: ConvertRequestOptions
|
||||
@ -43,9 +43,27 @@ extension Kana2Kanji {
|
||||
for i in additionalInputsStartIndex ..< composingText.input.endIndex {
|
||||
insertedIndexSet.formUnion(previousResult.correctGraph.update(with: composingText.input[i], index: i, input: composingText.input))
|
||||
}
|
||||
// FIXME: inputGraphの差分ベースの構築は困難なため、普通に構築し直す
|
||||
// MARK: inputGraphの差分ベースの構築は困難なため、普通に構築し直す
|
||||
let inputGraph = InputGraph.build(input: previousResult.correctGraph)
|
||||
// 辞書ルックアップによりconvertGraphを構築
|
||||
// MARK: ここは差分ベース
|
||||
print(#file, "lookup", previousResult.inputGraph)
|
||||
var (lookupGraph, convertGraph, matchInfo) = self.dicdataStore.buildConvertGraphDifferential(inputGraph: inputGraph, cacheLookupGraph: previousResult.lookupGraph, option: option)
|
||||
print(#file, "convert")
|
||||
let result = convertGraph.convertAllDifferential(cacheConvertGraph: previousResult.convertGraph, option: option, dicdataStore: self.dicdataStore, lookupGraphMatchInfo: matchInfo)
|
||||
return Result(endNode: result, correctGraph: previousResult.correctGraph, inputGraph: inputGraph, lookupGraph: lookupGraph, convertGraph: convertGraph)
|
||||
}
|
||||
|
||||
func _experimental_delete(
|
||||
composingText: ComposingTextV2,
|
||||
previousResult: consuming Result,
|
||||
option: ConvertRequestOptions
|
||||
) -> Result {
|
||||
// グラフ構築
|
||||
print(#file, "start")
|
||||
// MARK: この部分の差分ベースの構築は困難なため、普通に構築し直す
|
||||
let correctGraph = CorrectGraph.build(input: composingText.input)
|
||||
let inputGraph = InputGraph.build(input: correctGraph)
|
||||
// MARK: ここから差分ベースにする
|
||||
print(#file, "lookup", previousResult.inputGraph)
|
||||
var (lookupGraph, convertGraph, matchInfo) = self.dicdataStore.buildConvertGraphDifferential(inputGraph: inputGraph, cacheLookupGraph: previousResult.lookupGraph, option: option)
|
||||
print(#file, "convert")
|
||||
@ -77,8 +95,8 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
|
||||
func testBuildConvertGraph_たいかく() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("たいかく", inputStyle: .direct)
|
||||
var c = ComposingTextV2()
|
||||
c.append("たいかく", inputStyle: .systemFlickDirect)
|
||||
let correctGraph = CorrectGraph.build(input: c.input)
|
||||
let inputGraph = InputGraph.build(input: consume correctGraph)
|
||||
let (_, convertGraph) = dicdataStore.buildConvertGraph(inputGraph: inputGraph, option: requestOptions())
|
||||
@ -94,8 +112,8 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
func testConversion_たい() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("たい", inputStyle: .direct)
|
||||
var c = ComposingTextV2()
|
||||
c.append("たい", inputStyle: .systemFlickDirect)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("タイ")) // たい
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("台")) // たい
|
||||
@ -104,8 +122,8 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
func testConversion_いか() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("いか", inputStyle: .direct)
|
||||
var c = ComposingTextV2()
|
||||
c.append("いか", inputStyle: .systemFlickDirect)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("以下")) // いか
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("伊賀")) // いが
|
||||
@ -114,8 +132,8 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
func testConversion_かかく() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("かかく", inputStyle: .direct)
|
||||
var c = ComposingTextV2()
|
||||
c.append("かかく", inputStyle: .systemFlickDirect)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("価格")) // かかく
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("科学")) // かがく
|
||||
@ -126,8 +144,8 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
func testConversion_たいか() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("たいか", inputStyle: .direct)
|
||||
var c = ComposingTextV2()
|
||||
c.append("たいか", inputStyle: .systemFlickDirect)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("対価")) // たいか
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("大河")) // たいが
|
||||
@ -136,8 +154,8 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
func testConversion_たいかく() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("たいかく", inputStyle: .direct)
|
||||
var c = ComposingTextV2()
|
||||
c.append("たいかく", inputStyle: .systemFlickDirect)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("体格")) // たいかく
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("退学")) // たいがく
|
||||
@ -146,16 +164,16 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
func testConversion_むらさき() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("むらさき", inputStyle: .direct)
|
||||
var c = ComposingTextV2()
|
||||
c.append("むらさき", inputStyle: .systemFlickDirect)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("紫")) // むらさき
|
||||
}
|
||||
|
||||
func testBuildConvertGraph_youshouki() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("youshouki", inputStyle: .roman2kana)
|
||||
var c = ComposingTextV2()
|
||||
c.append("youshouki", inputStyle: .systemRomanKana)
|
||||
let correctGraph = CorrectGraph.build(input: c.input)
|
||||
let inputGraph = InputGraph.build(input: consume correctGraph)
|
||||
let (_, convertGraph) = dicdataStore.buildConvertGraph(inputGraph: inputGraph, option: requestOptions())
|
||||
@ -171,8 +189,8 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
func testConversion_youshouki() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("youshouki", inputStyle: .roman2kana)
|
||||
var c = ComposingTextV2()
|
||||
c.append("youshouki", inputStyle: .systemRomanKana)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("幼少期")) // ようしょうき
|
||||
}
|
||||
@ -181,14 +199,14 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
do {
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("みらいえいが", inputStyle: .direct)
|
||||
var c = ComposingTextV2()
|
||||
c.append("みらいえいが", inputStyle: .systemFlickDirect)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("未来映画"))
|
||||
}
|
||||
do {
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("miraieiga", inputStyle: .roman2kana)
|
||||
var c = ComposingTextV2()
|
||||
c.append("miraieiga", inputStyle: .systemRomanKana)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("未来映画"))
|
||||
}
|
||||
@ -198,32 +216,32 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
do {
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("sitta", inputStyle: .roman2kana)
|
||||
var c = ComposingTextV2()
|
||||
c.append("sitta", inputStyle: .systemRomanKana)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("知った"))
|
||||
}
|
||||
do {
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("unda", inputStyle: .roman2kana)
|
||||
var c = ComposingTextV2()
|
||||
c.append("unda", inputStyle: .systemRomanKana)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("産んだ"))
|
||||
}
|
||||
do {
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("ixtsuta", inputStyle: .roman2kana)
|
||||
var c = ComposingTextV2()
|
||||
c.append("ixtsuta", inputStyle: .systemRomanKana)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("言った"))
|
||||
}
|
||||
do {
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("its", inputStyle: .roman2kana)
|
||||
var c = ComposingTextV2()
|
||||
c.append("its", inputStyle: .systemRomanKana)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("いた"))
|
||||
}
|
||||
do {
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("itsi", inputStyle: .roman2kana)
|
||||
var c = ComposingTextV2()
|
||||
c.append("itsi", inputStyle: .systemRomanKana)
|
||||
let result = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(result.endNode.joinedPrevs().contains("痛い"))
|
||||
}
|
||||
@ -232,12 +250,12 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
func testConversion_incremental_たい() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("たい", inputStyle: .direct)
|
||||
var c = ComposingTextV2()
|
||||
c.append("たい", inputStyle: .systemFlickDirect)
|
||||
let firstResult = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(firstResult.endNode.joinedPrevs().contains("タイ")) // たい
|
||||
XCTAssertTrue(firstResult.endNode.joinedPrevs().contains("台")) // たい
|
||||
c.insertAtCursorPosition("こ", inputStyle: .direct)
|
||||
c.append("こ", inputStyle: .systemFlickDirect)
|
||||
let secondResult = kana2kanji._experimental_additional(
|
||||
composingText: c,
|
||||
additionalInputsStartIndex: 2,
|
||||
@ -246,7 +264,7 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
)
|
||||
XCTAssertTrue(secondResult.endNode.joinedPrevs().contains("太鼓")) // たいこ
|
||||
XCTAssertTrue(secondResult.endNode.joinedPrevs().contains("太古")) // たいこ
|
||||
c.insertAtCursorPosition("く", inputStyle: .direct)
|
||||
c.append("く", inputStyle: .systemFlickDirect)
|
||||
let thirdResult = kana2kanji._experimental_additional(
|
||||
composingText: c,
|
||||
additionalInputsStartIndex: 3,
|
||||
@ -254,16 +272,25 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
option: requestOptions()
|
||||
)
|
||||
XCTAssertTrue(thirdResult.endNode.joinedPrevs().contains("大国")) // たいこく
|
||||
c.removeLast()
|
||||
let forthResult = kana2kanji._experimental_delete(
|
||||
composingText: c,
|
||||
previousResult: thirdResult,
|
||||
option: requestOptions()
|
||||
)
|
||||
XCTAssertTrue(secondResult.endNode.joinedPrevs().contains("太鼓")) // たいこ
|
||||
XCTAssertTrue(secondResult.endNode.joinedPrevs().contains("太古")) // たいこ
|
||||
XCTAssertFalse(forthResult.endNode.joinedPrevs().contains("大国")) // たいこく
|
||||
}
|
||||
|
||||
func testConversion_incremental_intai() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("i", inputStyle: .roman2kana)
|
||||
var c = ComposingTextV2()
|
||||
c.append("i", inputStyle: .systemRomanKana)
|
||||
let firstResult = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(firstResult.endNode.joinedPrevs().contains("胃")) // い
|
||||
c.insertAtCursorPosition("n", inputStyle: .roman2kana)
|
||||
c.append("n", inputStyle: .systemRomanKana)
|
||||
let secondResult = kana2kanji._experimental_additional(
|
||||
composingText: c,
|
||||
additionalInputsStartIndex: 1,
|
||||
@ -271,7 +298,7 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
option: requestOptions()
|
||||
)
|
||||
print(secondResult.endNode.joinedPrevs())
|
||||
c.insertAtCursorPosition("t", inputStyle: .roman2kana)
|
||||
c.append("t", inputStyle: .systemRomanKana)
|
||||
let thirdResult = kana2kanji._experimental_additional(
|
||||
composingText: c,
|
||||
additionalInputsStartIndex: 2,
|
||||
@ -279,7 +306,7 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
option: requestOptions()
|
||||
)
|
||||
print(thirdResult.endNode.joinedPrevs())
|
||||
c.insertAtCursorPosition("a", inputStyle: .roman2kana)
|
||||
c.append("a", inputStyle: .systemRomanKana)
|
||||
let forthResult = kana2kanji._experimental_additional(
|
||||
composingText: c,
|
||||
additionalInputsStartIndex: 3,
|
||||
@ -287,7 +314,7 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
option: requestOptions()
|
||||
)
|
||||
XCTAssertTrue(forthResult.endNode.joinedPrevs().contains("インタ")) // インタ
|
||||
c.insertAtCursorPosition("i", inputStyle: .roman2kana)
|
||||
c.append("i", inputStyle: .systemRomanKana)
|
||||
let fifthResult = kana2kanji._experimental_additional(
|
||||
composingText: c,
|
||||
additionalInputsStartIndex: 4,
|
||||
@ -300,11 +327,11 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
func testConversion_incremental_intsi() throws {
|
||||
let dicdataStore = DicdataStore(requestOptions: requestOptions())
|
||||
let kana2kanji = Kana2Kanji(dicdataStore: dicdataStore)
|
||||
var c = ComposingText()
|
||||
c.insertAtCursorPosition("i", inputStyle: .roman2kana)
|
||||
var c = ComposingTextV2()
|
||||
c.append("i", inputStyle: .systemRomanKana)
|
||||
let firstResult = kana2kanji._experimental_all(c, option: requestOptions())
|
||||
XCTAssertTrue(firstResult.endNode.joinedPrevs().contains("胃")) // い
|
||||
c.insertAtCursorPosition("n", inputStyle: .roman2kana)
|
||||
c.append("n", inputStyle: .systemRomanKana)
|
||||
let secondResult = kana2kanji._experimental_additional(
|
||||
composingText: c,
|
||||
additionalInputsStartIndex: 1,
|
||||
@ -312,7 +339,7 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
option: requestOptions()
|
||||
)
|
||||
// XCTAssertTrue(secondResult.endNode.joinedPrevs().contains("胃n")) // in
|
||||
c.insertAtCursorPosition("t", inputStyle: .roman2kana)
|
||||
c.append("t", inputStyle: .systemRomanKana)
|
||||
let thirdResult = kana2kanji._experimental_additional(
|
||||
composingText: c,
|
||||
additionalInputsStartIndex: 2,
|
||||
@ -320,7 +347,7 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
option: requestOptions()
|
||||
)
|
||||
// XCTAssertTrue(thirdResult.endNode.joinedPrevs().contains("インt")) // int
|
||||
c.insertAtCursorPosition("s", inputStyle: .roman2kana)
|
||||
c.append("s", inputStyle: .systemRomanKana)
|
||||
let forthResult = kana2kanji._experimental_additional(
|
||||
composingText: c,
|
||||
additionalInputsStartIndex: 3,
|
||||
@ -328,7 +355,7 @@ final class ExperimentalConversionTests: XCTestCase {
|
||||
option: requestOptions()
|
||||
)
|
||||
XCTAssertTrue(forthResult.endNode.joinedPrevs().contains("インタ")) // インタ
|
||||
c.insertAtCursorPosition("i", inputStyle: .roman2kana)
|
||||
c.append("i", inputStyle: .systemRomanKana)
|
||||
let fifthResult = kana2kanji._experimental_additional(
|
||||
composingText: c,
|
||||
additionalInputsStartIndex: 4,
|
||||
|
Reference in New Issue
Block a user