You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

BiLstmCrfNer.cs 1.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.IO;
  3. using Tensorflow;
  4. using Tensorflow.Estimator;
  5. namespace TensorFlowNET.Examples
  6. {
  7. /// <summary>
  8. /// Bidirectional LSTM-CRF Models for Sequence Tagging
  9. /// https://github.com/guillaumegenthial/tf_ner/tree/master/models/lstm_crf
  10. /// </summary>
  11. public class BiLstmCrfNer : IExample
  12. {
  13. public bool Enabled { get; set; } = false;
  14. public bool IsImportingGraph { get; set; } = false;
  15. public string Name => "bi-LSTM + CRF NER";
  16. public bool Run()
  17. {
  18. PrepareData();
  19. return false;
  20. }
  21. public void PrepareData()
  22. {
  23. var hp = new HyperParams("BiLstmCrfNer");
  24. hp.filepath_words = Path.Combine(hp.data_root_dir, "vocab.words.txt");
  25. hp.filepath_chars = Path.Combine(hp.data_root_dir, "vocab.chars.txt");
  26. hp.filepath_tags = Path.Combine(hp.data_root_dir, "vocab.tags.txt");
  27. hp.filepath_glove = Path.Combine(hp.data_root_dir, "glove.npz");
  28. }
  29. public Graph ImportGraph()
  30. {
  31. throw new NotImplementedException();
  32. }
  33. public Graph BuildGraph()
  34. {
  35. throw new NotImplementedException();
  36. }
  37. public void Train(Session sess)
  38. {
  39. throw new NotImplementedException();
  40. }
  41. public void Predict(Session sess)
  42. {
  43. throw new NotImplementedException();
  44. }
  45. public void Test(Session sess)
  46. {
  47. throw new NotImplementedException();
  48. }
  49. }
  50. }