File "stringsource", line 15, in string.from_py.__pyx_convert_string_from_py_std__in_string TypeError: expected bytes, tuple found
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 42/100
Direzione di ricerca
Start with pycrfsuite/_pycrfsuite.pyx at BaseTrainer.append and to_item, then check the trainer API documentation to confirm the expected feature and label types. Reproduce the call using the provided example and identify which value is a tuple where bytes are expected. Done means the accepted input format is clear and the example either works or reports the incompatibility precisely.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I am getting following error while testing the py CRf suite.
crftrainer.append(xseq, yseq)
File "pycrfsuite/_pycrfsuite.pyx", line 312, in pycrfsuite._pycrfsuite.BaseTrainer.append
File "stringsource", line 48, in vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_string
File "pycrfsuite/_pycrfsuite.pyx", line 53, in pycrfsuite._pycrfsuite.to_item
File "stringsource", line 15, in string.from_py.__pyx_convert_string_from_py_std__in_string
TypeError: expected bytes, tuple found
This is the code I am using It can be used for replicating the error.
train_sentlist = [ BOS I would like to meet Jack EOS]
[def features(sentence, index):
print( sentence, "\t", index)
k = {
'word': sentence[index],
'is_first': index == 0,
'is_last': index == len(sentence) - 1,
'is_capitalized': sentence[index][0].upper() == sentence[index][0],
'is_all_caps': sentence[index].upper() == sentence[index],
'is_all_lower': sentence[index].lower() == sentence[index],
'prefix-1': sentence[index][0],
'prefix-2': sentence[index][:2],
'prefix-3': sentence[index][:3],
'suffix-1': sentence[index][-1],
'suffix-2': sentence[index][-2:],
'suffix-3': sentence[index][-3:],
'prev_word': '' if index == 0 else sentence[index - 1],
'next_word': '' if index == len(sentence) - 1 else sentence[index + 1]
}
return k
for sent in train_sentlist:
sent.remove("EOS")
sent.remove("BOS")
Train_list.append(sent)
X=[]
for tagged in Train_list:
X.append([features(tagged, index) for index in range(len(tagged))])
crftrainer = pycrfsuite.Trainer(verbose=False)
for xseq, yseq in zip(X, t_nerlist):
crftrainer.append(xseq, yseq)
crftrainer.set_params({
'c1': 1.0, # coefficient for L1 penalty
'c2': 1e-3, # coefficient for L2 penalty
'max_iterations': 200, # stop earlier
'feature.possible_transitions': True
})
crftrainer.train("model/nermodel.crfsuite")](url)
- 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di scrapinghub/python-crfsuite
-
no wheels for python 3.14Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
scrapinghub/python-crfsuite#167 · 2 commenti · 2 reazioni ·
-
CRFsuite training too slowAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
scrapinghub/python-crfsuite#142 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
scrapinghub/python-crfsuite#129 · 1 commento · 2 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
scrapinghub/python-crfsuite#119 · 1 commento · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
scrapinghub/python-crfsuite#114 ·
Tutte le issue di scrapinghub/python-crfsuite
Issue simili
-
[19.0] pos_sale: settling an order with a 0 down payment line crashes (reading 'reward_id') and leaves a wrong amount dueForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 79/100
developmentseed/titiler-covjson#164 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
awslabs/visual-asset-management-system#2164 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
MakazhanAlpamys/Soup#3589 ·
I maintainer di solito rispondono entro 1 giorno
-
channels status reports the wrong Enabled value for Feishu instances and default-enabled WebSocketAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno