AttributeError: 'itertools.chain' object has no attribute 'lookup'
nltk version: 3.7.
python version: 3.9.15
From the following code:

```
padded_line = [list(pad_both_ends(word_tokenize(input_text), n=N))]
train_data, vocab = padded_everygram_pipeline(order=N, text=padded_line)
lm = Lidstone(gamma=0.2, vocabulary=vocab, order=N)
lm.fit(text=train_data)
```

where input_text is a long string and N as in the Ngram model. From the last line of code above, I get the following error:

>lm.fit(text=train_data)
>  File "env\\lib\\site-packages\\nltk\\lm\\api.py", line 110, in fit
>  self.counts.update(self.vocab.lookup(sent) for sent in text)
>  File "env\\lib\\site-packages\\nltk\\lm\\counter.py", line 115, in update
>    for sent in ngram_text:
>  File "env\\lib\\site-packages\\nltk\\lm\\api.py", line 110, in <genexpr>
>    self.counts.update(self.vocab.lookup(sent) for sent in text)
> AttributeError: 'itertools.chain' object has no attribute 'lookup'

Can anyone fix this error for me?
diff --git a/nltk/lm/api.py b/nltk/lm/api.py
index e7a6dca1b..bf1322aca 100644
--- a/nltk/lm/api.py
+++ b/nltk/lm/api.py
@@ -7,6 +7,7 @@
 """Language Model Interface."""
 
 import random
+import warnings
 from abc import ABCMeta, abstractmethod
 from bisect import bisect
 from itertools import accumulate
@@ -83,7 +84,7 @@ class LanguageModel(metaclass=ABCMeta):
             of creating a new one when training.
         :type vocabulary: `nltk.lm.Vocabulary` or None
         :param counter: If provided, use this object to count ngrams.
-        :type vocabulary: `nltk.lm.NgramCounter` or None
+        :type counter: `nltk.lm.NgramCounter` or None
         :param ngrams_fn: If given, defines how sentences in training text are turned to ngram
             sequences.
         :type ngrams_fn: function or None
@@ -91,6 +92,12 @@ class LanguageModel(metaclass=ABCMeta):
         :type pad_fn: function or None
         """
         self.order = order
+        if vocabulary and not isinstance(vocabulary, Vocabulary):
+            warnings.warn(
+                f"The `vocabulary` argument passed to {self.__class__.__name__!r} "
+                "must be an instance of `nltk.lm.Vocabulary`.",
+                stacklevel=3,
+            )
         self.vocab = Vocabulary() if vocabulary is None else vocabulary
         self.counts = NgramCounter() if counter is None else counter
 
['nltk/lm/api.py']