tagger.info() cannot read multi-line matrices

オープン
#71 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
numpy, python
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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))

主要言語
Python
スター
774
フォーク
223
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

scrapinghub/python-crfsuite のほかの issue

scrapinghub/python-crfsuite の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。