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.

TextInterface.cs 1.2 kB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Tensorflow.Text.Tokenizers;
  5. namespace Tensorflow.Text
  6. {
  7. public class TextInterface
  8. {
  9. public ITokenizer WhitespaceTokenizer()
  10. => new WhitespaceTokenizer();
  11. public Tensor wordshape(Tensor input, WordShape pattern, string name = null)
  12. => TextOps.wordshape(input, pattern, name: name);
  13. /// <summary>
  14. /// Create a tensor of n-grams based on the input data `data`.
  15. /// </summary>
  16. /// <param name="input"></param>
  17. /// <param name="width"></param>
  18. /// <param name="axis"></param>
  19. /// <param name="reduction_type"></param>
  20. /// <param name="string_separator"></param>
  21. /// <param name="name"></param>
  22. /// <returns></returns>
  23. public static Tensor ngrams(Tensor input, int width,
  24. int axis = -1,
  25. Reduction reduction_type = Reduction.None,
  26. string string_separator = " ",
  27. string name = null)
  28. => TextOps.ngrams(input, width,
  29. axis: axis,
  30. reduction_type: reduction_type,
  31. string_separator: string_separator,
  32. name: name);
  33. }
  34. }