-
Notifications
You must be signed in to change notification settings - Fork 0
/
infinitives.jl
98 lines (71 loc) · 1.82 KB
/
infinitives.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
"""Infinitive verbs have tense and voice."""
struct GMFInfinitive <: GreekMorphologicalForm
tense::GMPTense
voice::GMPVoice
end
"""Infinitive forms are citable by Cite2Urn"""
CitableTrait(::Type{GMFInfinitive}) = CitableByCite2Urn()
"""Extract tense value from `inf`.
$(SIGNATURES)
"""
function gmpTense(inf::GMFInfinitive)
inf.tense
end
"""Extract voice value from `inf`.
$(SIGNATURES)
"""
function gmpVoice(inf::GMFInfinitive)
inf.voice
end
"""Create an `GMFInfinitive` from a string value.
$(SIGNATURES)
"""
function gmfInfinitive(code::AbstractString)
morphchars = split(code, "")
tense = gmpTense(parse(Int64, morphchars[4]))
voice = gmpVoice(parse(Int64, morphchars[6]) )
GMFInfinitive(tense, voice)
end
"""Create an `GMFInfinitive` from a `Cite2Urn`.
$(SIGNATURES)
"""
function gmfInfinitive(urn::Cite2Urn)
gmfInfinitive(objectcomponent(urn))
end
"""Create an `GMFInfinitive` from a `FormUrn`.
$(SIGNATURES)
"""
function gmfInfinitive(f::FormUrn)
gmfInfinitive(f.objectid)
end
"""Create an `GMFInfinitive` from an `Analysis`.
$(SIGNATURES)
"""
function gmfInfinitive(a::Analysis)
gmfInfinitive(a.form)
end
"""Compose a digital code for `inf`.
$(SIGNATURES)
"""
function code(inf::GMFInfinitive)
# PosPNTMVGCDCat
string(INFINITIVE, "00" , code(inf.tense), "0", code(inf.voice), "0000")
end
"""Compose a `FormUrn` for an `GMFInfinitive`.
$(SIGNATURES)
"""
function formurn(infinitive::GMFInfinitive)
FormUrn("$(COLLECTION_ID)." * code(infinitive))
end
"""Compose a label for an `GMFInfinitive`.
$(SIGNATURES)
"""
function label(inf::GMFInfinitive)
join(["infinitive:", label(inf.tense), label(inf.voice)]," ")
end
"""Compose a Cite2Urn for an `GMFInfinitive`.
$(SIGNATURES)
"""
function urn(inf::GMFInfinitive)
Cite2Urn(string(BASE_MORPHOLOGY_URN, code(inf)))
end