koth/kcws

关于标注部分的问题

Closed this issue · 7 comments

大神好,我昨天仔细研究了您新添加的词性标注模块,然后我发现有几步好像有点问题,我自己尝试更改了一下,现在已经跑通了,99.57%的准确率,请您看看,问题如下:
1、在第五步骤,传入参数“lines_withpos.txt”,然而在代码里面并没有写入信息,我觉得应该得在代码里面添加 写入每个标注与其对应的序号。
2、在第六步骤,传入的第三个参数应该是上一步生成的词典“lines_withpos.txt”而不是”pos_vocab.txt“。

您看这样是正确的吗?

koth commented

你是不是没更新代码呢?

是的,我错了,没有更新代码 -!- 那看来我是自己在本地更新了一下您的代码!哈哈

用python3.6跑报错:
Traceback (most recent call last):
File "kcws/train/train_pos.py", line 348, in
tf.app.run()
File "/home/kinghuang/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "kcws/train/train_pos.py", line 311, in main
FLAGS.char_word2vec_path, FLAGS.num_hidden)
File "kcws/train/train_pos.py", line 80, in init
self.w2v = self.load_w2v(w2vPath, FLAGS.embedding_word_size)
File "kcws/train/train_pos.py", line 205, in load_w2v
line = fp.readline().strip()
File "/home/kinghuang/anaconda3/envs/tensorflow/lib/python3.6/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 4282-4283: invalid continuation byte

用python2.7跑报错:
Traceback (most recent call last):
File "kcws/train/train_pos.py", line 347, in
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 30, in run
sys.exit(main(sys.argv))
File "kcws/train/train_pos.py", line 312, in main
wX, cX, Y = inputs(trainDataPath)
File "kcws/train/train_pos.py", line 290, in inputs
features = tf.transpose(tf.stack(whole[0:FLAGS.max_sentence_len]))
AttributeError: 'module' object has no attribute 'stack'
麻烦问下是不是代码未更新的问题?

koth commented

@kinghuangdd 需要升级下你的TF到1.1+

好啦,谢谢大神!

@oneapmlj 你上面说的第二点是正确的吗? 在第6步中”pos_vocab.txt“换位“lines_withpos.txt”

@oneapmlj 你上面说的第二点是正确的吗? 在第6步中”pos_vocab.txt“换位“lines_withpos.txt”
是之前没有更新代码的原因!