1
0
Fork 0
mirror of https://github.com/Findus23/cr-search.git synced 2024-09-19 15:23:44 +02:00

add stats

This commit is contained in:
Lukas Winkler 2023-02-26 22:51:52 +01:00
parent 7e8c927c61
commit 83c1d8c73c
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -82,12 +82,24 @@ select sum(array_length(regexp_split_to_array(text,'\\s'),1)) from line
"""
class TotalLines(SingleValueStats):
query = """
select count(1) from line
"""
class TotalPhrases(SingleValueStats):
query = """
select count(1) from phrase
"""
class PhraseTableSize(SingleValueStats):
query = "SELECT pg_size_pretty(pg_relation_size('phrase'));"
query = "SELECT pg_size_pretty(pg_relation_size('phrase')) as size;"
class LineTableSize(SingleValueStats):
query = "SELECT pg_size_pretty(pg_relation_size('line'));"
query = "SELECT pg_size_pretty(pg_relation_size('line')) as size;"
class TotalVideoTime(SingleValueStats):
@ -99,7 +111,8 @@ from (select distinct on (episode_id) endtime from line order by episode_id, "or
def aggregate_stats(plaintext: bool):
text = ""
data = {}
for stats_class in [TotalWords, PhraseTableSize, LineTableSize, TotalVideoTime, MostCommonNounChunks,
for stats_class in [TotalLines, TotalWords, TotalPhrases, PhraseTableSize, LineTableSize, TotalVideoTime,
MostCommonNounChunks,
LongestNounChunks, LinesPerPerson]:
name = type(stats_class()).__name__
if plaintext: