clips / pattern

Web mining module for Python, with tools for scraping, natural language processing, machine learning, network analysis and visualization.
https://github.com/clips/pattern/wiki
BSD 3-Clause "New" or "Revised" License
8.76k stars 1.58k forks source link

In Python 2.7, taxonomy based search doesn't work #256

Open IntelliMind opened 5 years ago

IntelliMind commented 5 years ago
from pattern.search import search, taxonomy, Classifier
from pattern.en import parsetree

for flower in ("rose", "lily", "daisy", "daffodil", "begonia"):
      taxonomy.append(flower, type="flower")

tree = parsetree("A field of white daffodils.", lemmata=True) 
result = search("FLOWER", t)                              # TypeError: can't compile 'str' object

The search function fails in 2.7, whereas it works in 3.6.4