Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Inconsistent behaviour of multi-word patterns

Open
#143 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
search

Research direction

Start with the reproduced calls to Pattern.fromstring() and search() in pattern.text.search, comparing the working “Windows Vista” pattern with the failing “is the best” pattern. Determine whether multi-word patterns are intended to support these word classes; done means either matching both examples correctly or documenting the supported limitation.

Written by the indexing model from the issue text.

Description

The Constraint syntax for multi-word expressions ("[ ]") only works for certain word classes (educated guess: noun phrase components?). Compare:

from pattern.text.search import search
from pattern.text.search import Pattern

txt = parsetree('Windows Vista is the best OS ever!')
pat = Pattern.fromstring('[Mac OS X | Windows Vista]')
print search(pat, txt)

[Match(words=[Word(u'Windows/NNP'), Word(u'Vista/NNP')])]

pat = Pattern.fromstring('[is the best | is the worst]')
print search(pat, txt)

[]

If this is intentional, the documentation should be updated accordingly. Otherwise, this is a bug in pattern matching.

Dominant language
Python
Stars
8.9k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from clips/pattern

All issues in clips/pattern

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.