Skip to content

Commit

Permalink
text consistency errors are too hard to debug currently, added more f…
Browse files Browse the repository at this point in the history
…eedback in error/warning
  • Loading branch information
proycon committed May 23, 2018
1 parent 4e0507f commit ecaca49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pynlpl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
The library is divided into several packages and modules. It is designed for Python 2.6 and upwards. Including Python 3."""

VERSION = "1.2.6"
VERSION = "1.2.7"
7 changes: 6 additions & 1 deletion pynlpl/formats/folia.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,12 @@ def textvalidation(self, warnonly=None):
deepnormtext = self.text(cls,retaintokenisation=False,strict=False, normalize_spaces=True)
if strictnormtext != deepnormtext:
valid = False
msg = "Text for " + self.__class__.__name__ + ", ID " + str(self.id) + ", class " + cls + ", is inconsistent: expected (after normalization): '" + deepnormtext + "', got (after normalization): '" + strictnormtext + "'"
deviation = 0
for i, (c1,c2) in enumerate(zip(strictnormtext,deepnormtext)):
if c1 != c2:
deviation = i
break
msg = "Text for " + self.__class__.__name__ + ", ID " + str(self.id) + ", class " + cls + ", is inconsistent: EXPECTED (after normalization) *****>\n" + deepnormtext + "\n****> BUT FOUND (after normalization) ****>\n" + strictnormtext + "\n******* DEVIATION POINT: " + strictnormtext[min(0,deviation-10):deviation] + "<*HERE*>" + strictnormtext[deviation:deviation+10]
if warnonly:
print("TEXT VALIDATION ERROR: " + msg,file=sys.stderr)
else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def read(fname):

setup(
name = "PyNLPl",
version = "1.2.6", #edit version in __init__.py as well and ensure tests/folia.py FOLIARELEASE points to the right version and is not set to None!
version = "1.2.7", #edit version in __init__.py as well and ensure tests/folia.py FOLIARELEASE points to the right version and is not set to None!
author = "Maarten van Gompel",
author_email = "proycon@anaproy.nl",
description = ("PyNLPl, pronounced as 'pineapple', is a Python library for Natural Language Processing. It contains various modules useful for common, and less common, NLP tasks. PyNLPl contains modules for basic tasks, clients for interfacting with server, and modules for parsing several file formats common in NLP, most notably FoLiA."),
Expand Down

0 comments on commit ecaca49

Please sign in to comment.