akutuzov / webvectors

Web-ify your word2vec: framework to serve distributional semantic models online
http://vectors.nlpl.eu/explore/embeddings/
GNU General Public License v3.0
196 stars 49 forks source link

Add missing function def in tutorial #52

Closed konstantinbarkalov closed 3 years ago

konstantinbarkalov commented 3 years ago

num_replace is used in process function few step later.

Otherwise it will fail on proccessing text with digits:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-17-f80be2d2f8a4> in <module>
----> 1 output = process(process_pipeline, text='привет, как твои дела, засранец, 1000 лет не видел тебя', keep_pos=True, keep_punct=False)
      2 output

<ipython-input-10-5cbbe2657eda> in process(pipeline, text, keep_pos, keep_punct)
     52             if not named:
     53                 if pos == 'NUM' and token.isdigit():  # Заменяем числа на xxxxx той же длины
---> 54                     lemma = num_replace(token)
     55                 tagged_propn.append('%s_%s' % (lemma, pos))
     56             else:

NameError: name 'num_replace' is not defined
akutuzov commented 3 years ago

Thanks!