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.5 kB

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