bertrend 0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. bertrend/BERTopicModel.py +320 -0
  2. bertrend/BERTrend.py +1211 -0
  3. bertrend/__init__.py +59 -0
  4. bertrend/config/bertopic_default_config.toml +48 -0
  5. bertrend/config/bertrend_default_config.toml +16 -0
  6. bertrend/config/parameters.py +92 -0
  7. bertrend/config/services_default_config.toml +32 -0
  8. bertrend/demos/__init__.py +4 -0
  9. bertrend/demos/demos_utils/__init__.py +13 -0
  10. bertrend/demos/demos_utils/data_loading_component.py +267 -0
  11. bertrend/demos/demos_utils/embed_documents_component.py +52 -0
  12. bertrend/demos/demos_utils/icons.py +41 -0
  13. bertrend/demos/demos_utils/messages.py +11 -0
  14. bertrend/demos/demos_utils/parameters_component.py +162 -0
  15. bertrend/demos/demos_utils/state_utils.py +99 -0
  16. bertrend/demos/start_summarizer_app.sh +9 -0
  17. bertrend/demos/start_topic_analysis_app.sh +9 -0
  18. bertrend/demos/start_weak_signals_app.sh +9 -0
  19. bertrend/demos/summarization/__init__.py +4 -0
  20. bertrend/demos/summarization/summarizer_app.py +98 -0
  21. bertrend/demos/topic_analysis/__init__.py +4 -0
  22. bertrend/demos/topic_analysis/app.py +87 -0
  23. bertrend/demos/topic_analysis/app_utils.py +69 -0
  24. bertrend/demos/topic_analysis/demo_pages/__init__.py +4 -0
  25. bertrend/demos/topic_analysis/demo_pages/explore_topics.py +455 -0
  26. bertrend/demos/topic_analysis/demo_pages/newsletters_generation.py +178 -0
  27. bertrend/demos/topic_analysis/demo_pages/temporal_visualizations.py +573 -0
  28. bertrend/demos/topic_analysis/demo_pages/topic_visualizations.py +280 -0
  29. bertrend/demos/topic_analysis/demo_pages/training_page.py +219 -0
  30. bertrend/demos/topic_analysis/messages.py +13 -0
  31. bertrend/demos/weak_signals/__init__.py +4 -0
  32. bertrend/demos/weak_signals/app.py +510 -0
  33. bertrend/demos/weak_signals/messages.py +32 -0
  34. bertrend/demos/weak_signals/visualizations_utils.py +403 -0
  35. bertrend/llm_utils/__init__.py +4 -0
  36. bertrend/llm_utils/newsletter.css +131 -0
  37. bertrend/llm_utils/newsletter_features.py +272 -0
  38. bertrend/llm_utils/openai_client.py +235 -0
  39. bertrend/llm_utils/prompts.py +94 -0
  40. bertrend/metrics/__init__.py +4 -0
  41. bertrend/metrics/temporal_metrics_embedding.py +861 -0
  42. bertrend/metrics/topic_metrics.py +199 -0
  43. bertrend/resources/common_ngrams.json +23 -0
  44. bertrend/resources/stopwords-en.json +3 -0
  45. bertrend/resources/stopwords-fr.json +1 -0
  46. bertrend/resources/stopwords-rte.json +15 -0
  47. bertrend/services/__init__.py +4 -0
  48. bertrend/services/authentication.py +66 -0
  49. bertrend/services/embedding_client.py +154 -0
  50. bertrend/services/embedding_service.py +380 -0
  51. bertrend/services/summarizer.py +45 -0
  52. bertrend/services/summary/__init__.py +4 -0
  53. bertrend/services/summary/abstractive_summarizer.py +74 -0
  54. bertrend/services/summary/chatgpt_summarizer.py +67 -0
  55. bertrend/services/summary/extractive_summarizer.py +368 -0
  56. bertrend/services/summary/lexrank.py +126 -0
  57. bertrend/services/summary/prompts.py +43 -0
  58. bertrend/tests/__init__.py +4 -0
  59. bertrend/tests/test_abstractive_summarizer.py +140 -0
  60. bertrend/tests/test_bertrend.py +1091 -0
  61. bertrend/tests/test_cache_utils.py +111 -0
  62. bertrend/tests/test_chatgpt_summarizer.py +150 -0
  63. bertrend/tests/test_config_utils.py +54 -0
  64. bertrend/tests/test_data_loading.py +326 -0
  65. bertrend/tests/test_data_structure.py +53 -0
  66. bertrend/tests/test_embedding_client.py +546 -0
  67. bertrend/tests/test_extractive_summarizer.py +250 -0
  68. bertrend/tests/test_installation.py +183 -0
  69. bertrend/tests/test_newsletter_features.py +354 -0
  70. bertrend/tests/test_openai_client.py +210 -0
  71. bertrend/tests/test_representative_docs.py +125 -0
  72. bertrend/tests/test_summarizer.py +115 -0
  73. bertrend/tests/test_temporal_metrics_embedding.py +349 -0
  74. bertrend/tests/test_topic_description.py +159 -0
  75. bertrend/tests/test_topic_metrics.py +233 -0
  76. bertrend/tests/test_topic_model.py +285 -0
  77. bertrend/tests/test_trend_analysis_data_structure.py +174 -0
  78. bertrend/tests/test_trend_analysis_prompts.py +225 -0
  79. bertrend/tests/test_trend_analysis_visualizations.py +307 -0
  80. bertrend/tests/test_trend_analysis_weak_signals.py +598 -0
  81. bertrend/tests/test_utils_init.py +70 -0
  82. bertrend/tests/test_visualizations.py +306 -0
  83. bertrend/topic_analysis/__init__.py +4 -0
  84. bertrend/topic_analysis/data_structure.py +13 -0
  85. bertrend/topic_analysis/prompts.py +42 -0
  86. bertrend/topic_analysis/representative_docs.py +57 -0
  87. bertrend/topic_analysis/topic_description.py +66 -0
  88. bertrend/topic_analysis/visualizations.py +315 -0
  89. bertrend/trend_analysis/__init__.py +4 -0
  90. bertrend/trend_analysis/data_structure.py +78 -0
  91. bertrend/trend_analysis/prompts.py +229 -0
  92. bertrend/trend_analysis/signal_llm_template_en.html +181 -0
  93. bertrend/trend_analysis/signal_llm_template_fr.html +181 -0
  94. bertrend/trend_analysis/visualizations.py +605 -0
  95. bertrend/trend_analysis/weak_signals.py +425 -0
  96. bertrend/utils/__init__.py +31 -0
  97. bertrend/utils/cache_utils.py +31 -0
  98. bertrend/utils/config_utils.py +41 -0
  99. bertrend/utils/data_loading.py +329 -0
  100. bertrend-0.3.1.dist-info/AUTHORS.txt +15 -0
  101. bertrend-0.3.1.dist-info/LICENSE.md +373 -0
  102. bertrend-0.3.1.dist-info/METADATA +400 -0
  103. bertrend-0.3.1.dist-info/RECORD +181 -0
  104. bertrend-0.3.1.dist-info/WHEEL +4 -0
  105. bertrend_apps/__init__.py +4 -0
  106. bertrend_apps/common/__init__.py +4 -0
  107. bertrend_apps/common/crontab_utils.py +113 -0
  108. bertrend_apps/common/mail_utils.py +91 -0
  109. bertrend_apps/config/feeds/arxiv_feed.toml +15 -0
  110. bertrend_apps/config/feeds/decarbonation_feed.toml +15 -0
  111. bertrend_apps/config/feeds/llm_en_feed.toml +15 -0
  112. bertrend_apps/config/feeds/llm_feed.toml +16 -0
  113. bertrend_apps/config/feeds/nlp_feed.toml +15 -0
  114. bertrend_apps/config/feeds/rte_feed.toml +15 -0
  115. bertrend_apps/config/gmail_credentials.json +1 -0
  116. bertrend_apps/config/newsletters/arxiv_newsletter_from_last.toml +39 -0
  117. bertrend_apps/config/newsletters/arxiv_newsletter_from_scratch.toml +39 -0
  118. bertrend_apps/config/newsletters/decarbonation_newsletter_from_last.toml +38 -0
  119. bertrend_apps/config/newsletters/decarbonation_newsletter_from_scratch.toml +38 -0
  120. bertrend_apps/config/newsletters/llm_en_newsletter_from_last.toml +38 -0
  121. bertrend_apps/config/newsletters/llm_newsletter_from_last.toml +39 -0
  122. bertrend_apps/config/newsletters/nlp_newsletter_from_last.toml +38 -0
  123. bertrend_apps/config/newsletters/rte_newsletter_from_last.toml +38 -0
  124. bertrend_apps/config/newsletters/rte_newsletter_from_scratch.toml +38 -0
  125. bertrend_apps/data_provider/__init__.py +9 -0
  126. bertrend_apps/data_provider/__main__.py +237 -0
  127. bertrend_apps/data_provider/arxiv_provider.py +161 -0
  128. bertrend_apps/data_provider/bing_news_provider.py +82 -0
  129. bertrend_apps/data_provider/curebot_provider.py +105 -0
  130. bertrend_apps/data_provider/data_provider.py +194 -0
  131. bertrend_apps/data_provider/google_news_provider.py +94 -0
  132. bertrend_apps/data_provider/newscatcher_provider.py +74 -0
  133. bertrend_apps/data_provider/utils.py +165 -0
  134. bertrend_apps/exploration/__init__.py +4 -0
  135. bertrend_apps/exploration/curebot/__init__.py +4 -0
  136. bertrend_apps/exploration/curebot/app.py +45 -0
  137. bertrend_apps/exploration/curebot/app_utils.py +317 -0
  138. bertrend_apps/exploration/curebot/config.toml +33 -0
  139. bertrend_apps/exploration/curebot/import_extraction_article.ipynb +108 -0
  140. bertrend_apps/exploration/curebot/old_veille_analyse.py +298 -0
  141. bertrend_apps/exploration/curebot/prompts.py +24 -0
  142. bertrend_apps/exploration/curebot/start_newsletter_generator.sh +8 -0
  143. bertrend_apps/exploration/curebot/tabs/tab1.py +150 -0
  144. bertrend_apps/exploration/curebot/tabs/tab2.py +95 -0
  145. bertrend_apps/exploration/curebot/tabs/tab3.py +125 -0
  146. bertrend_apps/exploration/dataviz/Main_page.py +10 -0
  147. bertrend_apps/exploration/dataviz/__init__.py +4 -0
  148. bertrend_apps/exploration/dataviz/pages/1_Data_feeds.py +105 -0
  149. bertrend_apps/exploration/geolocalization/__init__.py +4 -0
  150. bertrend_apps/exploration/geolocalization/entity_utils.py +118 -0
  151. bertrend_apps/exploration/geolocalization/spacy/__init__.py +4 -0
  152. bertrend_apps/exploration/geolocalization/spacy/common_factory.py +142 -0
  153. bertrend_apps/exploration/geolocalization/spacy/dbpedia.py +206 -0
  154. bertrend_apps/exploration/geolocalization/spacy/nlp.config +37 -0
  155. bertrend_apps/exploration/geolocalization/spacy/utils.py +39 -0
  156. bertrend_apps/install_feeds_and_newsletters.py +29 -0
  157. bertrend_apps/newsletters/__init__.py +4 -0
  158. bertrend_apps/newsletters/__main__.py +277 -0
  159. bertrend_apps/prospective_demo/.streamlit/config.toml +3 -0
  160. bertrend_apps/prospective_demo/.streamlit/secrets.toml +9 -0
  161. bertrend_apps/prospective_demo/__init__.py +70 -0
  162. bertrend_apps/prospective_demo/app.py +111 -0
  163. bertrend_apps/prospective_demo/authentication.py +44 -0
  164. bertrend_apps/prospective_demo/dashboard_analysis.py +132 -0
  165. bertrend_apps/prospective_demo/dashboard_common.py +79 -0
  166. bertrend_apps/prospective_demo/dashboard_signals.py +226 -0
  167. bertrend_apps/prospective_demo/feeds_common.py +38 -0
  168. bertrend_apps/prospective_demo/feeds_config.py +261 -0
  169. bertrend_apps/prospective_demo/feeds_data.py +95 -0
  170. bertrend_apps/prospective_demo/i18n.py +136 -0
  171. bertrend_apps/prospective_demo/llm_utils.py +34 -0
  172. bertrend_apps/prospective_demo/models_info.py +361 -0
  173. bertrend_apps/prospective_demo/perf_utils.py +23 -0
  174. bertrend_apps/prospective_demo/process_new_data.py +348 -0
  175. bertrend_apps/prospective_demo/report_generation.py +214 -0
  176. bertrend_apps/prospective_demo/report_template.html +148 -0
  177. bertrend_apps/prospective_demo/report_utils.py +132 -0
  178. bertrend_apps/prospective_demo/start_demo.sh +9 -0
  179. bertrend_apps/prospective_demo/streamlit_utils.py +37 -0
  180. bertrend_apps/start_apps.sh +15 -0
  181. bertrend_apps/stop_apps.sh +11 -0
@@ -0,0 +1,113 @@
1
+ # Copyright (c) 2024, RTE (https://www.rte-france.com)
2
+ # See AUTHORS.txt
3
+ # SPDX-License-Identifier: MPL-2.0
4
+ # This file is part of BERTrend.
5
+ import os
6
+ import re
7
+ import subprocess
8
+ import sys
9
+ from pathlib import Path
10
+
11
+ from cron_descriptor import (
12
+ Options,
13
+ CasingTypeEnum,
14
+ ExpressionDescriptor,
15
+ DescriptionTypeEnum,
16
+ )
17
+ from loguru import logger
18
+
19
+ from bertrend import BEST_CUDA_DEVICE, BERTREND_LOG_PATH, load_toml_config
20
+
21
+
22
+ def get_understandable_cron_description(cron_expression: str) -> str:
23
+ """Returns a human understandable crontab description."""
24
+ options = Options()
25
+ options.casing_type = CasingTypeEnum.Sentence
26
+ options.use_24hour_time_format = True
27
+ options.locale_code = "fr_FR"
28
+ descriptor = ExpressionDescriptor(cron_expression, options)
29
+ return descriptor.get_description(DescriptionTypeEnum.FULL)
30
+
31
+
32
+ def add_job_to_crontab(schedule, command, env_vars="") -> bool:
33
+ """Add the specified job to the crontab."""
34
+ logger.debug(f"Adding to crontab: {schedule} {command}")
35
+ home = os.getenv("HOME")
36
+ # Create crontab, add command - NB: we use the .bashrc to source all environment variables that may be required by the command
37
+ cmd = f'(crontab -l; echo "{schedule} umask 002; source {home}/.bashrc; {env_vars} {command}" ) | crontab -'
38
+ returned_value = subprocess.call(cmd, shell=True) # returns the exit code in unix
39
+ return returned_value == 0
40
+
41
+
42
+ def check_cron_job(pattern: str) -> bool:
43
+ """Check if a specific pattern (expressed as a regular expression) matches crontab entries."""
44
+ try:
45
+ # Run `crontab -l` and capture the output
46
+ result = subprocess.run(
47
+ ["crontab", "-l"], capture_output=True, text=True, check=True
48
+ )
49
+
50
+ # Search for the regex pattern in the crontab output
51
+ if re.search(pattern, result.stdout):
52
+ return True
53
+ else:
54
+ return False
55
+ except subprocess.CalledProcessError:
56
+ # If crontab fails (e.g., no crontab for the user), return False
57
+ return False
58
+
59
+
60
+ def remove_from_crontab(pattern: str) -> bool:
61
+ """Removes from the crontab the job matching the provided pattern (expressed as a regular expression)"""
62
+ if not (check_cron_job(pattern)):
63
+ logger.warning("No job matching the provided pattern")
64
+ return False
65
+ try:
66
+ # Retrieve current crontab
67
+ output = subprocess.check_output(
68
+ f"crontab -l | grep -Ev {pattern} | crontab -", shell=True
69
+ )
70
+ return output == 0
71
+ except subprocess.CalledProcessError:
72
+ return False
73
+
74
+
75
+ def schedule_scrapping(feed_cfg: Path, user: str = None):
76
+ """Schedule data scrapping on the basis of a feed configuration file"""
77
+ data_feed_cfg = load_toml_config(feed_cfg)
78
+ schedule = data_feed_cfg["data-feed"]["update_frequency"]
79
+ id = data_feed_cfg["data-feed"]["id"]
80
+ log_path = BERTREND_LOG_PATH if not user else BERTREND_LOG_PATH / "users" / user
81
+ log_path.mkdir(parents=True, exist_ok=True)
82
+ command = f"{sys.prefix}/bin/python -m bertrend_apps.data_provider scrape-feed {feed_cfg.resolve()} > {log_path}/cron_feed_{id}.log 2>&1"
83
+ add_job_to_crontab(schedule, command, "")
84
+
85
+
86
+ def schedule_newsletter(
87
+ newsletter_cfg_path: Path,
88
+ data_feed_cfg_path: Path,
89
+ cuda_devices: str = BEST_CUDA_DEVICE,
90
+ ):
91
+ """Schedule data scrapping on the basis of a feed configuration file"""
92
+ newsletter_cfg = load_toml_config(newsletter_cfg_path)
93
+ schedule = newsletter_cfg["newsletter"]["update_frequency"]
94
+ id = newsletter_cfg["newsletter"]["id"]
95
+ command = f"{sys.prefix}/bin/python -m bertrend_apps.newsletters newsletters {newsletter_cfg_path.resolve()} {data_feed_cfg_path.resolve()} > {BERTREND_LOG_PATH}/cron_newsletter_{id}.log 2>&1"
96
+ env_vars = f"CUDA_VISIBLE_DEVICES={cuda_devices}"
97
+ add_job_to_crontab(schedule, command, env_vars)
98
+
99
+
100
+ def check_if_scrapping_active_for_user(feed_id: str, user: str = None) -> bool:
101
+ """Checks if a given scrapping feed is active (registered in the crontab"""
102
+ if user:
103
+ return check_cron_job(rf"scrape-feed.*/users/{user}/{feed_id}_feed.toml")
104
+ else:
105
+ return check_cron_job(rf"scrape-feed.*/{feed_id}_feed.toml")
106
+
107
+
108
+ def remove_scrapping_for_user(feed_id: str, user: str = None):
109
+ """Removes from the crontab the job matching the provided feed_id"""
110
+ if user:
111
+ return remove_from_crontab(rf"scrape-feed.*/users/{user}/{feed_id}_feed.toml")
112
+ else:
113
+ return remove_from_crontab(rf"scrape-feed.*/{feed_id}_feed.toml")
@@ -0,0 +1,91 @@
1
+ # Copyright (c) 2024, RTE (https://www.rte-france.com)
2
+ # See AUTHORS.txt
3
+ # SPDX-License-Identifier: MPL-2.0
4
+ # This file is part of BERTrend.
5
+
6
+ import base64
7
+ import os
8
+ from email.mime.multipart import MIMEMultipart
9
+ from email.mime.text import MIMEText
10
+ from email.utils import COMMASPACE
11
+ from pathlib import Path
12
+
13
+ # Gmail API utils
14
+ from google.auth.transport.requests import Request
15
+ from google.oauth2.credentials import Credentials
16
+ from google_auth_oauthlib.flow import InstalledAppFlow
17
+ from googleapiclient.discovery import build
18
+ from googleapiclient.errors import HttpError
19
+ from loguru import logger
20
+
21
+ from bertrend import BASE_PATH
22
+
23
+ SCOPES = ["https://mail.google.com/"] # full access to mail API
24
+ FROM = "wattelse.ai@gmail.com"
25
+ TOKEN_PATH = BASE_PATH / "gmail_token.json"
26
+ DEFAULT_GMAIL_CREDENTIALS_PATH = (
27
+ Path(__file__).parent.parent / "config" / "gmail_credentials.json"
28
+ )
29
+
30
+ # Ensures to write with +rw for both user and groups
31
+ os.umask(0o002)
32
+
33
+
34
+ def get_credentials(
35
+ credentials_path: Path = DEFAULT_GMAIL_CREDENTIALS_PATH,
36
+ ) -> Credentials:
37
+ """Returns credentials for the user"""
38
+ creds = None
39
+ # The file token.json stores the user's access and refresh tokens, and is
40
+ # created automatically when the authorization flow completes for the first
41
+ # time.
42
+ logger.debug(f"Gmail credentials path: {credentials_path}")
43
+ logger.debug(f"Gmail token path: {TOKEN_PATH}")
44
+ if TOKEN_PATH.exists():
45
+ creds = Credentials.from_authorized_user_file(TOKEN_PATH, SCOPES)
46
+ # If there are no (valid) credentials available, let the user log in.
47
+ if not creds or not creds.valid:
48
+ if creds and creds.expired and creds.refresh_token:
49
+ creds.refresh(Request())
50
+ else:
51
+ flow = InstalledAppFlow.from_client_secrets_file(credentials_path, SCOPES)
52
+ creds = flow.run_local_server(port=0)
53
+ # Save the credentials for the next run
54
+ with open(TOKEN_PATH, "w") as token:
55
+ token.write(creds.to_json())
56
+ return creds
57
+
58
+
59
+ def send_email(
60
+ credentials: Credentials,
61
+ subject: str,
62
+ recipients: list[str],
63
+ content: str,
64
+ content_type="html",
65
+ ):
66
+ try:
67
+ # Call the Gmail API
68
+ service = build("gmail", "v1", credentials=credentials)
69
+ message = MIMEMultipart()
70
+ message["To"] = COMMASPACE.join(recipients)
71
+ message["From"] = FROM
72
+ message["Subject"] = subject
73
+
74
+ # Record the MIME types of both parts - text/plain and text/html.
75
+ part1 = MIMEText(
76
+ content, "plain" if content_type in ["md", "text", "txt"] else content_type
77
+ )
78
+ message.attach(part1)
79
+
80
+ encoded_message = base64.urlsafe_b64encode(message.as_bytes()).decode()
81
+
82
+ create_message = {"raw": encoded_message}
83
+
84
+ # Send email using the Gmail API
85
+ email = (
86
+ service.users().messages().send(userId="me", body=create_message).execute()
87
+ )
88
+
89
+ logger.debug(f"Email sent: {email}")
90
+ except HttpError as error:
91
+ logger.error(f"An error occurred: {error}")
@@ -0,0 +1,15 @@
1
+ [data-feed]
2
+ id = "feed_arxiv"
3
+ query = "cat:cs.CL"
4
+ provider = "arxiv"
5
+ # maximum number of results *per day*
6
+ max_results = 1000
7
+ # number of days to retrieve (better if aligned with update-frequency if automated retrieval is activated)
8
+ number_of_days = 7
9
+ # output_directory is a relative path - base_data_dir_path/data_dir_path; the base_data_dir_path is controlled by the application
10
+ feed_dir_path = "feed_arxiv"
11
+ # language filter
12
+ language = "en"
13
+ # Frequency at which new data shall be gathered (in crontab format, cf https://crontab.guru/)
14
+ # “At 22:00 on every day-of-week from Monday through Friday.”
15
+ update_frequency = "0 1 * * 5"
@@ -0,0 +1,15 @@
1
+ [data-feed]
2
+ id = "feed_decarbonation"
3
+ query = "décarbonation OR \"énergies renouvelables\" OR \"transition énergétique électrique\" OR \"smart grids\" OR \"stockage d'énergie\" OR \"efficacité énergétique\""
4
+ provider = "google"
5
+ # maximum number of results *per day*
6
+ max_results = 50
7
+ # number of days to retrieve (better if aligned with update-frequency if automated retrieval is activated)
8
+ number_of_days = 7
9
+ # output_directory is a relative path - base_data_dir_path/data_dir_path; the base_data_dir_path is controlled by the application
10
+ feed_dir_path = "feed_decarbonation"
11
+ # language filter
12
+ language = "fr"
13
+ # Frequency at which new data shall be gathered (in crontab format, cf https://crontab.guru/)
14
+ # “At 22:00 on every day-of-week from Monday through Friday.”
15
+ update_frequency = "0 2 * * 3"
@@ -0,0 +1,15 @@
1
+ [data-feed]
2
+ id = "feed_llm_en"
3
+ query = "LLM OR \"Retrieval Augmented Generation\""
4
+ provider = "google"
5
+ # maximum number of results *per day*
6
+ max_results = 25
7
+ # number of days to retrieve (better if aligned with update-frequency if automated retrieval is activated)
8
+ number_of_days = 14
9
+ # output_directory is a relative path - base_data_dir_path/data_dir_path; the base_data_dir_path is controlled by the application
10
+ feed_dir_path = "feed_llm_en"
11
+ # language filter
12
+ language = "en"
13
+ # Frequency at which new data shall be gathered (in crontab format, cf https://crontab.guru/)
14
+ # “At 22:00 on every day-of-week from Monday through Friday.”
15
+ update_frequency = "55 4 * * 4"
@@ -0,0 +1,16 @@
1
+ [data-feed]
2
+ id = "feed_llm"
3
+ # NB : LLM est aussi un mastère de droit !
4
+ query = "LLM OR \"Retrieval Augmented Generation\""
5
+ provider = "google"
6
+ # maximum number of results *per day*
7
+ max_results = 15
8
+ # number of days to retrieve (better if aligned with update-frequency if automated retrieval is activated)
9
+ number_of_days = 14
10
+ # output_directory is a relative path - base_data_dir_path/data_dir_path; the base_data_dir_path is controlled by the application
11
+ feed_dir_path = "feed_llm"
12
+ # language filter
13
+ language = "fr"
14
+ # Frequency at which new data shall be gathered (in crontab format, cf https://crontab.guru/)
15
+ # “At 22:00 on every day-of-week from Monday through Friday.”
16
+ update_frequency = "0 5 * * 4"
@@ -0,0 +1,15 @@
1
+ [data-feed]
2
+ id = "feed_nlp"
3
+ query = "NLP OR intelligence artificielle"
4
+ provider = "google"
5
+ # maximum number of results *per day*
6
+ max_results = 50
7
+ # number of days to retrieve (better if aligned with update-frequency if automated retrieval is activated)
8
+ number_of_days = 7
9
+ # output_directory is a relative path - base_data_dir_path/data_dir_path; the base_data_dir_path is controlled by the application
10
+ feed_dir_path = "feed_nlp"
11
+ # language filter
12
+ language = "fr"
13
+ # Frequency at which new data shall be gathered (in crontab format, cf https://crontab.guru/)
14
+ # “At 22:00 on every day-of-week from Monday through Friday.”
15
+ update_frequency = "0 3 * * 2"
@@ -0,0 +1,15 @@
1
+ [data-feed]
2
+ id = "feed_rte"
3
+ query = "électricité AND RTE"
4
+ provider = "google"
5
+ # maximum number of results *per day*
6
+ max_results = 50
7
+ # number of days to retrieve (better if aligned with update-frequency if automated retrieval is activated)
8
+ number_of_days = 14
9
+ # output_directory is a relative path - base_data_dir_path/data_dir_path; the base_data_dir_path is controlled by the application
10
+ feed_dir_path = "feed_rte"
11
+ # language filter
12
+ language = "fr"
13
+ # Frequency at which new data shall be gathered (in crontab format, cf https://crontab.guru/)
14
+ # “At 22:00 on every day-of-week from Monday through Friday.”
15
+ update_frequency = "0 4 * * 1"
@@ -0,0 +1 @@
1
+ {"installed":{"client_id":"249845606098-tf75cv3rpsmcodl0k3um48s6gi9qlhbl.apps.googleusercontent.com","project_id":"wattelse","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","redirect_uris":["http://localhost"]}}
@@ -0,0 +1,39 @@
1
+ ######## NEWSLETTER CONFIG ########
2
+ [newsletter]
3
+ id = "newsletter_arxiv"
4
+ title = "Arxiv Newsletter"
5
+ top_n_topics = 6
6
+ top_n_docs = 4
7
+ output_format = "html"
8
+ # output_directory is a relative path - base_output_path/output_directory; the base_output_path is controlled by the application
9
+ output_directory = "newsletter_arxiv"
10
+ summarizer_class = "bertrend.services.summary.chatgpt_summarizer.GPTSummarizer"
11
+ prompt_language = "en"
12
+ # To automate the newsletters generation, e.g. “At 22:00 on every day-of-week from Monday through Friday.”
13
+ update_frequency = "10 1 * * 5"
14
+ recipients = "$NEWSLETTER_DEFAULT_RECIPIENTS"
15
+ improve_topic_description = true
16
+ # 'document' to summarize top n documents independently or 'topic' to generate a single topic summary
17
+ summary_mode = "topic"
18
+ #openai_model_name =
19
+
20
+ ######## LEARNING STRATEGY ########
21
+ [learning_strategy]
22
+ # Choose among:
23
+ # - learn_from_scratch : uses all available data from feed to create the model
24
+ # - learn_from_last: uses only the last feed data to create the model
25
+ # - inference_only: do not retrain model; reuse existing bertopic model if available,
26
+ # otherwise, fallback to learn_from_scratch for the first run
27
+ learning_strategy = "learn_from_last"
28
+ split_data_by_paragraphs = "no"
29
+ # model saving path (empty = do not save model)
30
+ bertopic_model_path = "models/arxiv"
31
+
32
+ ######## TOPIC MODEL CONFIG ########
33
+ [embedding_service]
34
+ # local embedding model to be used
35
+ model_name = "OrdalieTech/Solon-embeddings-base-0.1"
36
+
37
+ [bertopic_parameters]
38
+ language = "English"
39
+
@@ -0,0 +1,39 @@
1
+ ######## NEWSLETTER CONFIG ########
2
+ [newsletter]
3
+ id = "newsletter_arxiv"
4
+ title = "Arxiv Newsletter"
5
+ top_n_topics = 6
6
+ top_n_docs = 4
7
+ output_format = "html"
8
+ # output_directory is a relative path - base_output_path/output_directory; the base_output_path is controlled by the application
9
+ output_directory = "newsletter_arxiv"
10
+ summarizer_class = "bertrend.services.summary.chatgpt_summarizer.GPTSummarizer"
11
+ prompt_language = "en"
12
+ # To automate the newsletters generation, e.g. “At 22:00 on every day-of-week from Monday through Friday.”
13
+ update_frequency = "30 1 * * 5"
14
+ recipients = "$NEWSLETTER_DEFAULT_RECIPIENTS"
15
+ improve_topic_description = true
16
+ # 'document' to summarize top n documents independently or 'topic' to generate a single topic summary
17
+ summary_mode = "document"
18
+ #openai_model_name =
19
+
20
+ ######## LEARNING STRATEGY ########
21
+ [learning_strategy]
22
+ # Choose among:
23
+ # - learn_from_scratch : uses all available data from feed to create the model
24
+ # - learn_from_last: uses only the last feed data to create the model
25
+ # - inference_only: do not retrain model; reuse existing bertopic model if available,
26
+ # otherwise, fallback to learn_from_scratch for the first run
27
+ learning_strategy = "learn_from_scratch"
28
+ split_data_by_paragraphs = "no"
29
+ # model saving path (empty = do not save model)
30
+ bertopic_model_path = "models/arxiv"
31
+
32
+ ######## TOPIC MODEL CONFIG ########
33
+ [embedding_service]
34
+ # local embedding model to be used
35
+ model_name = "OrdalieTech/Solon-embeddings-base-0.1"
36
+
37
+ [bertopic_parameters]
38
+ language = "English"
39
+
@@ -0,0 +1,38 @@
1
+ ######## NEWSLETTER CONFIG ########
2
+ [newsletter]
3
+ id = "newsletter_decarbonation_from_last"
4
+ title = "Newsletter Décarbonation"
5
+ top_n_topics = 5
6
+ top_n_docs = 5
7
+ output_format = "html"
8
+ # output_directory is a relative path - base_output_path/output_directory; the base_output_path is controlled by the application
9
+ output_directory = "newsletter_rte"
10
+ summarizer_class = "bertrend.services.summary.chatgpt_summarizer.GPTSummarizer"
11
+ prompt_language = "fr"
12
+ # To automate the newsletters generation, e.g. “At 22:00 on every day-of-week from Monday through Friday.”
13
+ update_frequency = "15 2 * * 3"
14
+ recipients = "$NEWSLETTER_DEFAULT_RECIPIENTS"
15
+ improve_topic_description = true
16
+ # 'document' to summarize top n documents independently or 'topic' to generate a single topic summary
17
+ summary_mode = "topic"
18
+ #openai_model_name =
19
+
20
+ ######## LEARNING STRATEGY ########
21
+ [learning_strategy]
22
+ # Choose among:
23
+ # - learn_from_scratch : uses all available data from feed to create the model
24
+ # - learn_from_last: uses only the last feed data to create the model
25
+ # - inference_only: do not retrain model; reuse existing bertopic model if available,
26
+ # otherwise, fallback to learn_from_scratch for the first run
27
+ learning_strategy = "learn_from_last"
28
+ split_data_by_paragraphs = "yes"
29
+ # model saving path (empty = do not save model)
30
+ bertopic_model_path = "models/decarbonation_from_last"
31
+
32
+ ######## TOPIC MODEL CONFIG ########
33
+ [embedding_service]
34
+ # local embedding model to be used
35
+ model_name = "OrdalieTech/Solon-embeddings-base-0.1"
36
+
37
+ [bertopic_parameters]
38
+ language = "French"
@@ -0,0 +1,38 @@
1
+ ######## NEWSLETTER CONFIG ########
2
+ [newsletter]
3
+ id = "newsletter_decarbonation_from_scratch"
4
+ title = "Newsletter Décarbonation"
5
+ top_n_topics = 5
6
+ top_n_docs = 5
7
+ output_format = "html"
8
+ # output_directory is a relative path - base_output_path/output_directory; the base_output_path is controlled by the application
9
+ output_directory = "newsletter_rte"
10
+ summarizer_class = "bertrend.services.summary.chatgpt_summarizer.GPTSummarizer"
11
+ prompt_language = "fr"
12
+ # To automate the newsletters generation, e.g. “At 22:00 on every day-of-week from Monday through Friday.”
13
+ update_frequency = "30 2 * * 3"
14
+ recipients = "$NEWSLETTER_DEFAULT_RECIPIENTS"
15
+ improve_topic_description = true
16
+ # 'document' to summarize top n documents independently or 'topic' to generate a single topic summary
17
+ summary_mode = "document"
18
+ #openai_model_name =
19
+
20
+ ######## LEARNING STRATEGY ########
21
+ [learning_strategy]
22
+ # Choose among:
23
+ # - learn_from_scratch : uses all available data from feed to create the model
24
+ # - learn_from_last: uses only the last feed data to create the model
25
+ # - inference_only: do not retrain model; reuse existing bertopic model if available,
26
+ # otherwise, fallback to learn_from_scratch for the first run
27
+ learning_strategy = "learn_from_scratch"
28
+ split_data_by_paragraphs = "yes"
29
+ # model saving path (empty = do not save model)
30
+ bertopic_model_path = "models/decarbonation_from_scratch"
31
+
32
+ ######## TOPIC MODEL CONFIG ########
33
+ [embedding_service]
34
+ # local embedding model to be used
35
+ model_name = "OrdalieTech/Solon-embeddings-base-0.1"
36
+
37
+ [bertopic_parameters]
38
+ language = "English"
@@ -0,0 +1,38 @@
1
+ ######## NEWSLETTER CONFIG ########
2
+ [newsletter]
3
+ id = "newsletter_LLM_en"
4
+ title = "LLM Newsletter"
5
+ top_n_topics = 6
6
+ top_n_docs = 4
7
+ output_format = "html"
8
+ # output_directory is a relative path - base_output_path/output_directory; the base_output_path is controlled by the application
9
+ output_directory = "newsletter_llm"
10
+ summarizer_class = "bertrend.services.summary.chatgpt_summarizer.GPTSummarizer"
11
+ prompt_language = "en"
12
+ # To automate the newsletters generation, e.g. “At 22:00 on every day-of-week from Monday through Friday.”
13
+ update_frequency = "30 5 * * 4"
14
+ recipients = "$NEWSLETTER_DEFAULT_RECIPIENTS"
15
+ improve_topic_description = true
16
+ # 'document' to summarize top n documents independently or 'topic' to generate a single topic summary
17
+ summary_mode = "topic"
18
+ #openai_model_name =
19
+
20
+ ######## LEARNING STRATEGY ########
21
+ [learning_strategy]
22
+ # Choose among:
23
+ # - learn_from_scratch : uses all available data from feed to create the model
24
+ # - learn_from_last: uses only the last feed data to create the model
25
+ # - inference_only: do not retrain model; reuse existing bertopic model if available,
26
+ # otherwise, fallback to learn_from_scratch for the first run
27
+ learning_strategy = "learn_from_last"
28
+ split_data_by_paragraphs = "yes"
29
+ # model saving path (empty = do not save model)
30
+ bertopic_model_path = "models/llm_from_last_en"
31
+
32
+ ######## TOPIC MODEL CONFIG ########
33
+ [embedding_service]
34
+ # local embedding model to be used
35
+ model_name = "OrdalieTech/Solon-embeddings-base-0.1"
36
+
37
+ [bertopic_parameters]
38
+ language = "English"
@@ -0,0 +1,39 @@
1
+ ######## NEWSLETTER CONFIG ########
2
+ [newsletter]
3
+ id = "newsletter_LLM"
4
+ title = "Newsletter LLM"
5
+ top_n_topics = 5
6
+ top_n_docs = 4
7
+ output_format = "html"
8
+ # output_directory is a relative path - base_output_path/output_directory; the base_output_path is controlled by the application
9
+ output_directory = "newsletter_llm"
10
+ summarizer_class = "bertrend.services.summary.chatgpt_summarizer.GPTSummarizer"
11
+ prompt_language = "fr"
12
+ # To automate the newsletters generation, e.g. “At 22:00 on every day-of-week from Monday through Friday.”
13
+ update_frequency = "15 5 * * 4"
14
+ recipients = "$NEWSLETTER_DEFAULT_RECIPIENTS"
15
+ improve_topic_description = true
16
+ # 'document' to summarize top n documents independently or 'topic' to generate a single topic summary
17
+ summary_mode = "topic"
18
+ #openai_model_name =
19
+
20
+ ######## LEARNING STRATEGY ########
21
+ [learning_strategy]
22
+ # Choose among:
23
+ # - learn_from_scratch : uses all available data from feed to create the model
24
+ # - learn_from_last: uses only the last feed data to create the model
25
+ # - inference_only: do not retrain model; reuse existing bertopic model if available,
26
+ # otherwise, fallback to learn_from_scratch for the first run
27
+ learning_strategy = "learn_from_last"
28
+ split_data_by_paragraphs = "yes"
29
+ # model saving path (empty = do not save model)
30
+ bertopic_model_path = "models/llm_from_last"
31
+
32
+ ######## TOPIC MODEL CONFIG ########
33
+ [embedding_service]
34
+ # local embedding model to be used
35
+ model_name = "OrdalieTech/Solon-embeddings-base-0.1"
36
+
37
+ [bertopic_parameters]
38
+ language = "French"
39
+
@@ -0,0 +1,38 @@
1
+ ######## NEWSLETTER CONFIG ########
2
+ [newsletter]
3
+ id = "newsletter_NLP"
4
+ title = "Newsletter NLP/IA"
5
+ top_n_topics = 6
6
+ top_n_docs = 5
7
+ output_format = "html"
8
+ # output_directory is a relative path - base_output_path/output_directory; the base_output_path is controlled by the application
9
+ output_directory = "newsletter_nlp"
10
+ summarizer_class = "bertrend.services.summary.chatgpt_summarizer.GPTSummarizer"
11
+ prompt_language = "fr"
12
+ # To automate the newsletters generation, e.g. “At 22:00 on every day-of-week from Monday through Friday.”
13
+ update_frequency = "15 3 * * 2"
14
+ recipients = "$NEWSLETTER_DEFAULT_RECIPIENTS"
15
+ improve_topic_description = true
16
+ # 'document' to summarize top n documents independently or 'topic' to generate a single topic summary
17
+ summary_mode = "topic"
18
+ #openai_model_name =
19
+
20
+ ######## LEARNING STRATEGY ########
21
+ [learning_strategy]
22
+ # Choose among:
23
+ # - learn_from_scratch : uses all available data from feed to create the model
24
+ # - learn_from_last: uses only the last feed data to create the model
25
+ # - inference_only: do not retrain model; reuse existing bertopic model if available,
26
+ # otherwise, fallback to learn_from_scratch for the first run
27
+ learning_strategy = "learn_from_last"
28
+ split_data_by_paragraphs = "yes"
29
+ # model saving path (empty = do not save model)
30
+ bertopic_model_path = "models/nlp_from_last"
31
+
32
+ ######## TOPIC MODEL CONFIG ########
33
+ [embedding_service]
34
+ # local embedding model to be used
35
+ model_name = "OrdalieTech/Solon-embeddings-base-0.1"
36
+
37
+ [bertopic_parameters]
38
+ language = "French"
@@ -0,0 +1,38 @@
1
+ ######## NEWSLETTER CONFIG ########
2
+ [newsletter]
3
+ id = "newsletter_rte_from_last"
4
+ title = "Newsletter RTE"
5
+ top_n_topics = 5
6
+ top_n_docs = 4
7
+ output_format = "html"
8
+ # output_directory is a relative path - base_output_path/output_directory; the base_output_path is controlled by the application
9
+ output_directory = "newsletter_rte"
10
+ summarizer_class = "bertrend.services.summary.chatgpt_summarizer.GPTSummarizer"
11
+ prompt_language = "fr"
12
+ # To automate the newsletters generation, e.g. “At 22:00 on every day-of-week from Monday through Friday.”
13
+ update_frequency = "15 4 * * 1"
14
+ recipients = "$NEWSLETTER_DEFAULT_RECIPIENTS"
15
+ improve_topic_description = true
16
+ # 'document' to summarize top n documents independently or 'topic' to generate a single topic summary
17
+ summary_mode = "topic"
18
+ #openai_model_name =
19
+
20
+ ######## LEARNING STRATEGY ########
21
+ [learning_strategy]
22
+ # Choose among:
23
+ # - learn_from_scratch : uses all available data from feed to create the model
24
+ # - learn_from_last: uses only the last feed data to create the model
25
+ # - inference_only: do not retrain model; reuse existing bertopic model if available,
26
+ # otherwise, fallback to learn_from_scratch for the first run
27
+ learning_strategy = "learn_from_last"
28
+ split_data_by_paragraphs = "yes"
29
+ # model saving path (empty = do not save model)
30
+ bertopic_model_path = "models/rte_from_last"
31
+
32
+ ######## TOPIC MODEL CONFIG ########
33
+ [embedding_service]
34
+ # local embedding model to be used
35
+ model_name = "OrdalieTech/Solon-embeddings-base-0.1"
36
+
37
+ [bertopic_parameters]
38
+ language = "French"
@@ -0,0 +1,38 @@
1
+ ######## NEWSLETTER CONFIG ########
2
+ [newsletter]
3
+ id = "newsletter_rte_from_scratch"
4
+ title = "Newsletter RTE"
5
+ top_n_topics = 5
6
+ top_n_docs = 4
7
+ output_format = "html"
8
+ # output_directory is a relative path - base_output_path/output_directory; the base_output_path is controlled by the application
9
+ output_directory = "newsletter_rte"
10
+ summarizer_class = "bertrend.services.summary.chatgpt_summarizer.GPTSummarizer"
11
+ prompt_language = "fr"
12
+ # To automate the newsletters generation, e.g. “At 22:00 on every day-of-week from Monday through Friday.”
13
+ update_frequency = "30 4 * * 1"
14
+ recipients = "$NEWSLETTER_DEFAULT_RECIPIENTS"
15
+ improve_topic_description = true
16
+ # 'document' to summarize top n documents independently or 'topic' to generate a single topic summary
17
+ summary_mode = "document"
18
+ #openai_model_name =
19
+
20
+ ######## LEARNING STRATEGY ########
21
+ [learning_strategy]
22
+ # Choose among:
23
+ # - learn_from_scratch : uses all available data from feed to create the model
24
+ # - learn_from_last: uses only the last feed data to create the model
25
+ # - inference_only: do not retrain model; reuse existing bertopic model if available,
26
+ # otherwise, fallback to learn_from_scratch for the first run
27
+ learning_strategy = "learn_from_scratch"
28
+ split_data_by_paragraphs = "yes"
29
+ # model saving path (empty = do not save model)
30
+ bertopic_model_path = "models/rte_from_scratch"
31
+
32
+ ######## TOPIC MODEL CONFIG ########
33
+ [embedding_service]
34
+ # local embedding model to be used
35
+ model_name = "OrdalieTech/Solon-embeddings-base-0.1"
36
+
37
+ [bertopic_parameters]
38
+ language = "French"