Inconsistent behaviour of multi-word patterns
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.9k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
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.
Assessment
- Tech stack
- python
- Domain
- search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100