aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-11-11 00:29:11 +0100
committerMartin Czygan <martin.czygan@gmail.com>2020-11-11 00:29:11 +0100
commita871e19c2e0aa3c94e338a27f4cc73b76d8ff9c0 (patch)
tree979aff0f4fbb43e71e3871b8e02dd2adf1c701e2
parent98bf92d16f7aadcf640e3260e02580db2636f064 (diff)
downloadfuzzycat-a871e19c2e0aa3c94e338a27f4cc73b76d8ff9c0.tar.gz
fuzzycat-a871e19c2e0aa3c94e338a27f4cc73b76d8ff9c0.zip
specify result schema
-rw-r--r--fuzzycat/cluster.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/fuzzycat/cluster.py b/fuzzycat/cluster.py
index 201ee28..ee23979 100644
--- a/fuzzycat/cluster.py
+++ b/fuzzycat/cluster.py
@@ -49,6 +49,21 @@ class KeyDoc(BaseModel):
title: Optional[str]
contribs: Optional[List[Contrib]]
+class ClusterResult(BaseModel):
+ """
+ Result of clustering.
+
+ XXX: We could also include the complete document, that would keep it simple
+ at the expense of a few more things to read.
+ """
+ key: str
+ values: List[str]
+ comment: str
+ ids: str
+ title: str
+ contribs: str
+ year: str
+
get_ident_title = operator.itemgetter("ident", "title")
ws_replacer = str.maketrans({"\t": " ", "\n": " "})