Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolution issue #3001 #3018

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions nltk/corpus/reader/verbnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def __init__(self, root, fileids, wrap_etree=False):
# runs 2-30 times faster.
self._quick_index()

_LONGID_RE = re.compile(r"([^\-\.]*)-([\d+.\-]+)$")
_LONGID_RE = re.compile(r"[a-zA-Z]*-[\d]*.[\d]*|[a-zA-Z]*-[\d]*-[\d]*")
"""Regular expression that matches (and decomposes) longids"""

_SHORTID_RE = re.compile(r"[\d+.\-]+$")
_SHORTID_RE = re.compile(r"[\d]*.[\d]*|[\d]*-[\d]*")
"""Regular expression that matches shortids"""

_INDEX_RE = re.compile(
Expand Down Expand Up @@ -315,8 +315,8 @@ def _quick_index(self):
def longid(self, shortid):
"""Returns longid of a VerbNet class

Given a short VerbNet class identifier (eg '37.10'), map it
to a long id (eg 'confess-37.10'). If ``shortid`` is already a
Given a short VerbNet class identifier (eg '37.10', '37-10'), map it
to a long id (eg 'confess-37.10', 'confess-37-10'). If ``shortid`` is already a
long id, then return it as-is"""
if self._LONGID_RE.match(shortid):
return shortid # it's already a longid.
Expand Down