This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -d '{ | |
"id": "1", | |
"jsonrpc": "2.0", | |
"method": "GetTransactionStatus", | |
"params": ["<YOUR_TRANSACTION_HASH_WITHOUT_LEADING_0x_CHARS_GOES_HERE>"] | |
}' -H "Content-Type: application/json" -X POST "https://api.zilliqa.com/" | python -m json.tool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ScanJob { | |
let runContext: RunContext | |
} | |
// MARK: Job | |
extension ScanJob: CacheableJob { | |
typealias Input = RunContext | |
typealias Output = ScannedLines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol CacheableJob: Job where Output: Codable { | |
var runContext: RunContext { get } | |
var fileName: String { get } | |
func newWork(input: Input) throws -> Output | |
func validateCached(_ cached: Output) throws | |
} | |
struct CachedJob<CachedData>: Codable where CachedData: Codable { | |
let fileNameOfInputCorpus: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func createWordList() throws { | |
let pipeline = Pipeline { | |
ScanJob() | |
ParseJob() | |
WordLengthJob() | |
WhitelistedPOSTagsJob() | |
HomonymJob() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MARK: FunctionBuilder | |
@_functionBuilder | |
struct BuildPipeline { | |
static func buildBlock<A>(_ a: A) -> Pipeline<A.Input, A.Output> | |
where | |
A: Job | |
{ | |
Pipeline(description: descriptionOf(jobs: [a])) { input in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Pipeline<Input, Output>: Job, CustomStringConvertible { | |
let description: String | |
private let _getOutput: (Input) throws -> Output | |
init(description: String, _ getOutput: @escaping (Input) throws -> Output) { | |
self.description = description | |
self._getOutput = getOutput | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precedencegroup Pipe { | |
higherThan: DefaultPrecedence | |
associativity: left | |
assignment: true | |
} | |
infix operator |>: Pipe | |
func |> <J>(input: J.Input, job: J) throws -> J.Output where J: Job { | |
try job.work(input: input) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Job { | |
associatedtype Input | |
associatedtype Output | |
func work(input: Input) throws -> Output | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol LineFromCorpusConvertible: CustomStringConvertible, Codable { | |
/// The word, on lowercased form | |
var wordForm: WordForm { get } | |
/// Part of speech tag, only first major tag, .e.g from line `han PN.UTR.SIN.DEF.SUB`, we only save `PN` | |
var partOfSpeechTag: PartOfSpeech { get } | |
/// Base form(s) of word | |
var lemgrams: Lemgrams { get } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// A line which word has suitable length | |
struct WordLengthLine: LineFromCorpusFromLine, Hashable { | |
typealias FromLine = ParsedLine | |
let line: FromLine | |
} |