Repository: nltk/nltk

Issue:
Class 'CharTokenizer' is missing attribute '_string'
I think the class `CharTokenizer` is missing the attribute `_string=""`

https://github.com/nltk/nltk/blob/fc53edbf6f0763971afca5855386a2a382da37ac/nltk/tokenize/simple.py#L68-L77

Without this attribute, when trying to use the class, I get the following error:

`TypeError: Can't instantiate abstract class CharTokenizer with abstract method _string`

Example code:

```python
from nltk.tokenize.simple import CharTokenizer


tokenizer = CharTokenizer()
```

Error:

```bash
Traceback (most recent call last):
  File "/home/francis/.local/share/virtualenvs/cafa-challenge-bUqSu2Tm/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3508, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-7-803c2e672729>", line 1, in <module>
    tokenizer = CharTokenizer()
TypeError: Can't instantiate abstract class CharTokenizer with abstract method _string
```

Discussion:

Patch:
diff --git a/nltk/tokenize/simple.py b/nltk/tokenize/simple.py
index 71a02d309..54b2bf844 100644
--- a/nltk/tokenize/simple.py
+++ b/nltk/tokenize/simple.py
@@ -70,6 +70,8 @@ class CharTokenizer(StringTokenizer):
     is ever required directly, use ``for char in string``.
     """
 
+    _string = None
+
     def tokenize(self, s):
         return list(s)
 


Test patch:
diff --git a/nltk/test/unit/test_tokenize.py b/nltk/test/unit/test_tokenize.py
index 7688f5239..662b4562b 100644
--- a/nltk/test/unit/test_tokenize.py
+++ b/nltk/test/unit/test_tokenize.py
@@ -16,6 +16,7 @@ from nltk.tokenize import (
     sent_tokenize,
     word_tokenize,
 )
+from nltk.tokenize.simple import CharTokenizer
 
 
 def load_stanford_segmenter():
@@ -865,3 +866,21 @@ class TestTokenize:
     )
     def test_sent_tokenize(self, sentences: str, expected: List[str]):
         assert sent_tokenize(sentences) == expected
+
+    def test_string_tokenizer(self) -> None:
+        sentence = "Hello there"
+        tokenizer = CharTokenizer()
+        assert tokenizer.tokenize(sentence) == list(sentence)
+        assert list(tokenizer.span_tokenize(sentence)) == [
+            (0, 1),
+            (1, 2),
+            (2, 3),
+            (3, 4),
+            (4, 5),
+            (5, 6),
+            (6, 7),
+            (7, 8),
+            (8, 9),
+            (9, 10),
+            (10, 11),
+        ]