Skip to content

Commit

Permalink
Merge branch 'develop' into tools/ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ensan-hcl committed Feb 20, 2024
2 parents 6d6765e + 23b1d0b commit 65a6ef8
Show file tree
Hide file tree
Showing 7 changed files with 983 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ jobs:
- uses: swift-actions/setup-swift@150267bf6ba01f9d942a4bd55aa2f35ba586767d
with:
swift-version: "5.9"
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Build
run: swift build -Xswiftc -strict-concurrency=complete -v
- name: Run tests
run: swift test -Xswiftc -strict-concurrency=complete -v
run: swift test -c release -Xswiftc -strict-concurrency=complete -v
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Sources/KanaKanjiConverterModuleWithDefaultDictionary/azooKey_dictionary_storage"]
path = Sources/KanaKanjiConverterModuleWithDefaultDictionary/azooKey_dictionary_storage
url = https://github.com/ensan-hcl/azooKey_dictionary_storage
25 changes: 25 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ let package = Package(
name: "SwiftUtils",
targets: ["SwiftUtils"]
),
/// デフォルト辞書データを含むバージョンの辞書モジュール
.library(
name: "KanaKanjiConverterModuleWithDefaultDictionary",
targets: ["KanaKanjiConverterModuleWithDefaultDictionary"]
),
/// 辞書データを含まないバージョンの辞書モジュール
.library(
name: "KanaKanjiConverterModule",
targets: ["KanaKanjiConverterModule"]
Expand Down Expand Up @@ -51,6 +57,20 @@ let package = Package(
resources: [],
swiftSettings: swiftSettings
),
.target(
name: "KanaKanjiConverterModuleWithDefaultDictionary",
dependencies: [
"KanaKanjiConverterModule"
],
exclude: [
"azooKey_dictionary_storage/README.md",
"azooKey_dictionary_storage/LICENSE",
],
resources: [
.copy("azooKey_dictionary_storage/Dictionary"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "SwiftUtilsTests",
dependencies: ["SwiftUtils"],
Expand All @@ -64,6 +84,11 @@ let package = Package(
.copy("DictionaryMock")
],
swiftSettings: swiftSettings
),
.testTarget(
name: "KanaKanjiConverterModuleWithDefaultDictionaryTests",
dependencies: ["KanaKanjiConverterModuleWithDefaultDictionary"],
swiftSettings: swiftSettings
)
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@_exported import KanaKanjiConverterModule
import Foundation

public extension ConvertRequestOptions {
static func withDefaultDictionary(
N_best: Int = 10,
requireJapanesePrediction: Bool,
requireEnglishPrediction: Bool,
keyboardLanguage: KeyboardLanguage,
typographyLetterCandidate: Bool = false,
unicodeCandidate: Bool = true,
englishCandidateInRoman2KanaInput: Bool = false,
fullWidthRomanCandidate: Bool = false,
halfWidthKanaCandidate: Bool = false,
learningType: LearningType,
maxMemoryCount: Int = 65536,
shouldResetMemory: Bool = false,
memoryDirectoryURL: URL,
sharedContainerURL: URL,
textReplacer: TextReplacer = TextReplacer(),
metadata: ConvertRequestOptions.Metadata
) -> Self {
#if os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
let dictionaryDirectory = Bundle.module.bundleURL.appendingPathComponent("Dictionary", isDirectory: true)
#elseif os(macOS)
let dictionaryDirectory = Bundle.module.resourceURL!.appendingPathComponent("Dictionary", isDirectory: true)
#else
let dictionaryDirectory = Bundle.module.resourceURL!.appendingPathComponent("Dictionary", isDirectory: true)
#endif
return Self(
N_best: N_best,
requireJapanesePrediction: requireJapanesePrediction,
requireEnglishPrediction: requireEnglishPrediction,
keyboardLanguage: keyboardLanguage,
typographyLetterCandidate: typographyLetterCandidate,
unicodeCandidate: unicodeCandidate,
englishCandidateInRoman2KanaInput: englishCandidateInRoman2KanaInput,
fullWidthRomanCandidate: fullWidthRomanCandidate,
halfWidthKanaCandidate: halfWidthKanaCandidate,
learningType: learningType,
maxMemoryCount: maxMemoryCount,
shouldResetMemory: shouldResetMemory,
dictionaryResourceURL: dictionaryDirectory,
memoryDirectoryURL: memoryDirectoryURL,
sharedContainerURL: sharedContainerURL,
textReplacer: textReplacer,
metadata: metadata
)
}
}
Loading

0 comments on commit 65a6ef8

Please sign in to comment.