-
Notifications
You must be signed in to change notification settings - Fork 0
/
verbaladjectives.jl
109 lines (84 loc) · 2.26 KB
/
verbaladjectives.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
98
99
100
101
102
103
104
105
106
107
108
109
"""Verbal adjectives have gender, case and number."""
struct GMFVerbalAdjective <: GreekMorphologicalForm
vagender::GMPGender
vacase::GMPCase
vanumber::GMPNumber
end
"""Extract gender property from `vadj`.
$(SIGNATURES)
"""
function gmpGender(vadj::GMFVerbalAdjective)
vadj.vagender
end
"""Extract case property from `vadj`.
$(SIGNATURES)
"""
function gmpCase(vadj::GMFVerbalAdjective)
vadj.vacase
end
"""Extract number property from `vadj`.
$(SIGNATURES)
"""
function gmpNumber(vadj::GMFVerbalAdjective)
vadj.vanumber
end
"""Verbal adjective forms are citable by Cite2Urn"""
CitableTrait(::Type{GMFVerbalAdjective}) = CitableByCite2Urn()
"""Compose a label for a `GMFVerbalAdjective`
$(SIGNATURES)
"""
function label(vadj::GMFVerbalAdjective)
join(["verbal adjective:", label(vadj.vagender), label(vadj.vacase), label(vadj.vanumber)], " ")
end
"""Compose a digital code for `vadj`.
$(SIGNATURES)
"""
function code(vadj::GMFVerbalAdjective)
# PosPNTMVGCDCat
string(VERBALADJECTIVE,"0",code(vadj.vanumber),"000",code(vadj.vagender), code(vadj.vacase),"00")
end
"""Compose a Cite2Urn for a `GMFVerbalAdjective`.
$(SIGNATURES)
"""
function urn(vadj::GMFVerbalAdjective)
# PosPNTMVGCDCat
Cite2Urn(BASE_MORPHOLOGY_URN * code(vadj))
end
"""Create a `GMFVerbalAdjective` from a string value.
$(SIGNATURES)
"""
function gmfVerbalAdjective(code::AbstractString)
morphchars = split(code, "")
vagender = gmpGender(parse(Int64, morphchars[7]))
vacase = gmpCase(parse(Int64, morphchars[8]))
vanumber = gmpNumber(parse(Int64, morphchars[3]))
GMFVerbalAdjective(
vagender,
vacase,
vanumber
)
end
"""Create a `GMFVerbalAdjective` from a `Cite2Urn`.
$(SIGNATURES)
"""
function gmfVerbalAdjective(urn::Cite2Urn)
gmfVerbalAdjective(objectcomponent(urn))
end
"""Create a `GMFVerbalAdjective` from a `FormUrn`.
$(SIGNATURES)
"""
function gmfVerbalAdjective(f::FormUrn)
gmfVerbalAdjective(f.objectid)
end
"""Create a `GMFVerbalAdjective` from an `Analysis`.
$(SIGNATURES)
"""
function gmfVerbalAdjective(a::Analysis)
gmfVerbalAdjective(a.form)
end
"""Compose a `FormUrn` for an `GMFVerbalAdjective`.
$(SIGNATURES)
"""
function formurn(vadj::GMFVerbalAdjective)
FormUrn("$(COLLECTION_ID)." * code(vadj))
end