generate_rank_conf.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #! /usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # vim:fenc=utf-8
  4. #
  5. # Copyright © 2024 StrayWarrior <i@straywarrior.com>
  6. """
  7. Generate rank strategy configuration.
  8. """
  9. import json
  10. enable_category_accounts = {
  11. "gh_1d887d61088c",
  12. "gh_192c9cf58b13",
  13. "gh_080bb43aa0dc",
  14. "gh_084a485e859a",
  15. "gh_0c89e11f8bf3",
  16. "gh_183d80deffb8",
  17. "gh_1b27dd1beeca",
  18. "gh_29074b51f2b7",
  19. "gh_3ed305b5817f",
  20. "gh_5ae65db96cb7",
  21. "gh_5ff48e9fb9ef",
  22. "gh_6b7c2a257263",
  23. "gh_6cfd1132df94",
  24. "gh_6d205db62f04",
  25. "gh_6d9f36e3a7be",
  26. "gh_72bace6b3059",
  27. "gh_7e5818b2dd83",
  28. "gh_7f5075624a50",
  29. "gh_89ef4798d3ea",
  30. "gh_68e7fdc09fe4",
  31. "gh_93e00e187787",
  32. "gh_b181786a6c8c",
  33. "gh_ac43e43b253b",
  34. # 12-09 stable
  35. "gh_31e523f45168",
  36. "gh_02f5bca5b5d9",
  37. "gh_8efee74f6569",
  38. "gh_98ec0ffe69b3",
  39. "gh_744cb16f6e16",
  40. "gh_30816d8adb52",
  41. "gh_6d3aa9d13402",
  42. "gh_bfea052b5baa",
  43. "gh_a221d1a952aa",
  44. "gh_1686250f15b6",
  45. "gh_adca24a8f429",
  46. "gh_749271f1ccd5",
  47. "gh_03d45c260115",
  48. "gh_a61d7ae2e594",
  49. "gh_de9f9ebc976b",
  50. "gh_57573f01b2ee",
  51. "gh_03d32e83122f",
  52. "gh_4f6bfd731ac8",
  53. "gh_969f5ea5fee1",
  54. "gh_ac43eb24376d",
  55. "gh_2e615fa75ffb",
  56. "gh_26a307578776",
  57. }
  58. def generate_base():
  59. config = {
  60. "ArticleRankV5": {
  61. "default": {
  62. "1": {
  63. "CategoryStrategy": 1
  64. },
  65. "3": {
  66. "CategoryStrategy": 0.1
  67. }
  68. }
  69. },
  70. "ArticleRankV12": {
  71. "default": {
  72. "1": {
  73. "HisFissionDeWeightAvgReadSumRateStrategy": 0.3
  74. },
  75. "3": {
  76. "CategoryStrategy": 0.1
  77. }
  78. }
  79. },
  80. "ArticleRankV11": {
  81. "default": {
  82. "1": {
  83. "HisFissionAvgReadRateRateStrategy": 0.3
  84. },
  85. "3": {
  86. "CategoryStrategy": 0.1
  87. }
  88. }
  89. },
  90. "ArticleRankInfinite": {
  91. "default": {
  92. "1": {
  93. "CategoryStrategy": 1
  94. },
  95. "2": {
  96. "CategoryStrategy": 1
  97. },
  98. "3": {
  99. "CategoryStrategy": 0.1
  100. }
  101. }
  102. }
  103. }
  104. return config
  105. def generate_category_experiment(config):
  106. for account in enable_category_accounts:
  107. config["ArticleRankV5"][account] = {
  108. "1": {
  109. "CategoryStrategy": 1
  110. },
  111. "3": {
  112. "CategoryStrategy": 0.1
  113. }
  114. }
  115. return config
  116. def main():
  117. config = generate_base()
  118. # config = generate_category_experiment(config)
  119. print(json.dumps(config, indent=2))
  120. if __name__ == '__main__':
  121. main()