Skip to content

Commit 8c8590f

Browse files
committed
Bugfix
1 parent c759633 commit 8c8590f

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

cube/api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ def __call__(self, text: Union[str, Document], flavour: Optional[str] = None):
126126
self._lm_helper.apply(doc)
127127
self._parser.process(doc, self._parser_collate, num_workers=0)
128128
self._lemmatizer.process(doc, self._lemmatizer_collate, num_workers=0)
129+
for seq in doc.sentences:
130+
for w in seq.words:
131+
if w.upos =='PUNCT':
132+
w.lemma = w.word
129133
return doc
130134

131135

cube/networks/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ def forward(self, X):
137137
for ii in range(len(x_word_emb_packed)):
138138
we = unpack(x_word_emb_packed[ii], sl, x_sents.shape[1], self._get_device())
139139
if word_emb_ext is None:
140-
word_emb_ext = self._ext_proj[ii](we)
140+
word_emb_ext = self._ext_proj[ii](we.float())
141141
else:
142-
word_emb_ext = word_emb_ext + self._ext_proj[ii](we)
142+
word_emb_ext = word_emb_ext + self._ext_proj[ii](we.float())
143143

144144
word_emb_ext = word_emb_ext / len(x_word_emb_packed)
145145
word_emb_ext = torch.tanh(word_emb_ext)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def parse_requirements(filename, session=None):
99

1010
setuptools.setup(
1111
name="nlpcube",
12-
version="0.3.1.0",
12+
version="0.3.1.1",
1313
author="Multiple authors",
1414
author_email="[email protected]",
1515
description="Natural Language Processing Toolkit with support for tokenization, sentence splitting, lemmatization, tagging and parsing for more than 60 languages",

0 commit comments

Comments
 (0)