ContentEntry.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Speech.text {
  5. public class ContentEntry {
  6. private eMood _mood;
  7. private string _text;
  8. private string _pronounced;
  9. private List<ushort> _tags;
  10. private float _score; // TODO: Scoring einbauen
  11. public ContentEntry(string Text) {
  12. this._text = Text;
  13. this._mood = eMood.All;
  14. this._tags = new List<ushort>();
  15. }
  16. public ContentEntry(string Text, eMood Mood) {
  17. this._text = Text;
  18. this._mood = Mood;
  19. this._tags = new List<ushort>();
  20. }
  21. public ContentEntry(string Text, eMood Mood, ushort[] Tags) {
  22. this._text = Text;
  23. this._mood = Mood;
  24. this._tags = new List<ushort>(Tags);
  25. }
  26. public void AddTag(ushort s) {
  27. if(!this._tags.Contains(s)) {
  28. this._tags.Add(s);
  29. }
  30. }
  31. public int TagCount {
  32. get {
  33. return this._tags.Count;
  34. }
  35. }
  36. public void RemoveTag(ushort tag) {
  37. this._tags.Remove(tag);
  38. }
  39. public ushort[] Tags {
  40. get {
  41. return this._tags.ToArray();
  42. }
  43. set {
  44. this._tags = new List<ushort>(value);
  45. }
  46. }
  47. public string Text {
  48. get {
  49. return this._text;
  50. }
  51. set {
  52. this._text = value;
  53. }
  54. }
  55. public eMood Mood {
  56. get {
  57. return this._mood;
  58. }
  59. set {
  60. this._mood = value;
  61. }
  62. }
  63. public string Pronounced {
  64. get {
  65. if(this._pronounced=="") {
  66. if (this.GeneratePronounce())
  67. return this._pronounced;
  68. }
  69. return this._text;
  70. }
  71. set => this._pronounced = value;
  72. }
  73. public bool HasTags(ushort tag) {
  74. return this._tags.Contains(tag);
  75. }
  76. public bool HasTags(ushort[] tags) {
  77. foreach (ushort t in tags)
  78. if (!this._tags.Contains(t))
  79. return false;
  80. return true;
  81. }
  82. public override string ToString() {
  83. return this._text;
  84. }
  85. private bool GeneratePronounce() {
  86. // Todo pronouncing the text
  87. return false;
  88. }
  89. }
  90. }