我不确定这与Anaconda有何关系,但是以下方法对我在Python 3.6中使用pattern.en非常有效:
git clone -b development https://github.com/clips/pattern
cd pattern
sudo python3.6 setup.py install
https://github.com/clips/pattern/issues/62
在我的Mac(10.11.6)上安装过程中出现了一些SSL错误,通过在Python(3.6)中运行以下代码进行修复:
import nltk
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
nltk.download('wordnet_ic')
显然有更好的方法来处理像这样的SSL问题,供参考:
https://dev59.com/7lgR5IYBdhLWcg3wbcv1#41351871
检查一下:
user@USDR00253 ~> python3.6
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from pattern.en import conjugate, lemma, lexeme, parse
>>>
>>> print(parse('ridden', relations=True, lemmata=True))
ridden/VBN/B-VP/O/O/ride
>>>
pattern.en 最终在 python3 中运行!