class Punctuation(Enum): COMMA = ',' PERIOD = '.' EXCLAMATION = '!' QUESTION = '?' BOLD_COMMA = bold(',') BOLD_PERIOD = bold('.') BOLD_EXCLAMATION = bold('!') BOLD_QUESTION = bold('?') def bold(self): try: return getattr(Punctuation, 'BOLD_{}'.format(self.name)) except AttributeError: return self @staticmethod def has_tags(*tags): return False def capitalize(self): return self def de_capitalize(self): return self
def bold(self): return BasicWord(bold(self.value), self.tags)
def test_bold_full_tag(self): self.assertEqual(bold('<bold>x</bold>'), '<bold>x</bold>')
def test_bold_half_tag(self): self.assertEqual(bold('<bold>x'), '<bold><bold>x</bold>') self.assertEqual(bold('x</bold>'), '<bold>x</bold></bold>')
def test_bold_regular(self): self.assertEqual(bold('x'), '<bold>x</bold>')
def bold(self) -> 'Noun': return Noun(bold(self.value), self.irregular_plural, self.base_noun, self.tags)
def bold(self) -> 'Verb': return Verb(bold(self.value), self.irregular_past, self.infinitive, self.tags)
def bold(self) -> AbstractWord: return BasicWord(bold(self.value))