์๋ ํ์ธ์,
nltk.hmm
๋ชจ๋์์ train_unsupervised
๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ ค๊ณ ํ๋๋ฐ ๋ค์๊ณผ ๊ฐ์ TypeError๊ฐ ๋ฐ์ํฉ๋๋ค.
TypeError: Can't instantiate abstract class RandomProbDist with abstract methods max
๋ด๊ฐ ์ฌ์ฉํ๋ ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
import nltk
trainer = nltk.hmm.HiddenMarkovModelTrainer()
tagger = trainer.train_unsupervised([
('a', ''),
('b', ''),
('c', '')
])
์ ์ฒด ์ค๋ฅ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
Traceback (most recent call last):
File "test.py", line 10, in <module>
('c', '')
File "/Library/Python/2.7/site-packages/nltk/tag/hmm.py", line 932, in train_unsupervised
priors = RandomProbDist(self._states)
TypeError: Can't instantiate abstract class RandomProbDist with abstract methods max
NLTK ๋ฒ์ 3.2.5; Python 2.7.10 ๋ฐ Python 2.7.14์์ ํ ์คํธ๋์์ต๋๋ค.
๋ด๊ฐ ์ด๋ฆฌ์์ ์๋ชป์ํ๊ณ ์๋๊ฐ?
๋๋จํ ๊ฐ์ฌํฉ๋๋ค.
์ด๊ฒ์ ๋ํ NLTK 3.2.5์ ํจ๊ป python 3.6.2๋ฅผ ์ฌ์ฉํ์ฌ ๋ฐ์ํฉ๋๋ค.
๋ฌธ์ # 1873์ ๋ํด ํ์ ์กฐ์น๋ฅผ ์ทจํ๊ณ ์์ต๋๋ค. ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
TypeError : ์ถ์ ๋ฉ์๋ max๋ก ์ถ์ ํด๋์ค RandomProbDist๋ฅผ ์ธ์คํด์คํ ํ ์ ์์ต๋๋ค.
NLTK ๋ฒ์ 3.2.4. ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ์ํ ์ปค๋ฐ์ด ๋ฒ์ 3.2.5์ ์์์ผ๋ฏ๋ก ๋ค์ด๋ก๋ํ์ง๋ง ์ฌ์ ํ ๋์ผํ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. ์ด์ ๋ ๋ฌด์์ ๋๊น?
git repo์ ์ ๋ฐ์ดํธ๋ ์์ง nltk pip ํจํค์ง์ ๋ฐ์๋์ง ์์์ต๋๋ค. ์ปค๋ฐ์์ ์ ๋ฐ์ดํธ๋ฅผ ๊ฐ์ ธ ์์ ์์ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ด๊ฒ์ ๋ํ NLTK 3.2.5์ ํจ๊ป python 3.6.2๋ฅผ ์ฌ์ฉํ์ฌ ๋ฐ์ํฉ๋๋ค.