2022-01-17 22:36:58 +01:00
|
|
|
using Pkg
|
|
|
|
Pkg.activate(@__DIR__)
|
|
|
|
using DelimitedFiles
|
|
|
|
using JSON
|
|
|
|
|
|
|
|
include(joinpath(@__DIR__, "parse_presentations.jl"))
|
|
|
|
include(joinpath(@__DIR__, "smallhyperbolicgrp.jl"))
|
|
|
|
|
|
|
|
all_grps_presentations =
|
|
|
|
let tables = [
|
|
|
|
joinpath(@__DIR__, f) for f in readdir(@__DIR__) if
|
|
|
|
isfile(joinpath(@__DIR__, f)) && endswith(f, ".txt")
|
|
|
|
]
|
|
|
|
mapreduce(parse_grouppresentations_abstract, union, tables) |> Dict
|
|
|
|
end
|
|
|
|
|
|
|
|
tr_grps =
|
|
|
|
let csvs = [
|
|
|
|
joinpath(@__DIR__, f) for f in readdir(@__DIR__) if
|
|
|
|
isfile(joinpath(@__DIR__, f)) && endswith(f, ".csv")
|
|
|
|
]
|
|
|
|
|
2022-01-18 02:19:50 +01:00
|
|
|
trGrps = mapreduce(union, csvs) do file
|
|
|
|
m = match(r".*_(\d)_(\d)_(\d).csv", basename(file))
|
|
|
|
@assert !isnothing(m)
|
|
|
|
type = parse.(Int, tuple(m[1], m[2], m[3]))
|
|
|
|
|
2022-01-17 22:36:58 +01:00
|
|
|
data = readdlm(file, '&')
|
|
|
|
labels = Symbol.(replace.(strip.(data[1, :]), ' ' => '_', '-' => '_'))
|
|
|
|
groups = data[2:end, :]
|
|
|
|
grps = map(enumerate(eachrow(groups))) do (i, props)
|
|
|
|
nt = (; (Symbol(l) => v for (l, v) in zip(labels, props))...)
|
|
|
|
@debug i, grp_name(nt)
|
|
|
|
P = all_grps_presentations[grp_name(nt)]
|
2022-01-18 02:19:50 +01:00
|
|
|
grp = TriangleGrp(type, P.generators, P.relations, nt)
|
|
|
|
end
|
|
|
|
end
|
2022-01-17 22:36:58 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
open(joinpath(@__DIR__, "triangle_groups.json"), "w") do io
|
2022-01-18 02:19:50 +01:00
|
|
|
f(args...) = show_json(args...; indent = 4)
|
|
|
|
s = sprint(f, TriangleGrpSerialization(), tr_grps)
|
|
|
|
# JSON.print(io, , 4)
|
|
|
|
print(io, s)
|
2022-01-17 22:36:58 +01:00
|
|
|
end
|