Skip to content

AttributeError: 'float' object has no attribute 'decode' #15

@slobLX

Description

@slobLX

So sorry to bother you again...

when I use "train()"

the error occur:
Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model cost 0.173 seconds.
Prefix dict has been built succesfully.

Traceback (most recent call last):
File "", line 1, in
File "interrogative/api.py", line 17, in train
model.train()
File "interrogative/model.py", line 76, in train
self.initialize_model()
File "interrogative/model.py", line 31, in initialize_model
train, label = self.corpus.generator()
File "interrogative/corpus.py", line 62, in generator
corpus = cls.read_corpus_from_file(corpus_path)
File "interrogative/corpus.py", line 34, in perform_word_segment
tokenizer = jieba.Tokenizer()
File "/home1/liuxin/anaconda3/envs/py27/lib/python2.7/site-packages/pandas/core/series.py", line 3591, in apply
mapped = lib.map_infer(values, f, convert=convert_dtype)
File "pandas/_libs/lib.pyx", line 2217, in pandas._libs.lib.map_infer
File "interrogative/corpus.py", line 34, in
tokenizer = jieba.Tokenizer()
File "/home1/liuxin/.local/lib/python2.7/site-packages/jieba/init.py", line 282, in cut
sentence = strdecode(sentence)
File "/home1/liuxin/.local/lib/python2.7/site-packages/jieba/_compat.py", line 37, in strdecode
sentence = sentence.decode('utf-8')
AttributeError: 'float' object has no attribute 'decode'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions