diff --git a/DatabaseCommunication/DatabaseInserter.py b/DatabaseCommunication/DatabaseInserter.py index 948ebfe..13ceb53 100644 --- a/DatabaseCommunication/DatabaseInserter.py +++ b/DatabaseCommunication/DatabaseInserter.py @@ -32,7 +32,7 @@ def insert_persons(self, persons): if len(p.sex) > 1: p.sex = 'U' - cursor.execute(PersonCommands.INSERT_ALL,(p.personID, p.sex, p.birth,)) + cursor.execute(PersonCommands.INSERT_ALL,(p.personID, p.sex, p.birth)) self.__insert_name_records(p.name_records,p.personID, cursor) self.connection.commit() @@ -114,7 +114,8 @@ def insert_speeches(self, speeches): with self.connection.cursor() as cursor: for author in speeches: for s in speeches[author]: - cursor.execute(SpeechCommands.INSERT_ALL, (s.when, + cursor.execute(SpeechCommands.INSERT_ALL, (s.speechID, + s.when, str(s.tokens), str(s.sentences), str(s.named_entity_refferences), @@ -122,6 +123,10 @@ def insert_speeches(self, speeches): s.speakerID[1:], s.total_duration, s.earliest_timeline, - s.latest_timeline)) + s.latest_timeline, + s.unaligned_tokens, + s.time_spoken, + s.time_silent, + s.time_unknown)) self.connection.commit() diff --git a/DatabaseCommunication/DatabaseTableCreator.py b/DatabaseCommunication/DatabaseTableCreator.py index 9103746..e730715 100644 --- a/DatabaseCommunication/DatabaseTableCreator.py +++ b/DatabaseCommunication/DatabaseTableCreator.py @@ -48,7 +48,7 @@ def create_tables(self): """, """ CREATE TABLE IF NOT EXISTS speech ( - id SERIAL PRIMARY KEY, + id VARCHAR(100) PRIMARY KEY, date DATE, token_count INTEGER, sentence_count INTEGER, @@ -58,6 +58,10 @@ def create_tables(self): total_duration REAL, earliest_timestamp VARCHAR(100), latest_timestamp VARCHAR(100), + unaligned_tokens INTEGER, + time_spoken REAL, + time_silent REAL, + time_unknown REAL, FOREIGN KEY (person_id) REFERENCES Person (person_id) ) diff --git a/DatabaseCommunication/commands.py b/DatabaseCommunication/commands.py index c17ef04..23aa558 100644 --- a/DatabaseCommunication/commands.py +++ b/DatabaseCommunication/commands.py @@ -13,6 +13,6 @@ class OrganisationCommands(StrEnum): class SpeechCommands(StrEnum): INSERT_ALL = """ - INSERT INTO speech(date, token_count, sentence_count, named_entity_count, role, person_id, total_duration, earliest_timestamp, latest_timestamp) - VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s) + INSERT INTO speech(id, date, token_count, sentence_count, named_entity_count, role, person_id, total_duration, earliest_timestamp, latest_timestamp, unaligned_tokens, time_spoken, time_silent, time_unknown) + VALUES(%s,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) ON CONFLICT (id) DO NOTHING """ diff --git a/MetadataExtraction/timestampsCSV.xslt b/MetadataExtraction/timestampsCSV.xslt index 2a998f1..cb578fb 100644 --- a/MetadataExtraction/timestampsCSV.xslt +++ b/MetadataExtraction/timestampsCSV.xslt @@ -14,11 +14,11 @@ - Type,ID,Speech,Begin,End,Time + Type,ID,Begin,End,Duration,Time - - - + + + S,END,END,END,END,END @@ -26,7 +26,12 @@ S, - ,, + , + + ,,, + + + @@ -36,10 +41,6 @@ , - - - , - @@ -49,7 +50,12 @@ , - + + + + + + ,