From be65d1f6c73d8813c6335f21c0de12182b9e2956 Mon Sep 17 00:00:00 2001 From: appleweiping Date: Mon, 7 Sep 2026 14:05:15 -0500 Subject: [PATCH] Document ContextTuple fields --- convokit/forecaster/forecaster.py | 6 ++++++ convokit/tests/test_context_tuple_docs.py | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 convokit/tests/test_context_tuple_docs.py diff --git a/convokit/forecaster/forecaster.py b/convokit/forecaster/forecaster.py index dc2a037e..1421e7dd 100644 --- a/convokit/forecaster/forecaster.py +++ b/convokit/forecaster/forecaster.py @@ -12,6 +12,12 @@ ContextTuple = namedtuple( "ContextTuple", ["context", "current_utterance", "future_context", "conversation_id"] ) +ContextTuple.context.__doc__ = "Chronological utterances up to and including the current utterance." +ContextTuple.current_utterance.__doc__ = "Most recent utterance when this context was generated." +ContextTuple.future_context.__doc__ = ( + "Later utterances during training, or None when future context is unavailable." +) +ContextTuple.conversation_id.__doc__ = "Identifier of the conversation that produced this context." class Forecaster(Transformer): diff --git a/convokit/tests/test_context_tuple_docs.py b/convokit/tests/test_context_tuple_docs.py new file mode 100644 index 00000000..e5b587db --- /dev/null +++ b/convokit/tests/test_context_tuple_docs.py @@ -0,0 +1,23 @@ +import unittest + +from convokit.forecaster.forecaster import ContextTuple + + +class ContextTupleDocsTest(unittest.TestCase): + def test_fields_have_descriptive_docstrings(self): + self.assertEqual( + { + "context": ContextTuple.context.__doc__, + "current_utterance": ContextTuple.current_utterance.__doc__, + "future_context": ContextTuple.future_context.__doc__, + "conversation_id": ContextTuple.conversation_id.__doc__, + }, + { + "context": "Chronological utterances up to and including the current utterance.", + "current_utterance": "Most recent utterance when this context was generated.", + "future_context": ( + "Later utterances during training, or None when future context is unavailable." + ), + "conversation_id": "Identifier of the conversation that produced this context.", + }, + )