Skip to content

Commit 543aab3

Browse files
committed
fixed file path
1 parent add4ba3 commit 543aab3

3 files changed

Lines changed: 32 additions & 12 deletions

File tree

src/dev_ASOIAF.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ end.rec.log()
7171

7272
# TODO
7373
# - sortir mêmes figures que padraig
74-
# - transformer chapitres en volumes ?
74+
# - extraire cum net par chap au lieu de scènes

src/dynamic/cumulative.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ cum.write.graph <- function(gs, filtered, pub.order=TRUE, char.det=NA)
147147
else # by story order
148148
ord.fold <- "story"
149149

150-
base.file <- get.path.data.graph(mode="scenes", char.det=char.det, net.type="cumulative", order=ord.fold, filtered=filtered, pref="cum")
150+
# retrieve narrative unit
151+
narr.unit <- strsplit(gs[[1]]$NarrUnit, split="_")[[1]][1]
152+
153+
base.file <- get.path.data.graph(mode="scenes", char.det=char.det, net.type="cumulative", order=ord.fold, filtered=filtered, subfold=narr.unit, pref="cum")
151154
write.dynamic.graph(gs=gs, base.path=base.file)
152155
}
153156

@@ -162,16 +165,17 @@ cum.write.graph <- function(gs, filtered, pub.order=TRUE, char.det=NA)
162165
# remove.isolates: whether to remove isolates in each time slice.
163166
# pub.order: whether to consider volumes in publication vs. story order.
164167
# char.det: character detection mode ("implicit" or "explicit").
168+
# narr.unit: narrative unit used to extract the dynamic network (scene, volume, etc.).
165169
#
166170
# returns: list of igraph objects representing a dynamic graph.
167171
###############################################################################
168-
cum.read.graph <- function(filtered, remove.isolates=TRUE, pub.order=TRUE, char.det=NA)
172+
cum.read.graph <- function(filtered, remove.isolates=TRUE, pub.order=TRUE, char.det=NA, narr.unit=NA)
169173
{ if(pub.order) # by publication order
170174
ord.fold <- "publication"
171175
else # by story order
172176
ord.fold <- "story"
173177

174-
base.file <- get.path.data.graph(mode="scenes", char.det=char.det, net.type="cumulative", order=ord.fold, filtered=filtered, pref="cum")
178+
base.file <- get.path.data.graph(mode="scenes", char.det=char.det, net.type="cumulative", order=ord.fold, filtered=filtered, subfold=narr.unit, pref="cum")
175179
gs <- read.dynamic.graph(base.file=base.file, remove.isolates=remove.isolates)
176180

177181
return(gs)

src/post/asoiaf/extr_dyn.R

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ start.rec.log(text="ExtrDyn")
1818

1919
################################################################################
2020
tlog(0,"Extract dynamic networks for ASOIAF")
21+
char.det <- "implicit"
22+
narr.unit <- "scene"
2123

2224
# read raw data
2325
tlog(2,"Reading previously computed corpus stats")
@@ -33,6 +35,7 @@ scene.stats <- data$scene.stats
3335

3436
# extract dynamic networks using the comic publication order (=comic story order)
3537
tlog(2,"Extracting publication-ordered dynamic networks")
38+
pub.order <- TRUE
3639
for(filtered in c(FALSE,TRUE))
3740
{ tlog(4,"Dealing with ",if(filtered) "" else "un","filtered networks")
3841
gg <- cum.graph.extraction(
@@ -41,11 +44,11 @@ for(filtered in c(FALSE,TRUE))
4144
scene.chars=scene.chars, scene.stats=scene.stats,
4245
volume.stats=volume.stats,
4346
filtered=filtered,
44-
pub.order=TRUE,
45-
narr.unit="scene"
47+
pub.order=pub.order,
48+
narr.unit=narr.unit
4649
)
47-
cum.write.graph(gs=gg, filtered=filtered, pub.order=TRUE, char.det="implicit")
48-
gg <- cum.read.graph(filtered=filtered, remove.isolates=TRUE, pub.order=TRUE, char.det="implicit")
50+
cum.write.graph(gs=gg, filtered=filtered, pub.order=pub.order, char.det=char.det)
51+
gg <- cum.read.graph(filtered=filtered, remove.isolates=TRUE, pub.order=pub.order, char.det=char.det, narr.unit=narr.unit)
4952
}
5053

5154

@@ -68,6 +71,7 @@ inter.df[,COL_RANK] <- rank(page.stats[inter.df[,COL_PAGE_START_ID],COL_RANK]*(n
6871

6972
# extract dynamic networks using the novel chapter order
7073
tlog(2,"Extracting publication-ordered dynamic networks")
74+
pub.order <- FALSE
7175
for(filtered in c(FALSE,TRUE))
7276
{ tlog(4,"Dealing with ",if(filtered) "" else "un","filtered networks")
7377
gg <- cum.graph.extraction(
@@ -76,16 +80,28 @@ for(filtered in c(FALSE,TRUE))
7680
scene.chars=scene.chars, scene.stats=scene.stats,
7781
volume.stats=volume.stats,
7882
filtered=filtered,
79-
pub.order=FALSE,
80-
narr.unit="scene"
83+
pub.order=pub.order,
84+
narr.unit=narr.unit
8185
)
82-
cum.write.graph(gs=gg, filtered=filtered, pub.order=FALSE, char.det="implicit")
83-
gg <- cum.read.graph(filtered=filtered, remove.isolates=TRUE, pub.order=FALSE, char.det="implicit")
86+
cum.write.graph(gs=gg, filtered=filtered, pub.order=pub.order, char.det=char.det)
87+
gg <- cum.read.graph(filtered=filtered, remove.isolates=TRUE, pub.order=pub.order, char.det=char.det, narr.unit=narr.unit)
8488
}
8589

8690

8791

8892

93+
###############################################################################
94+
# alternative: replace volumes by chapters
95+
96+
# create new volume table
97+
# replace each volume and volume id in all the other tables
98+
# problem: cannot process all the volume stats
99+
100+
# alt: create a new narrative unit "chapter"?
101+
102+
103+
104+
89105
###############################################################################
90106
# end logging
91107
tlog(0,"Process complete")

0 commit comments

Comments
 (0)