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.

ITextTransform.cs 832 B

12345678910111213141516171819202122232425262728293031
  1. using System.Text.Json.Serialization;
  2. using LLama.Common;
  3. namespace LLama.Abstractions
  4. {
  5. /// <summary>
  6. /// An interface for text transformations.
  7. /// These can be used to compose a pipeline of text transformations, such as:
  8. /// - Tokenization
  9. /// - Lowercasing
  10. /// - Punctuation removal
  11. /// - Trimming
  12. /// - etc.
  13. /// </summary>
  14. [JsonConverter(typeof(PolymorphicJSONConverter<ITextTransform>))]
  15. public interface ITextTransform
  16. {
  17. /// <summary>
  18. /// Takes a string and transforms it.
  19. /// </summary>
  20. /// <param name="text"></param>
  21. /// <returns></returns>
  22. string Transform(string text);
  23. /// <summary>
  24. /// Copy the transform.
  25. /// </summary>
  26. /// <returns></returns>
  27. ITextTransform Clone();
  28. }
  29. }