Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions ner/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def tag_text(self, text):
:param text: raw text string to tag
:returns: tagged text in given output format
"""
for s in ('\f', '\n', '\r', '\t', '\v'): #strip whitespaces
text = text.replace(s, '')
text = re.sub(r'\s+', ' ', text) #collapse whitespaces
text += '\n' #ensure end-of-line
with tcpip4_socket(self.host, self.port) as s:
if not isinstance(text, bytes):
Expand Down Expand Up @@ -147,8 +146,7 @@ def tag_text(self, text):
:param text: raw text strig to tag
:returns: tagged text in given output format
"""
for s in ('\f', '\n', '\r', '\t', '\v'): #strip whitespaces
text = text.replace(s, '')
text = re.sub(r'\s+', ' ', text) #collapse whitespaces
text += '\n' #ensure end-of-line
with http_connection(self.host, self.port) as c:
headers = {'Content-type': 'application/x-www-form-urlencoded', 'Accept' : 'text/plain'}
Expand Down