From f141200ca4edc72815a0e7bb47eab89f7cd83512 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Tue, 15 Aug 2023 16:22:12 +0200 Subject: Replacing __str__ representation by letter_sequence property. --- src/argaze.test/GazeFeatures.py | 4 ++-- src/argaze/GazeAnalysis/LempelZivComplexity.py | 2 +- src/argaze/GazeAnalysis/NGram.py | 2 +- src/argaze/GazeFeatures.py | 8 ++------ 4 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/argaze.test/GazeFeatures.py b/src/argaze.test/GazeFeatures.py index a6709cb..d609dd2 100644 --- a/src/argaze.test/GazeFeatures.py +++ b/src/argaze.test/GazeFeatures.py @@ -631,8 +631,8 @@ class TestAOIScanPathClass(unittest.TestCase): self.assertEqual(aoi_scan_path.get_letter_aoi('B'), 'Shu') self.assertEqual(aoi_scan_path.get_letter_aoi('C'), 'Foo') - # Check string representation - self.assertEqual(str(aoi_scan_path), 'ABCA') + # Check letter sequence representation + self.assertEqual(aoi_scan_path.letter_sequence, 'ABCA') def test_transition_matrix(self): """Test AOIScanPath transition matrix feature.""" diff --git a/src/argaze/GazeAnalysis/LempelZivComplexity.py b/src/argaze/GazeAnalysis/LempelZivComplexity.py index c836235..82ef05f 100644 --- a/src/argaze/GazeAnalysis/LempelZivComplexity.py +++ b/src/argaze/GazeAnalysis/LempelZivComplexity.py @@ -33,7 +33,7 @@ class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer): assert(len(aoi_scan_path) > 1) - self.__lempel_ziv_complexity = lempel_ziv_complexity(str(aoi_scan_path)) + self.__lempel_ziv_complexity = lempel_ziv_complexity(aoi_scan_path.letter_sequence) @property def lempel_ziv_complexity(self) -> int: diff --git a/src/argaze/GazeAnalysis/NGram.py b/src/argaze/GazeAnalysis/NGram.py index 662060e..bee9767 100644 --- a/src/argaze/GazeAnalysis/NGram.py +++ b/src/argaze/GazeAnalysis/NGram.py @@ -40,7 +40,7 @@ class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer): assert(len(aoi_scan_path) > 1) - sequence = str(aoi_scan_path) + sequence = aoi_scan_path.letter_sequence self.__ngrams_count = {} diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index 224e2d9..bb5f991 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -799,11 +799,6 @@ class AOIScanPath(list): self.expected_aois = expected_aois self.__duration = 0 - - def __repr__(self): - """String representation.""" - - return str(super()) @property def duration(self) -> float: @@ -846,7 +841,8 @@ class AOIScanPath(list): return self.__letter_aoi[letter] - def __str__(self) -> str: + @property + def letter_sequence(self) -> str: """Convert aoi scan path into a string with unique letter per aoi step.""" sequence = '' -- cgit v1.1