TITLE: Digital model of spatio-temporal narratives of Chinese classical narrative literature
AUTHORS: Zhaoyi Ma, Jie He, Shuai Shuai Liu

[DESCRIPTION]
<div class = "text-blocks"><div class = "text-block">In order to reconstruct the relationship between text and space in the tradition of Chinese classical narrative literature, a Time–Space-time–Space framework of digital models is posited, integrating spatial narrative theories and methods from literary cartography, computational narratology and geo-narrative.  This Time–Space-time–Space framework enables varied structured semantics (including the spatio-temporal information) derived from the novel’s text and its necessary historic context semi-manually, as the lack of mature natural language processing tools for ancient Chinese. These value-added structured semantics are then extracted and fused to map the instantaneous spatial pattern perceived by readers in the flow of reading time through data visualization, computational social science and spatial analysis. The organized spatio-temporal representations of narrative literature can help re-understand the narrative and the place. The Time–Space-time–Space framework embeds linearity, experience and significance of the narrative in an open and dialogic field. </div><div style = "text-align :; float : ;"><img style = "" src = "https://s3.amazonaws.com/protocols-files/public/73972e7475ae1e67bfaf293722fc4f4ab7b17baf3a4bd5e9547a699ad0e68999/b2zwbb95f.png" /></div></div>

[STEPS]
?. [Structuring]
Structuring of Narrative
?. [Digitalization]
1.1 Text version from 中国哲学书电子化计划（CText）1.2 Proofreading Text Edition  based on the version fromComplete Library in Four Sections四库全书
?. [Representation]
Spatio–temporal Representations of Narrative
?. [Structuring]
Text database on word level  (sheet1_name: term, sheet2_name: POS, sheet3_name: so, sheet4_name: sentiment classification score)we manually create this database including terms (unigram), parts of speech (POS), sentiment orientations (SO) value, and sentiment shifters by Excel.Segment of Term Criteria: Broadening, Dictionary, and Semantic TransparencyReference dictionary: 国学大师Reference Word Segmentation platform: 语料库在线  ABCDEFGHIJKLMNOPQRSTUVWXYZ1Tagnntndnlnhnhfnhsnsnnninonhhvvdvlvuafmqdrpcueoiw2posNoun-generalNoun-timeNoun-directionNoun-locationNoun-humannoun-last namenoun-first nameNoun-spaceNoun-nationNoun-institutionNoun-officalnoun-human’s pronounVerbVerb- directionVerb-linkingVerb-auxiliaryadjectivedifferencenumeralquantityadverbpronounprepositionconjunctionauxiliaryexclamationonaomatopoeiaidiompunctuationThe assignment of the SO value is as follows: each positive sentiment expression in the novel such as laugh (欢笑) (v.) and magnificent (瑰奇) (a.) is given an SO value of +1 (172 in total), and each negative sentiment expression such as whimper (呜咽) (v.) and poor (贫窭) (a.) is assigned a SO value of −1 (177 in total).We do two rounds of sentiment orientations (SO) value assignment(LIU_SO value and MA_SO value).The percentage of consent of two rounds of SO value assignment is 81.5%.word2vec_python_code&raw_datasentiment_network_Gephi.zipresult_weighted_outdegree_distribution.xlsxWe assumed that the sentiment words in ancient Chinese follow the same logic in today’s sentiment analysis–– sentiment words have context-dependent orientations, i.e., the total distance among words with the same orientation sentiment expression is closer than that among different.Based on the unigrams removing stop words, we complete the training of its word2vec model with gensim package, and get the correlation(cosine_similarity, -0.4 ~ 1) between each two words.This correlation between word A (Source) and word B (Target) multiplied by the SO value of word B is taking as the weight of the edge, to set up a words’ sentiment network in Gephi.  ABC1SourceTargetWeight2WordAWordBcosine_similarity*WordB_sentiment#tips for operation step in Gephi:File → Improt spreadsheet → edge to gephi.csv → charset: GB2312 → Graph Type: directedrun all analysis of "Avg. Weighted Degree" on the right manueData Laboratory → Nodes → Export Table#The weighted output distribution calculated by gephi is divided into three different types of manually collected sentient words (1, - 1,0), which are made into scatter diagram by Excel.SO_value_effective = IF(sentiment_shifter_-1=-1,SO value * sentiment_shifter_-1,SO value)   for_phrase_sentiment_classification_score = IF(POS"w",SO_value_effective,"") for_phrase_sentiment_classification_score = SUM(for_phrase_sentiment_classification_score) #tips for operation step: Ctrl+G--> "Null(k)"--> "∑"(which means Automatic summation) #for_phrase_sentiment_classification_score = SUM(for_phrase_sentiment_classification_score)
ABCDEFGHIJKLMNOPQRSTUVWXYZ1Tagnntndnlnhnhfnhsnsnnninonhhvvdvlvuafmqdrpcueoiw2posNoun-generalNoun-timeNoun-directionNoun-locationNoun-humannoun-last namenoun-first nameNoun-spaceNoun-nationNoun-institutionNoun-officalnoun-human’s pronounVerbVerb- directionVerb-linkingVerb-auxiliaryadjectivedifferencenumeralquantityadverbpronounprepositionconjunctionauxiliaryexclamationonaomatopoeiaidiompunctuation
ABC1SourceTargetWeight2WordAWordBcosine_similarity*WordB_sentiment
?. [Structuring]
Text database on phrase level  (sheet1_name: phrase, sheet2_name: time, sheet3_name: character, sheet4_name: character & SO, sheet5_name: place, sheet6_name: place & SO)The phrase-level framework assigns the recalculated value of POS and SO value to a relevant phrase by Excel. These values can be applied to the next time level because the sequence number of phrases is defined as read-time. Specific data mining approaches for the following parameters, i.e. places, story-time, and sentiment classification scores are valuable.sentiment_classification_score(SCS) inherits the value of phrase_sentiment_classification_score in S1 Table.xlsx.storytime_dayNoun-time (nt.) such as the Tianbao period (天宝), 10 years later (十年), more than a month later (月余), and another day (他日), which is 2.7% of the total texts, are used to simulate the whole story-time in an interval of every single day. The entire story timeline we constructed from the texts started from when Student Zheng entered Chang’an in 747A.D. and ended around the happy ending of the novel, that is, the year Zheng is appointed to become an officer is 754 A.D., and Li Wa is conferred the title Lady Qian‘guo (汧国夫人) in 775 A.D. The story-time is defined by the exact time record of the story that occurred during the period of 742 to 746 A.D.(天宝年间), Bai Xingjian wrote the tale in August of 795 A.D. (贞元中……乙亥岁秋八月) and the nt. phrases.readtime_phrasethe sequence number of phrases is defined as read-timecharacter1，character2，character3， and character4 contain one character in each phrase(since one phrase contains at most 4 characters).SO_value_Integral_function(so_IF)= SUM(sentiment_classification_score(SCS)) #tips for operation step: E15=SUM(D$2:D15), E18=SUM(D$2:D18), E50=SUM(D$2:D50)... #ZHENG_SCS = IF(character1="郑生" or character2="郑生" or character3="郑生" or character4="郑生",sentiment_classification_score(SCS),"")  ZHENG_so_IF= SUM(ZHENG_SCS) #tips for operation step: K15=SUM(J$15:J15), K18=SUM(J$15:J18), K50=SUM(J$15:J50)...#A noun-space (ns.) such as Chang’an City, and specific place names inside the city such as the Buzheng Ward (布政坊) and Xingyuan Garden (杏园) (located in Tongshan Ward [通善坊]), account for 1.1% of the total texts tagged as the level of residential wards and streets directly mentioned (e.g., Buzheng Ward) or most likely to be located (e.g., Tongshan Ward). These uniformly fine-grained places are applied to cover the corresponding story phrases of which plot takes place in these places.Anyi_SCS = IF(ward_in_chang'an="安邑坊",sentiment_classification_score(SCS),"") Anyi_so_IF= SUM(Anyi_SCS) #tips for operation step: I526=SUM(H$526:H526), I535=SUM(H$526:H535), I606=SUM(H$526:H606)#
?. [Structuring]
Chronicle of Bai Xingjian   (sheet1_name: circumstance, sheet2_name: poems) is bassed on A chronicle of Bai Xingjian collated by 黄大宏Detail contians Bai's specific experience every yearcircumstance_orientation_value is assigned manually based on the good/bad of Detail. Such as "祖母殁于新郑县私第(Bai's grandmother died)"is assigned a value of −1, "行简进士及第...行简同年...应制举(Bai passed the Imperial Examination...Bai passed passed the Palace Examination)" is assigned a value of +2.Circumstances_of_Bai = SUM(circumstance_orientation_value) #tips for operation step: E2=SUM($D$2:D2), E10=SUM($D$2:D10), E52=SUM($D$2:D52)...#circumstance_orientation_value_chang'an = IF(Place="长安",circumstance_orientation_value,"")
?. [Structuring]
Spatial syntax of Chang'anVector file of street of chang'an is created by Autocad and then imported into Depthmap(a technology used to analyze the spatial layouts, and human activity patterns in urban areas)#tips for operation step of Integration analysis of the road network of Chang’an city by Depthmap:Using Autocad to depict the main road axis map of Chang'an map(Vector file of street of chang'an) → Save as dxf file → Open the depthmap software and create a new workspace → Map-import-Choosing Chang'an Road Axis Chart → ap-convert drawing map → tools-axial/convex/pesh-run graph analysis-Radius/list of radii – input n,2,3,5,7-choose include choice（betweenness）/local measures/RA,RRA and total depth/weighted measures-length#The degree of integration (a space syntax parameter) reflects the ease of access to streets, that is, it may determine which street is more likely to attract Zheng, as an explorer of Chang’an.
?. [Representation]
Time#tips for operation step of Trajectory of the integral function of SO value by sigmaplot:create graph--> simple straight line--> data format--> XY Pair--> select datadata for X: storytime_day data for Y: SO_value_Integral_function(so_IF)##tips for operation step of Trajectory of the integral function of SO value and characters’ appearance by sigmaplot:create graph--> multiple straight line--> data format--> XY Pair--> select datadata for X: storytime_day data for Y: SO_value_Integral_function(so_IF)data for X: storytime_day data for Y: ZHENG_so_IFdata for X: storytime_day data for Y: LI_Wa_so_IFdata for X: storytime_day data for Y: LI_Wa's_mother_so_IFdata for X: storytime_day data for Y: ZHENG's_father_so_IF##tips for operation step of Trajectory of the integral function of SO value and places’ appearance by sigmaplot:create graph--> simple straight line--> data format--> XY Pair--> select datadata for X: storytime_day data for Y: SO_value_Integral_function(so_IF)add new plot--> graph types--> vertical bar chart--> graph styles--> grouped bars--> data formats--> many Ydata for Y: Anyi_so_IFdata for Y: Buzheng_so_IFdata for Y: Chongren_so_IFdata for Y: EastMarket_IFdata for Y: Pingkang_IFdata for Y: DepartmentOfStateAffairs_IFdata for Y: TianmenStreet_so_IFdata for Y: Tongshan_so_IFdata for Y: Tongyi_so_IFdata for Y: WestMarket_so_IFdata for Y: XingqingPalace_IFdata for Y: Xuanyang_so_IFgraph page--> add axist--> Y##tips for operation step of Trajectory of the integral function of SO value versus the story-time’s appearance by sigmaplot:create graph--> multiple straight line--> data format--> XY Pair--> select datadata for X: storytime_day data for Y: SO_value_Integral_function(so_IF)data for X: storytime_day data for Y: readtime_phrasegraph page--> add axist--> Y##tips for operation step of Bai Xingjian's up and down by sigmaplot:create graph--> vertical bar chart--> graph styles--> grouped bar--> data format--> many Ydata for X: Age data for Y: Circumstances_of_Bai data for X: Age data for Y: Circumstances_of_Bai_Chang'an#
?. [Representation]
Space-timeimport shikong-vt.shp, temporal simulation path in sapce.shp and link_between_places.shp into Arcscene#tips for operation step of Visualization of the integral function of SO value versus places’ appearance by Arcscene:"shikong-vt.shp"--> properties--> Element--> Single symbol "temporal simulation path in sapce.shp"--> properties--> Symbolic System--> Graded colour--> value--> sheet1_em(SO_value_Integral_function(so_IF))##tips for operation step of Visualization of path trajectory based on spatial discipline: characters’ appearance versus places’ appearance by Arcscene:"shikong-vt.shp"--> properties--> Element--> Single symbol"link_between_places.shp"--> properties--> Symbolic Systems--> category--> Unique value--> value--> 人物啊(character)##tips for operation step of Visualization of path trajectory based on spatial discipline: characters’ appearance and the integral function of SO value versus places’ appearance by Arcscene:"shikong-vt.shp"--> properties--> Element--> Single symbol "link_between_places.shp"--> properties--> Symbolic Systems--> Graded colour--> value--> 情感差(sentiment score between places)##tips for operation step of Visualization of path trajectory based on spatial discipline: characters’ appearance of different stratum versus places’ appearance and the integral function of SO value by Arcscene:"shikong-vt.shp"--> properties--> Symbolic System--> Graded colour--> value--> sheet1_em(SO_value_Integral_function(so_IF))"link_between_places.shp"--> properties--> Symbolic Systems--> category--> Unique value--> value--> 阶级值(stratum)#
?. [Representation]
SpacePOS map#tips for operation step of Statistics of different POS and places by Photoshop:create the wordcloud image of POS of each place by wordart --> imported in Photoshop --> move to relevant place --> export into png#Sentiment map#tips for operation step of Inverse distance weighted (IDW) interpolation by ArcGIS of the sentiment classification score and places by Arcmap :Toolbox → geostatistical analyst- interpolation analysis – IDW→ input layer“点数据 (LIWA_data.shp)” → Environment-range-“皇城里坊”#Social network (edge.csv, node.csv)if two character co-occurr within two adjacent phrases, one edge will be added between them.#tips for operation step of Statistics of characters in co-occurrence network, modularity class, betweenness centrality, and Girvan-Newman clustering in Gephi:File → Improt spreadsheet → edge.csv → charset: GB2312 → Graph Type: indirectedTools → plugins → Availible Plugins → Installrun all analysis of "Statistics" on the right manueappearence → nodes → color → Partition → Modularity class → runappearence → nodes → color → Partition → Cluster-ID → runappearence → nodes → size → Ranking → Betweenness centrality → run#Network parameters:node：26edge：38Average Degree: 1.462Average Weighted Degree: 4.731Diameter: 5Radius: 1Average Path length: 2.265625Density: 0.095Randomize: On (Modularity)Use edge weights: Off (Modularity)Resolution: 0.8 (Modularity)Modularity: 0.351 (Modularity)Modularity with resolution: 0.218 (Modularity)Number of Communities: 6 (Modularity)Number of communities:4 (Girvan-Newman Clustering)Maximum found modularity:0.39129266 (Girvan-Newman Clustering)Network Interpretation: undirectedAverageClustering Coefficient: 0.506Total triangles: 6Spatially embedded network (direct-node.csv, edge.csv, indirect-node.csv) is based on path.xlsx#tips for operation step of  Network analysis of characters and places in Girvan-Newman clustering analysis, modularity class analysis (use edge weights: On) and weighted degree centrality based on a full-text, spatially embedded, undirected network of characters in Gephi:File → Improt spreadsheet → edge.csv → charset: GB2312 → Graph Type: indirectedTools → pluginss → Availible Plugins → Installrun all analysis of "Statistics" on the right manueappearence → nodes → color → Partition → Cluster-ID → runappearence → nodes → color → Partition → Modularity class → runappearence → nodes → size → Ranking → Weighed Degree → run##tips for operation step of Network analysis of characters and places in closeness centrality and betweenness centrality based on a full-text spatially embedded undirected network of characters in Gephi:File → Improt spreadsheet → edge.csv → charset: GB2312 → Graph Type: indirectedrun all analysis of "Statistics" on the right manueappearence → nodes → color → Ranking → Closeness centrality → runappearence → nodes → size → Ranking → Betweenness centrality → run##tips for operation step of Network analysis of characters and places in authority and hub analysis based on a full-text spatially embedded directed network of characters in Gephi:File → Improt spreadsheet → edge.csv → charset: GB2312 → Graph Type: directedrun all analysis of "Statistics" on the right manueappearence → nodes → color → Ranking → Authority → runappearence → nodes → size → Ranking → Hub → run#Network parameters:node：16edge：24Average Degree: 3.000Average Weighted Degree: 7.750Diameter: 6Radius: 3Average Path length: 2.265625Density: 0.200Randomize: On (Modularity)Use edge weights: On (Modularity)Resolution: 0.8 (Modularity)Modularity: 0.326 (Modularity)Modularity with resolution: 0.194 (Modularity)Number of Communities: 4 (Modularity) Number of communities:4 (Girvan-Newman Clustering)Maximum found modularity:0.3949653 (Girvan-Newman Clustering)Network Interpretation: undirectedAverageClustering Coefficient: 0.474Total triangles: 9
?. [Structuring]
Spatially embedded semantic data (path.xlsx, place.xlsx, shikong-vt.shp, link_between_places.shp) combines Text database with spatial data by Arcmap.create path.xlsx semi-manually by Excel based on Text database on phrase levelEach time when ward_in_chang'an in sheet "place & SO" changes, an ID is added in path.xlsx with Origin to Destinationsentiment score between places: value difference of sum_sentiment_effective_classification_score between Origin and Destinationstraturm classification: The classification of social stratum of the character. The classification of social stratum in the story from untouchable to nobles is as follows: (1) beggar, servant, and sex worker; (2) businessman, civilian, madam; (3) ward head (里胥), candidate student, successful candidate, county judicial official (贼曹); and (4) Chang’an officials (京尹) and officials from other places.create place.xlsx( sheet1_name: stratum_statistics, sheet2_name: place_statistics) by Excel based on Text database on phrase levelstratum_statistics inherits the value in path.xlsx  ABCDEFGHIJ1placesum_sentiment_effective_classification_scorephrase_countaverge_sentiment_classification_scoreeffective_sum_sentiment_classification_scoreeffective_phrase_countaverge_sentiment_effective_classification_scoreaverge_stratumSTDEV_stratumCOUNT_stratum2wardSUM(place_SCS) in sheet" place &amp; SO"COUNT(place_SCS) in sheet" place &amp; SO"AVERAGE(place_SCS) in sheet" place &amp; SO"IF place_SCS&lt;&gt;0,SUM(place_SCS),"" in sheet" place &amp; SO"IF place_SCS&lt;&gt;0,COUNT(place_SCS),"" in sheet" place &amp; SO"IF place_SCS&lt;&gt;0,AVERAGE(place_SCS),"" in sheet" place &amp; SO"AVERAGE(place_stratum) in sheet" stratum_statistics"STDEV(place_stratum) in sheet" stratum_statistics"COUNT(place_stratum) in sheet" stratum_statistics"3) Polygon#tips for operation step:create shapefile of Polygon( Ward& Palace) based on Raster map of Tang Chang'an with location information#This shapefile is not uploaded to github due to copyright issues4) Point#tips for operation step:·create Point( centroid of Polygon)--> add field ward_in_chang'an and fill in·Text database on phrase level is joined with Point by field ward_in_chang'an#LIWA_data.shp#tips for operation step:·create Point( centroid of Polygon)--> add field ward_in_chang'an and fill in·place.xlsx is joined with Point by field NAME#5) Polylinetemporal simulation path in space.shp#tips for operation step:Arcmap--> Toolbox--> XY to Line--> import shikong-vt.shp#·create polyline The rules of the simulation are from the characteristics of the streets: first, prefer the shortest path, and second, prefer the street sections with the highest degree of spatial syntax integration.·path.xlsx is joined with polyline by field ID
ABCDEFGHIJ1placesum_sentiment_effective_classification_scorephrase_countaverge_sentiment_classification_scoreeffective_sum_sentiment_classification_scoreeffective_phrase_countaverge_sentiment_effective_classification_scoreaverge_stratumSTDEV_stratumCOUNT_stratum2wardSUM(place_SCS) in sheet" place &amp; SO"COUNT(place_SCS) in sheet" place &amp; SO"AVERAGE(place_SCS) in sheet" place &amp; SO"IF place_SCS&lt;&gt;0,SUM(place_SCS),"" in sheet" place &amp; SO"IF place_SCS&lt;&gt;0,COUNT(place_SCS),"" in sheet" place &amp; SO"IF place_SCS&lt;&gt;0,AVERAGE(place_SCS),"" in sheet" place &amp; SO"AVERAGE(place_stratum) in sheet" stratum_statistics"STDEV(place_stratum) in sheet" stratum_statistics"COUNT(place_stratum) in sheet" stratum_statistics"