<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Bigram tagging with HMMs
Implementation of bigram part-of speech (POS) tagger based on first-order hidden
Markov models from scratch.
Step1:  Let's try with some toy data
Example taken from Borodovsky & Ekisheva (2006), pp 80-81
Step2:  Everything seems to go Ok!
Model training
Now, estimate model parameters.
Next step take some time, you can go for a coffee.
Result is saved on de-model.npz a file in numpy zip format.
Step3:  Model Evaluation
Let's generate a tagged corpus for new data
Step4:  Now, try the evaluation script
<ASSISTANT_TASK:>
Python Code:
!pwd
%load_ext ipycache
Explanation: Bigram tagging with HMMs
Implementation of bigram part-of speech (POS) tagger based on first-order hidden
Markov models from scratch.
End of explanation
from bigram_tagging import testing_viterbi
testing_viterbi()
Explanation: Let's try with some toy data
Example taken from Borodovsky & Ekisheva (2006), pp 80-81
End of explanation
from bigram_tagging import train
%%cache model.pkl start_f, trans_f, emit_f, obs_states
start_f, trans_f, emit_f, obs_states = train("de-train.tt")
Explanation: Everything seems to go Ok!
Model training
Now, estimate model parameters.
Next step take some time, you can go for a coffee.
Result is saved on de-model.npz a file in numpy zip format.
End of explanation
from bigram_tagging import evaluate_model, add_one_smoothing
%%cache test_corpus.pkl sents, t_sents
sents, t_sents = evaluate_model("de-test.t", start_f, trans_f, emit_f, obs_states, add_one_smoothing)
from bigram_tagging import write_corpus
write_corpus("de-test.tt", sents, t_sents)
Explanation: Model Evaluation
Let's generate a tagged corpus for new data
End of explanation
!python eval.py de-test.tt de-eval.tt
Explanation: Now, try the evaluation script
End of explanation
<END_TASK>