Skip to content

Commit

Permalink
Merge pull request #364 from neelsmith/dev
Browse files Browse the repository at this point in the history
Regularize function names
  • Loading branch information
neelsmith authored Aug 21, 2023
2 parents d94ee68 + 91835f4 commit b9175eb
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 227 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Kanones"
uuid = "107500f9-53d4-4696-8485-0747242ad8bc"
authors = ["nsmith"]
version = "0.19.0"
version = "0.20.0"

[deps]
AtticGreek = "330c8319-f7ed-461a-8c52-cee5da4c0892"
Expand Down
2 changes: 1 addition & 1 deletion pluto/synopses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repo = pwd() |> dirname
ds = Kanones.coredata(repo; atticonly = true)

# ╔═╡ adc67d81-a8ce-4453-94ba-1f95eebcff06
md_synopsis(verbu, ds, gmpPerson("third"), gmpNumber("singular")) |> Markdown.parse
synopsis_md(verbu, ds, gmpPerson("third"), gmpNumber("singular")) |> Markdown.parse

# ╔═╡ Cell order:
# ╠═bbd87e01-007e-4adc-82ab-4d8face91fbc
Expand Down
20 changes: 7 additions & 13 deletions src/Kanones.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import CitableParserBuilder: CanParseCitable
import CitableParserBuilder: lexeme
import CitableParserBuilder: lexemes



export KanonesParser
export parsetoken, parsewordlist, parsecorpus, parsedocument

Expand Down Expand Up @@ -84,16 +82,14 @@ export lemmatadict, lemmalabel

export resolvestring, knormal
export generate, analysis_string
export decline, md_declension
export md_ptcpldeclension, participleslashline
export md_3endingadj
export synopsis, md_synopsis
export md_conjugation, md_imperativeconjugation
export md_proofconjugation_deponent, mdfile_proofconjugation_deponent
export md_proofconjugation, mdfile_proofconjugation
export verb_conjugation_md
export principalparts

export principalparts
export decline, declension_md
export ptcpldeclension_md, participleslashline
export three_ending_adj_md
export synopsis, synopsis_md
export conjugation_md, imperativeconjugation_md
export verb_conjugation_md

export writecsv

Expand Down Expand Up @@ -208,10 +204,8 @@ include("parser/stringparser.jl")
include("parser/dfparser.jl")
include("parser/perfilebuilder.jl")


include("dfparser/survey.jl")


include("inflectionclasses/inflclasses.jl")

include("orthography/literarygreek.jl")
Expand Down
5 changes: 1 addition & 4 deletions src/forapps/adjdeclensions.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@



"""Compose markdown table with a declension of a single noun.
$(SIGNATURES)
"""
function md_3endingadj(lex::LexemeUrn, degree::GMPDegree, kd::Kanones.FilesDataset)
function three_ending_adj_md(lex::LexemeUrn, degree::GMPDegree, kd::Kanones.FilesDataset)
stemmatches = filter(s -> lexeme(s) == lex, stemsarray(kd))
if isempty(stemmatches)
throw(DomainError("No stems found for lexeme $(lex)"))
Expand Down
87 changes: 0 additions & 87 deletions src/forapps/analyses.jl
Original file line number Diff line number Diff line change
@@ -1,60 +1,6 @@
FOLIO_BASE_URL = "http://folio2.furman.edu/lsj/?urn=urn:cite2:hmt:lsj.chicago_md:"


"""Download dictionary of labelling lemmata for manually validated LSJ data set.
$(SIGNATURES)
"""
function lsjdict()::Dict{String,String}
@info("Downloading dictionary of lemmata for `lsj` dataset...")
lsjurl = "https://raw.githubusercontent.com/neelsmith/Kanones.jl/dev/datasets/lsj-vocab/lexemes/lsj.cex"
lsjstr = Downloads.download(lsjurl) |> read |> String
lsjlines = split(lsjstr, "\n")

dict = Dict{String, String}()

#p(readlines(f)) do ln
for ln in lsjlines[2:end]
cols = split(ln, "|")
if length(cols) == 2
id = LexemeUrn(cols[1]).objectid |> string
dict[id] = cols[2] |> string
end
end
dict
end


"""Download dictionary of labelling lemmata for lexemes in `lsjx` dataset.
$(SIGNATURES)
"""
function lsjxdict()::Dict{String,String}
@info("Downloading dictionary of lemmata for `lsjx` dataset...")
lsjxurl = "https://raw.githubusercontent.com/neelsmith/Kanones.jl/dev/datasets/lsj-vocab/lexemes/lsjx.cex"
lsjxstr = Downloads.download(lsjxurl) |> read |> String
lsjxlines = split(lsjxstr, "\n")

dict = Dict{String, String}()

#p(readlines(f)) do ln
for ln in lsjxlines[2:end]
cols = split(ln, "|")
if length(cols) == 2
id = LexemeUrn(cols[1]).objectid |> string
dict[id] = cols[2] |> string
end
end
dict
end




"""
"""
function lemmatadict()::Dict{String, String}
merge(lsjdict(), lsjxdict())
end

"""Format a markdown string representing an analyzed token and its morphological analyses.
$(SIGNATURES)
"""
Expand All @@ -75,8 +21,6 @@ function md_analysis(txt::AbstractString, alist::Vector{Analysis}; registry = no
txt = txt * "⚠️"
end



dict = isnothing(registry) ? lemmatadict() : registry
lex_ids = map(alist) do a
a.lexeme.objectid
Expand All @@ -98,34 +42,3 @@ function md_analysis(txt::AbstractString, alist::Vector{Analysis}; registry = no
end
end
end
#=
astring = join(alabels,"; **or** ")
coll_list = map(alist) do a
a.lexeme.collection
end |> unique
if "lsjx" in coll_list
txt = txt * "⚠️"
end
lex_ids = map(alist) do a
a.lexeme.objectid
end |> unique
lex_links = map(lex_ids) do l
lemma = string("**", lemmataDict[l], "**")
string("[", lemma, "](", fubase, l, ")")
end
lsj = join(lex_links," **or** ")
push!(strs, "- **$(txt)**. $(astring) (*See LSJ: $(lsj)*)")
end
end
Markdown.parse(join(strs, "\n"))
=#
32 changes: 16 additions & 16 deletions src/forapps/conjugation_deponents.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

function md_conjugation_deponent(t::GMPTense, v::GMPVoice, lex::LexemeUrn, ruleset::Vector{Rule}, stemset::Vector{Stem}, orthography::GreekOrthography)

function conjugation_md_deponent(t::GMPTense, v::GMPVoice, lex::LexemeUrn, ruleset::Vector{Rule}, stemset::Vector{Stem}, orthography::GreekOrthography)

tenseforms = filter(f -> gmpTense(f) == t && gmpVoice(f) == v, deponentverbforms())


mdlines = ["| | Indicative | Subjunctive | Optative |",
"| --- | --- | --- | --- |"]
Expand Down Expand Up @@ -67,7 +66,7 @@ end
"""Compose markdown table with imperative conjugation of `lex`.
$(SIGNATURES)
"""
function md_imperativeconjugation_deponent(t::GMPTense, v::GMPVoice, lex::LexemeUrn, ruleset::Vector{Rule}, stemset::Vector{Stem}, orthography::GreekOrthography)
function imperativeconjugation_md_deponent(t::GMPTense, v::GMPVoice, lex::LexemeUrn, ruleset::Vector{Rule}, stemset::Vector{Stem}, orthography::GreekOrthography)
mdlines = ["| | Singular | Plural|",
"| --- | --- | --- |"]
imptvforms = filter(f -> f isa GMFFiniteVerb && gmpMood(f) == gmpMood("imperative") && gmpVoice(f) != gmpVoice("active"), allforms())
Expand Down Expand Up @@ -116,18 +115,18 @@ function participleslashline_deponent(
end



#=
function proofpresent_deponent(lex::LexemeUrn, ruleset::Vector{Rule}, stemset::Vector{Stem}, orthography::GreekOrthography)
presfinites = [
"## Present tense",
"*Middle/passive*",
md_conjugation(gmpTense("present"), gmpVoice("passive"), lex, ruleset, stemset, orthography),
conjugation_md(gmpTense("present"), gmpVoice("passive"), lex, ruleset, stemset, orthography),
"### Imperative",
"*Middle/passive*",
md_imperativeconjugation(gmpTense("present"), gmpVoice("passive"), lex, ruleset, stemset, orthography)
imperativeconjugation_md(gmpTense("present"), gmpVoice("passive"), lex, ruleset, stemset, orthography)
]
vadj = GMFVerbalAdjective(
Expand Down Expand Up @@ -159,7 +158,7 @@ function proofpresent_deponent(lex::LexemeUrn, ruleset::Vector{Rule}, stemset::V
"## Imperfect",
"*Middle/passive*",
md_conjugation(gmpTense("imperfect"), gmpVoice("passive"), lex, ruleset, stemset, orthography)
conjugation_md(gmpTense("imperfect"), gmpVoice("passive"), lex, ruleset, stemset, orthography)
]
Expand All @@ -174,8 +173,8 @@ function prooffuture_deponent(lex::LexemeUrn,ruleset::Vector{Rule}, stemset::Vec
"## Future tense",
"*Middle*",
md_conjugation(gmpTense("future"), gmpVoice("middle"), lex, ruleset, stemset, orthography),"*Passive*",
md_conjugation(gmpTense("future"), gmpVoice("passive"), lex, ruleset, stemset, orthography),
conjugation_md(gmpTense("future"), gmpVoice("middle"), lex, ruleset, stemset, orthography),"*Passive*",
conjugation_md(gmpTense("future"), gmpVoice("passive"), lex, ruleset, stemset, orthography),
]
Expand Down Expand Up @@ -211,15 +210,15 @@ function proofaorist_deponent(lex::LexemeUrn, ruleset::Vector{Rule}, stemset::Ve
"## Aorist tense",
"*Middle voice*",
md_conjugation(gmpTense("aorist"), gmpVoice("middle"), lex, ruleset, stemset, orthography),
conjugation_md(gmpTense("aorist"), gmpVoice("middle"), lex, ruleset, stemset, orthography),
"*Passive voice*",
md_conjugation(gmpTense("aorist"), gmpVoice("passive"), lex, ruleset, stemset, orthography),
conjugation_md(gmpTense("aorist"), gmpVoice("passive"), lex, ruleset, stemset, orthography),
"### Imperative",
"*Middle voice*",
md_imperativeconjugation(gmpTense("aorist"), gmpVoice("middle"), lex, ruleset, stemset, orthography),
imperativeconjugation_md(gmpTense("aorist"), gmpVoice("middle"), lex, ruleset, stemset, orthography),
"*Passive voice*",
md_imperativeconjugation(gmpTense("aorist"), gmpVoice("passive"), lex, ruleset, stemset, orthography),
imperativeconjugation_md(gmpTense("aorist"), gmpVoice("passive"), lex, ruleset, stemset, orthography),
]
Expand Down Expand Up @@ -254,7 +253,7 @@ function proofperfect_deponent(lex::LexemeUrn, ruleset::Vector{Rule}, stemset::V
"### Perfect tense",
"*Middle and passive voices*",
md_conjugation(gmpTense("perfect"), gmpVoice("passive"), lex, ruleset, stemset, orthography)
conjugation_md(gmpTense("perfect"), gmpVoice("passive"), lex, ruleset, stemset, orthography)
]
mpptcpl = participleslashline(lex, gmpTense("perfect"), gmpVoice("middle"), ruleset, stemset, orthography)
Expand All @@ -268,7 +267,7 @@ function proofperfect_deponent(lex::LexemeUrn, ruleset::Vector{Rule}, stemset::V
"### Pluperfect tense",
"*Middle and passive voices*",
md_conjugation(gmpTense("pluperfect"), gmpVoice("passive"), lex, ruleset, stemset, orthography)
conjugation_md(gmpTense("pluperfect"), gmpVoice("passive"), lex, ruleset, stemset, orthography)
]
join(finites,"\n\n") * "\n\n" * join(nominals,"\n") * "\n\n" * join(plupft, "\n\n")
Expand Down Expand Up @@ -306,3 +305,4 @@ function mdfile_proofconjugation_deponent(lex::LexemeUrn, kds::T, f = "scratch/p
write(io, md)
end
end
=#
Loading

0 comments on commit b9175eb

Please sign in to comment.