commit
b460439484
@ -1,5 +1,3 @@
|
|||||||
__precompile__()
|
|
||||||
|
|
||||||
module Flux
|
module Flux
|
||||||
|
|
||||||
# Zero Flux Given
|
# Zero Flux Given
|
||||||
|
@ -14,7 +14,7 @@ getfile(r, name) = r.files[findfirst(x -> x.name == name, r.files)]
|
|||||||
|
|
||||||
function getfile(name)
|
function getfile(name)
|
||||||
r = ZipFile.Reader(deps("sentiment.zip"))
|
r = ZipFile.Reader(deps("sentiment.zip"))
|
||||||
text = readstring(getfile(r, "trees/$name"))
|
text = read(getfile(r, "trees/$name"), String)
|
||||||
close(r)
|
close(r)
|
||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
@ -29,12 +29,12 @@ function parsetree(s)
|
|||||||
s = replace(s, r"\$", s -> "\\\$")
|
s = replace(s, r"\$", s -> "\\\$")
|
||||||
s = replace(s, r"[^\s\(\)]+", s -> "\"$s\"")
|
s = replace(s, r"[^\s\(\)]+", s -> "\"$s\"")
|
||||||
s = replace(s, " ", ", ")
|
s = replace(s, " ", ", ")
|
||||||
return totree(parse(s))
|
return totree(Meta.parse(s))
|
||||||
end
|
end
|
||||||
|
|
||||||
function gettrees(name)
|
function gettrees(name)
|
||||||
load()
|
load()
|
||||||
ss = split(getfile("$name.txt"), '\n', keep = false)
|
ss = split(getfile("$name.txt"), '\n', keepempty = false)
|
||||||
return parsetree.(ss)
|
return parsetree.(ss)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ Base.push!(s::IdSet{T}, x::T) where T = (s.dict[x] = nothing; s)
|
|||||||
Base.delete!(s::IdSet{T}, x::T) where T = (delete!(s.dict, x); s)
|
Base.delete!(s::IdSet{T}, x::T) where T = (delete!(s.dict, x); s)
|
||||||
Base.in(x, s::IdSet) = haskey(s.dict, x)
|
Base.in(x, s::IdSet) = haskey(s.dict, x)
|
||||||
|
|
||||||
(::Type{IdSet{T}})(xs) where T = push!(IdSet{T}(), xs...)
|
IdSet{T}(xs) where T = push!(IdSet{T}(), xs...)
|
||||||
|
|
||||||
IdSet(xs) = IdSet{eltype(xs)}(xs)
|
IdSet(xs) = IdSet{eltype(xs)}(xs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user