You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i use melt_tagger in a class. The sentence to analyze is sent with socketio
import spacy
import sys
import random
from spacy_lefff import LefffLemmatizer, POSTagger
import socketio
class SomeClass():
def __init__(self):
self.nlp = spacy.load('fr')
self.pos = POSTagger() # comments in console
self.french_lemmatizer = LefffLemmatizer(
after_melt=True, default=False)
self.nlp.add_pipe(self.pos, name='pos', after='parser')
self.nlp.add_pipe(self.french_lemmatizer, name='lefff', after='pos')
def analyze(self, param1):
self.doc = self.nlp(param1)
for d in self.doc:
print(d.text, d.pos_, d._.melt_tagger)
# --- Socket
sio = socketio.Client()
@sio.on('connect', namespace='/test')
def on_connect():
print('--> connection established')
@sio.on('disconnect', namespace='/test')
def on_disconnect():
print('--> disconnected from server')
@sio.on('myevent', namespace='/test')
def on_message(data):
print(' Received message : ', data['spoken'])
obj1.analyze(data['spoken'])
sio.connect('http://localhost:7000', namespaces=['/test'])
obj1 = SomeClass()
sio.wait()
On the first try with data[''spoken"] equals to 'les carottes et les radis sont des légumes',
the console prints :
Received message : {'spoken': ' les carottes et les radis sont des légumes'}
2019-09-04 12:43:21,766 - spacy_lefff.melt_tagger - INFO - TAGGER: POS Tagging...
les DET DET
carottes NOUN NC
et CCONJ CC
les DET DET
radis NOUN NC
sont AUX V
des DET DET
légumes NOUN NC
The next tries print in console :
Received message : {'spoken': ' les carottes et les radis sont des légumes'}
2019-09-04 12:43:27,007 - spacy_lefff.melt_tagger - INFO - TAGGER: POS Tagging...
les DET None
carottes NOUN None
et CCONJ None
les DET None
radis NOUN None
sont AUX None
des DET None
légumes NOUN None
d.text, d.pos_ work on every request, melt_taggerdoesn't.
The text was updated successfully, but these errors were encountered:
Hello,
i use
melt_tagger
in a class. The sentence to analyze is sent with socketioOn the first try with
data[''spoken"]
equals to'les carottes et les radis sont des légumes'
,the console prints :
The next tries print in console :
d.text
,d.pos_
work on every request,melt_tagger
doesn't.The text was updated successfully, but these errors were encountered: