tagger.info() cannot read multi-line matrices

Aperta
#71 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
numpy, python
Ambito
backend

Direzione di ricerca

Read pycrfsuite/_dumpparser.py, especially the attribute parsing logic at lines 72–74, and reproduce the failure with a CRF feature containing a multi-line NumPy matrix. Check how tagger.info() output is parsed and compare it with the matrix representation. Done means matrix features can be parsed without the reported missing-regex-group error.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Not sure this is a bug, or a feature request, but I shall still write it down as more people would definitely be experiencing this.

When the features of a crf also contain numpy matrices, like the word2vec vector of a word; the tagger.info() is not being able to recognize them, as the regex pattern is not recognized. The error thrown due to the unavailability of a detected regex group looks like this:

Traceback (most recent call last):
  File "test_dumpparser.py", line 8, in <module>
    parser.feed(line.decode('utf8'))
  File "/Library/Python/2.7/site-packages/pycrfsuite/_dumpparser.py", line 62, in feed
    getattr(self, 'parse_%s' % self.state)(line)
  File "/Library/Python/2.7/site-packages/pycrfsuite/_dumpparser.py", line 74, in parse_ATTRIBUTES
    self.result.attributes[m.group(2)] = m.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

This is due to the parsing logic in the _dumpparser.py file.

A solution for that would be to encode the matrix and then, pass it into the CRF model as a feature.
(base64.b64encode(narray))

Lingua principale
Python
Stelle
774
Fork
223
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di scrapinghub/python-crfsuite

Tutte le issue di scrapinghub/python-crfsuite

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.