Skip to content

Commit 28d310c

Browse files
committed
fixed char_sim
1 parent b3578a0 commit 28d310c

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/post/description/_all_post.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ source("src/post/description/centr_clusters.R")
1616
source("src/post/description/centr_vs_centr.R")
1717
source("src/post/description/centr_vs_occ.R")
1818
source("src/post/description/char_distr.R")
19-
#source("src/post/description/char_sim.R")
19+
source("src/post/description/char_sim.R")
2020
#source("src/post/description/char_tj_comp.R")
2121
source("src/post/description/comp_vs_edges.R")
2222
#source("src/post/description/comp_vs_vertices.R")

src/post/description/char_sim.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ start.rec.log(text="CharSim")
1818
################################################################################
1919
# main parameters
2020
wide <- TRUE # wide plots showing volumes as rectangles
21-
narr.smooth <- FALSE # whether to use narrative smoothing or cumulative scene-based networks
21+
narr.smooth <- TRUE # whether to use narrative smoothing or cumulative scene-based networks
2222
weighted <- TRUE # whether to use the graph weights
2323
sc.lim <- NA # limit on the considered scenes (NA for no limit)
2424
pub.order <- TRUE # whether to use the volume publication vs. story order
@@ -69,7 +69,7 @@ if(narr.smooth)
6969
)
7070
# possibly set weights
7171
if(weighted)
72-
{ gs[["unfiltered"]] <- future_lapply(gs[["unfiltered"]], function(g) {E(g)$weight <- E(g)$Occurrences;return(g)})
72+
{ gs[["unfiltered"]] <- future_lapply(gs[["unfiltered"]], function(g) {E(g)$weight <- E(g)$Occurrences; return(g)})
7373
w.name <- "occurrences"
7474
}
7575

@@ -219,7 +219,7 @@ for(m in 1:length(sim.meas))
219219
if(wide)
220220
draw.volume.rects(ylim, volume.stats)
221221
# horizontal dotted line
222-
if(names(sim.meas)[m]=="pearson")
222+
if(names(sim.meas)[m]=="sim-pearson")
223223
abline(h=0, lty=2)
224224
# add line
225225
lines(
@@ -281,7 +281,7 @@ for(m in 1:length(sim.meas))
281281
)
282282
}
283283
# horizontal dotted line
284-
if(names(sim.meas)[m]=="pearson")
284+
if(names(sim.meas)[m]=="sim-pearson")
285285
abline(h=0, lty=2)
286286
# legend
287287
legend(

src/static/extract_scene.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ extract.static.graph.scenes <- function(inter.df, char.stats, scene.stats, scene
7373
{ #tlog(2,"Initializing the graph list")
7474
s <- 1
7575
while(scenes.ord[s]!=inter.df[is[1],COL_SCENE_ID])
76-
{ tlog(4,"Processing s=",s," (scenes.ord[s]=",scenes.ord[s]," and inter.df[is[1],COL_SCENE_ID]=",inter.df[is[1],COL_SCENE_ID],") -- (length(scene.chars[[s]]=",length(scene.chars[[s]]),")")
76+
{ #tlog(4,"Processing s=",s," (scenes.ord[s]=",scenes.ord[s]," and inter.df[is[1],COL_SCENE_ID]=",inter.df[is[1],COL_SCENE_ID],") -- (length(scene.chars[[s]]=",length(scene.chars[[s]]),")")
7777
if(length(scene.chars[[scenes.ord[s]]])==0)
7878
g <- make_empty_graph(n=0, directed=FALSE)
7979
else if(length(scene.chars[[scenes.ord[s]]])==1)
8080
{ idx <- which(char.stats[,COL_NAME]==scene.chars[[scenes.ord[s]]])
8181
g <- graph_from_data_frame(d=static.df, directed=FALSE, vertices=char.stats[idx,])
8282
}
83+
g <- set_edge_attr(g, name=COL_OCCURRENCES, value=NA)
84+
g <- set_edge_attr(g, name=COL_DURATION, value=NA)
8385
res[[s]] <- g
8486
s <- s + 1
8587
}

0 commit comments

Comments
 (0)