aonotas / deep-crf

An implementation of Conditional Random Fields (CRFs) with Deep Learning Method
http://deep-crf.com
MIT License
168 stars 48 forks source link

Enable combination of input data and prediction result #25

Open massongit opened 7 years ago

massongit commented 7 years ago

In this tool's prediction results, only predicted labels are displayed now. However, I think that it is more convenient to be able to also display input data.

For Example (--enable_combined_input is option of combination of input data and prediction result):

$ cat predict input_file_multi.txt
Barack  NN
Hussein NN 
Obama   NN
is      VBZ
a       DT
man     NN 
.       . 

Yuji  NN B−PERSON 
Matsumoto NN E−PERSON 
is      VBZ O 
a       DT  O 
man     NN  O 
.       .   O
$ deep-crf predict input_file_multi.txt --delimiter=' ' --input_idx 0,1 --output_idx 2 --model_filename ./save_model_dir/bilstm-cnn-crf_multi_epoch3.model --save_dir save_model_dir --save_name bilstm-cnn-crf_multi  --predicted_output predicted.txt --enable_combined_input
$ cat predicted.txt
Barack  NN B−PERSON 
Hussein NN I−PERSON 
Obama   NN E−PERSON
is      VBZ O 
a       DT  O 
man     NN  O 
.       .   O

Yuji  NN B−PERSON 
Matsumoto NN E−PERSON 
is      VBZ O 
a       DT  O 
man     NN  O 
.       .   O
aonotas commented 7 years ago

OK. Thank you for your help! I don't have time time, I will reply and merge your some PR tomorrow.

indiclinguist commented 6 years ago

Is this option --enable_combined_input implemented? if so, what is the usage command for getting the output_idx as 0,2 (word, chunk) in case of the training data is in 0,1,2 (word, pos, chunk) format? Thanks in advance.