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

123456789101112131415161718192021222324252627282930313233343536373839
  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 int Priority => 101;
  17. public bool Enabled { get; set; } = true;
  18. public bool ImportGraph { get; set; } = false;
  19. public string Name => "bi-LSTM + CRF NER";
  20. public bool Run()
  21. {
  22. PrepareData();
  23. return false;
  24. }
  25. public void PrepareData()
  26. {
  27. var hp = new HyperParams("BiLstmCrfNer");
  28. hp.filepath_words = Path.Combine(hp.data_root_dir, "vocab.words.txt");
  29. hp.filepath_chars = Path.Combine(hp.data_root_dir, "vocab.chars.txt");
  30. hp.filepath_tags = Path.Combine(hp.data_root_dir, "vocab.tags.txt");
  31. hp.filepath_glove = Path.Combine(hp.data_root_dir, "glove.npz");
  32. }
  33. }
  34. }