pyeasyphd 0.1.2__py3-none-any.whl → 0.1.6__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.
Potentially problematic release.
This version of pyeasyphd might be problematic. Click here for more details.
- pyeasyphd/__init__.py +5 -0
- pyeasyphd/data/Templates/CSL/apa-no-ampersand.csl +2183 -0
- pyeasyphd/data/Templates/CSL/apa.csl +2133 -0
- pyeasyphd/data/Templates/CSL/ieee.csl +512 -0
- pyeasyphd/data/Templates/TEX/Article.tex +38 -0
- pyeasyphd/data/Templates/TEX/Article_Header.tex +29 -0
- pyeasyphd/data/Templates/TEX/Article_Tail.tex +3 -0
- pyeasyphd/data/Templates/TEX/Beamer_Header.tex +80 -0
- pyeasyphd/data/Templates/TEX/Beamer_Tail.tex +14 -0
- pyeasyphd/data/Templates/TEX/Style.tex +249 -0
- pyeasyphd/data/Templates/TEX/TEVC_Header.tex +52 -0
- pyeasyphd/data/Templates/TEX/TEVC_Tail.tex +4 -0
- pyeasyphd/data/Templates/TEX/eisvogel.beamer +700 -0
- pyeasyphd/data/Templates/TEX/eisvogel.latex +1040 -0
- pyeasyphd/data/Templates/TEX/eisvogel.tex +1064 -0
- pyeasyphd/data/Templates/TEX/math.tex +196 -0
- pyeasyphd/data/Templates/TEX/math_commands.tex +673 -0
- pyeasyphd/main/__init__.py +6 -7
- pyeasyphd/main/basic_input.py +59 -77
- pyeasyphd/main/pandoc_md_to.py +48 -47
- pyeasyphd/main/python_run_md.py +65 -24
- pyeasyphd/main/python_run_tex.py +52 -21
- pyeasyphd/pyeasyphd.py +20 -6
- pyeasyphd/pyeasyphd.sublime-settings +8 -14
- pyeasyphd/tools/__init__.py +5 -8
- pyeasyphd/tools/generate/generate_from_bibs.py +41 -37
- pyeasyphd/tools/generate/generate_html.py +48 -8
- pyeasyphd/tools/generate/generate_library.py +39 -26
- pyeasyphd/tools/generate/generate_links.py +14 -8
- pyeasyphd/tools/py_run_bib_md_tex.py +80 -116
- pyeasyphd/tools/search/data.py +12 -48
- pyeasyphd/tools/search/search_base.py +37 -11
- pyeasyphd/tools/search/search_core.py +108 -38
- pyeasyphd/tools/search/search_keywords.py +18 -16
- pyeasyphd/tools/search/search_writers.py +94 -34
- pyeasyphd/tools/search/utils.py +48 -9
- pyeasyphd/utils/utils.py +7 -6
- {pyeasyphd-0.1.2.dist-info → pyeasyphd-0.1.6.dist-info}/METADATA +3 -3
- pyeasyphd-0.1.6.dist-info/RECORD +43 -0
- pyeasyphd-0.1.2.dist-info/RECORD +0 -27
- {pyeasyphd-0.1.2.dist-info → pyeasyphd-0.1.6.dist-info}/WHEEL +0 -0
|
@@ -18,27 +18,22 @@ class PyRunBibMdTex(BasicInput):
|
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
def __init__(
|
|
21
|
-
self,
|
|
21
|
+
self,
|
|
22
|
+
path_output: str,
|
|
23
|
+
tex_md_flag: str = ".md",
|
|
24
|
+
template_name: str = "paper",
|
|
25
|
+
options: Dict[str, Any] = {}
|
|
22
26
|
) -> None:
|
|
23
27
|
"""Initialize the PyRunBibMdTex instance.
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Template type to use ("paper" or "beamer"), by default "paper"
|
|
34
|
-
options : Dict[str, Any], optional
|
|
35
|
-
Additional configuration options, by default {}
|
|
36
|
-
|
|
37
|
-
Raises
|
|
38
|
-
------
|
|
39
|
-
AssertionError
|
|
40
|
-
If tex_md_flag is not ".tex" or ".md"
|
|
41
|
-
If template_name is not "paper" or "beamer"
|
|
29
|
+
Args:
|
|
30
|
+
path_output (str): Output directory path for processed files.
|
|
31
|
+
tex_md_flag (str, optional): Flag indicating whether to process as LaTeX (".tex") or Markdown (".md"). Defaults to ".md".
|
|
32
|
+
template_name (str, optional): Template type to use ("paper" or "beamer"). Defaults to "paper".
|
|
33
|
+
options (Dict[str, Any], optional): Additional configuration options. Defaults to {}.
|
|
34
|
+
|
|
35
|
+
Raises:
|
|
36
|
+
AssertionError: If tex_md_flag is not ".tex" or ".md" or if template_name is not "paper" or "beamer".
|
|
42
37
|
"""
|
|
43
38
|
super().__init__(options)
|
|
44
39
|
|
|
@@ -48,10 +43,18 @@ class PyRunBibMdTex(BasicInput):
|
|
|
48
43
|
assert self.template_name in ["paper", "beamer"], f"{template_name} must be `paper` or `beamer`."
|
|
49
44
|
self.path_output = standard_path(path_output)
|
|
50
45
|
|
|
46
|
+
# Bib
|
|
47
|
+
# Path to bibliographic data, can be either a directory path or a specific file path
|
|
48
|
+
self.bib_path_or_file = options.get("bib_path_or_file", "")
|
|
49
|
+
|
|
50
|
+
# Figures
|
|
51
|
+
# Path to the figures directory (must be a directory path, not a file)
|
|
52
|
+
self.figures_directory = options.get("figures_directory", "")
|
|
53
|
+
self.shutil_figures = options.get("shutil_figures", True)
|
|
54
|
+
|
|
51
55
|
# Configuration options
|
|
52
56
|
self.generate_html = options.get("generate_html", False)
|
|
53
57
|
self.generate_tex = options.get("generate_tex", True)
|
|
54
|
-
self.shutil_figures = options.get("shutil_figures", True)
|
|
55
58
|
|
|
56
59
|
# Folder name configurations
|
|
57
60
|
self.figure_folder_name = options.get("figure_folder_name", "fig") # "" or "figs" or "main"
|
|
@@ -65,8 +68,8 @@ class PyRunBibMdTex(BasicInput):
|
|
|
65
68
|
self.delete_original_bib_in_output_folder = options.get("delete_original_bib_in_output_folder", False)
|
|
66
69
|
|
|
67
70
|
# Initialize helper classes
|
|
68
|
-
self._python_bib = PythonRunBib(self.
|
|
69
|
-
self._python_writer = PythonWriters(self.
|
|
71
|
+
self._python_bib = PythonRunBib(self.options)
|
|
72
|
+
self._python_writer = PythonWriters(self.options)
|
|
70
73
|
|
|
71
74
|
self._python_md = PythonRunMd(self.options)
|
|
72
75
|
self._python_tex = PythonRunTex(self.options)
|
|
@@ -76,19 +79,13 @@ class PyRunBibMdTex(BasicInput):
|
|
|
76
79
|
) -> Tuple[List[str], List[str]]:
|
|
77
80
|
"""Process a list of Markdown or LaTeX files.
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Output directory level ("previous", "current", or "next"), by default "next"
|
|
87
|
-
|
|
88
|
-
Returns
|
|
89
|
-
-------
|
|
90
|
-
Tuple[List[str], List[str]]
|
|
91
|
-
Tuple containing processed Markdown content and LaTeX content
|
|
82
|
+
Args:
|
|
83
|
+
file_list_md_tex (List[str]): List of input file paths (Markdown or LaTeX).
|
|
84
|
+
output_prefix (str, optional): Prefix for output files. Defaults to "".
|
|
85
|
+
output_level (str, optional): Output directory level ("previous", "current", or "next"). Defaults to "next".
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
Tuple[List[str], List[str]]: Tuple containing processed Markdown content and LaTeX content.
|
|
92
89
|
"""
|
|
93
90
|
file_list_md_tex = [f for f in file_list_md_tex if f.endswith(self.tex_md_flag)]
|
|
94
91
|
data_list_list = [read_list(standard_path(f), "r") for f in file_list_md_tex]
|
|
@@ -101,7 +98,7 @@ class PyRunBibMdTex(BasicInput):
|
|
|
101
98
|
data_list_md_tex = combine_content_in_list(data_list_list, ["\n"])
|
|
102
99
|
|
|
103
100
|
content_md, content_tex = self.python_run_bib_md_tex(
|
|
104
|
-
output_prefix, data_list_md_tex, self.
|
|
101
|
+
output_prefix, data_list_md_tex, self.bib_path_or_file, output_level
|
|
105
102
|
)
|
|
106
103
|
return content_md, content_tex
|
|
107
104
|
|
|
@@ -114,21 +111,14 @@ class PyRunBibMdTex(BasicInput):
|
|
|
114
111
|
) -> Tuple[List[str], List[str]]:
|
|
115
112
|
"""Process BibTeX, Markdown and LaTeX content.
|
|
116
113
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
output_level : str, optional
|
|
126
|
-
Output directory level ("previous", "current", or "next"), by default "next"
|
|
127
|
-
|
|
128
|
-
Returns
|
|
129
|
-
-------
|
|
130
|
-
Tuple[List[str], List[str]]
|
|
131
|
-
Tuple containing processed Markdown content and LaTeX content
|
|
114
|
+
Args:
|
|
115
|
+
output_prefix (str): Prefix for output files.
|
|
116
|
+
data_list_md_tex (List[str]): List of content lines (Markdown or LaTeX).
|
|
117
|
+
original_bib_data (Union[List[str], str, Library]): BibTeX data in various formats.
|
|
118
|
+
output_level (str, optional): Output directory level ("previous", "current", or "next"). Defaults to "next".
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
Tuple[List[str], List[str]]: Tuple containing processed Markdown content and LaTeX content.
|
|
132
122
|
"""
|
|
133
123
|
# Basic file names
|
|
134
124
|
output_tex, output_md = output_prefix + ".tex", output_prefix + ".md"
|
|
@@ -168,26 +158,19 @@ class PyRunBibMdTex(BasicInput):
|
|
|
168
158
|
) -> Tuple[List[str], List[str]]:
|
|
169
159
|
"""Process BibTeX, Markdown and LaTeX content.
|
|
170
160
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
List
|
|
179
|
-
original_bib_data : Union[List[str], str, Library]
|
|
180
|
-
BibTeX data in various formats
|
|
181
|
-
|
|
182
|
-
Returns
|
|
183
|
-
-------
|
|
184
|
-
Tuple[List[str], List[str]]
|
|
185
|
-
Tuple containing processed Markdown content and LaTeX content
|
|
161
|
+
Args:
|
|
162
|
+
output_md (str): Output Markdown filename.
|
|
163
|
+
output_tex (str): Output LaTeX filename.
|
|
164
|
+
data_list_md_tex (List[str]): List of content lines (Markdown or LaTeX).
|
|
165
|
+
original_bib_data (Union[List[str], str, Library]): BibTeX data in various formats.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
Tuple[List[str], List[str]]: Tuple containing processed Markdown content and LaTeX content.
|
|
186
169
|
"""
|
|
187
170
|
# Copy figures if enabled
|
|
188
171
|
if self.shutil_figures:
|
|
189
172
|
figure_names = self.search_figure_names(data_list_md_tex)
|
|
190
|
-
self.shutil_copy_figures(self.figure_folder_name, self.
|
|
173
|
+
self.shutil_copy_figures(self.figure_folder_name, self.figures_directory, figure_names, self.path_output)
|
|
191
174
|
|
|
192
175
|
# Extract citation keys from content
|
|
193
176
|
key_in_md_tex = self.search_cite_keys(data_list_md_tex, self.tex_md_flag)
|
|
@@ -258,17 +241,12 @@ class PyRunBibMdTex(BasicInput):
|
|
|
258
241
|
def search_figure_names(data_list: List[str], figure_postfixes: Optional[List[str]] = None) -> List[str]:
|
|
259
242
|
"""Search for figure filenames in content.
|
|
260
243
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
List of figure
|
|
267
|
-
|
|
268
|
-
Returns
|
|
269
|
-
-------
|
|
270
|
-
List[str]
|
|
271
|
-
List of found figure filenames
|
|
244
|
+
Args:
|
|
245
|
+
data_list (List[str]): List of content lines to search.
|
|
246
|
+
figure_postfixes (Optional[List[str]], optional): List of figure file extensions to look for. Defaults to None.
|
|
247
|
+
|
|
248
|
+
Returns:
|
|
249
|
+
List[str]: List of found figure filenames.
|
|
272
250
|
"""
|
|
273
251
|
if figure_postfixes is None:
|
|
274
252
|
figure_postfixes = ["eps", "jpg", "png", "svg", "psd", "raw", "jpeg", "pdf"]
|
|
@@ -283,23 +261,17 @@ class PyRunBibMdTex(BasicInput):
|
|
|
283
261
|
def shutil_copy_figures(fig_folder_name: str, path_fig: str, fig_names: List[str], path_output: str) -> None:
|
|
284
262
|
"""Copy figure files to output directory.
|
|
285
263
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
Source directory containing figures
|
|
292
|
-
fig_names : List[str]
|
|
293
|
-
List of figure filenames to copy
|
|
294
|
-
path_output : str
|
|
295
|
-
Output directory path
|
|
296
|
-
|
|
297
|
-
Returns
|
|
298
|
-
-------
|
|
299
|
-
None
|
|
264
|
+
Args:
|
|
265
|
+
fig_folder_name (str): Name of figures folder in output directory.
|
|
266
|
+
path_fig (str): Source directory containing figures.
|
|
267
|
+
fig_names (List[str]): List of figure filenames to copy.
|
|
268
|
+
path_output (str): Output directory path.
|
|
300
269
|
"""
|
|
270
|
+
if not fig_names:
|
|
271
|
+
return None
|
|
272
|
+
|
|
301
273
|
if not os.path.exists(path_fig):
|
|
302
|
-
print(f"{path_fig} does not
|
|
274
|
+
print(f"The specified figure directory: {path_fig} does not exist.")
|
|
303
275
|
return None
|
|
304
276
|
|
|
305
277
|
file_list = []
|
|
@@ -308,6 +280,10 @@ class PyRunBibMdTex(BasicInput):
|
|
|
308
280
|
if name in fig_names:
|
|
309
281
|
file_list.append(os.path.join(root, name))
|
|
310
282
|
|
|
283
|
+
not_founded_figures = list(set([os.path.basename(f) for f in file_list]).intersection(set(fig_names)))
|
|
284
|
+
if not_founded_figures:
|
|
285
|
+
print(f"Figures: {', '.join(not_founded_figures)} could not be found.")
|
|
286
|
+
|
|
311
287
|
for file in file_list:
|
|
312
288
|
path_output_file = os.path.join(path_output, fig_folder_name, os.path.basename(file))
|
|
313
289
|
p = os.path.dirname(path_output_file)
|
|
@@ -320,22 +296,16 @@ class PyRunBibMdTex(BasicInput):
|
|
|
320
296
|
def search_cite_keys(data_list: List[str], tex_md_flag: str = ".tex") -> List[str]:
|
|
321
297
|
r"""Extract citation keys from content according to their places.
|
|
322
298
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
List of found citation keys
|
|
334
|
-
|
|
335
|
-
Notes
|
|
336
|
-
-----
|
|
337
|
-
For LaTeX, searches for \\cite, \\citep, \\citet patterns
|
|
338
|
-
For Markdown, searches for [@key], @key; and ;@key] patterns
|
|
299
|
+
Args:
|
|
300
|
+
data_list (List[str]): List of content lines to search.
|
|
301
|
+
tex_md_flag (str, optional): Flag indicating content format (".tex" or ".md"). Defaults to ".tex".
|
|
302
|
+
|
|
303
|
+
Returns:
|
|
304
|
+
List[str]: List of found citation keys.
|
|
305
|
+
|
|
306
|
+
Note:
|
|
307
|
+
For LaTeX, searches for \\cite, \\citep, \\citet patterns.
|
|
308
|
+
For Markdown, searches for [@key], @key; and ;@key] patterns.
|
|
339
309
|
"""
|
|
340
310
|
cite_key_list = []
|
|
341
311
|
if tex_md_flag == ".tex":
|
|
@@ -360,14 +330,8 @@ class PyRunBibMdTex(BasicInput):
|
|
|
360
330
|
def _cleanup_file(self, file_path: str) -> None:
|
|
361
331
|
"""Cleanup files and empty directories.
|
|
362
332
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
file_path : str
|
|
366
|
-
Path to file to be removed
|
|
367
|
-
|
|
368
|
-
Returns
|
|
369
|
-
-------
|
|
370
|
-
None
|
|
333
|
+
Args:
|
|
334
|
+
file_path (str): Path to file to be removed.
|
|
371
335
|
"""
|
|
372
336
|
if os.path.exists(file_path):
|
|
373
337
|
os.remove(file_path)
|
pyeasyphd/tools/search/data.py
CHANGED
|
@@ -2,7 +2,11 @@ from typing import Any, Dict
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
def obtain_search_keywords() -> Dict[str, Any]:
|
|
5
|
-
"""
|
|
5
|
+
"""Obtain search keywords dictionary.
|
|
6
|
+
|
|
7
|
+
Returns:
|
|
8
|
+
Dict[str, Any]: Dictionary containing categorized search keywords.
|
|
9
|
+
"""
|
|
6
10
|
_h_ = "(?:| |-)" # hyphen
|
|
7
11
|
|
|
8
12
|
evol = "evol(?:ution|utionary)" # 'evol(?:ution|utionary|ve|ved|ving)'
|
|
@@ -62,10 +66,7 @@ def obtain_search_keywords() -> Dict[str, Any]:
|
|
|
62
66
|
[moea_d],
|
|
63
67
|
[nsga],
|
|
64
68
|
[f"multi{_h_}objective optimization"],
|
|
65
|
-
[
|
|
66
|
-
[f"multi{_h_}objective", "optimization"],
|
|
67
|
-
[f"multi{_h_}objective optimization"],
|
|
68
|
-
],
|
|
69
|
+
[[f"multi{_h_}objective", "optimization"], [f"multi{_h_}objective optimization"]],
|
|
69
70
|
[[f"multi{_h_}objective"], ["optimization"]],
|
|
70
71
|
[f"multi{_h_}model optimization"],
|
|
71
72
|
[[f"multi{_h_}model", "optimization"], [f"multi{_h_}model optimization"]],
|
|
@@ -75,36 +76,15 @@ def obtain_search_keywords() -> Dict[str, Any]:
|
|
|
75
76
|
[[f"many{_h_}objective"], ["optimization"]],
|
|
76
77
|
[f"dynamic multi{_h_}objective"],
|
|
77
78
|
[f"dynamic {evol} multi{_h_}objective"],
|
|
78
|
-
[
|
|
79
|
-
["dynamic", f"multi{_h_}objective"],
|
|
80
|
-
[
|
|
81
|
-
f"dynamic multi{_h_}objective",
|
|
82
|
-
f"dynamic {evol} multi{_h_}objective"
|
|
83
|
-
]
|
|
84
|
-
],
|
|
79
|
+
[["dynamic", f"multi{_h_}objective"], [f"dynamic multi{_h_}objective", f"dynamic {evol} multi{_h_}objective"]],
|
|
85
80
|
[f"dynamic multi{_h_}model"],
|
|
86
81
|
[["dynamic", f"multi{_h_}model"], [f"dynamic multi{_h_}model"]],
|
|
87
82
|
[f"dynamic many{_h_}objective"],
|
|
88
83
|
[f"dynamic {evol} many{_h_}objective"],
|
|
89
|
-
[
|
|
90
|
-
["dynamic", f"many{_h_}objective"],
|
|
91
|
-
[
|
|
92
|
-
f"dynamic many{_h_}objective",
|
|
93
|
-
f"dynamic {evol} many{_h_}objective",
|
|
94
|
-
]
|
|
95
|
-
],
|
|
84
|
+
[["dynamic", f"many{_h_}objective"], [f"dynamic many{_h_}objective", f"dynamic {evol} many{_h_}objective"]],
|
|
96
85
|
["dynamic", "optimization"],
|
|
97
86
|
["dynamic", network],
|
|
98
|
-
[
|
|
99
|
-
["dynamic"],
|
|
100
|
-
[
|
|
101
|
-
f"multi{_h_}objective",
|
|
102
|
-
f"multi{_h_}model",
|
|
103
|
-
f"many{_h_}objective",
|
|
104
|
-
"optimization",
|
|
105
|
-
network,
|
|
106
|
-
],
|
|
107
|
-
],
|
|
87
|
+
[["dynamic"], [f"multi{_h_}objective", f"multi{_h_}model", f"many{_h_}objective", "optimization", network]],
|
|
108
88
|
[f"{uncertain} optimization"],
|
|
109
89
|
[[uncertain, "optimization"], [f"{uncertain} optimization"]],
|
|
110
90
|
[[uncertain], ["optimization"]],
|
|
@@ -158,12 +138,7 @@ def obtain_search_keywords() -> Dict[str, Any]:
|
|
|
158
138
|
["active", "learning"],
|
|
159
139
|
[
|
|
160
140
|
["supervised", "learning"],
|
|
161
|
-
[
|
|
162
|
-
f"semi{_h_}supervised",
|
|
163
|
-
f"self{_h_}supervised",
|
|
164
|
-
f"weakly{_h_}supervised",
|
|
165
|
-
"unsupervised",
|
|
166
|
-
],
|
|
141
|
+
[f"semi{_h_}supervised", f"self{_h_}supervised", f"weakly{_h_}supervised", "unsupervised"],
|
|
167
142
|
],
|
|
168
143
|
["reinforcement", "learning", f"on{_h_}policy"],
|
|
169
144
|
["reinforcement", "learning", f"off{_h_}policy"],
|
|
@@ -174,15 +149,7 @@ def obtain_search_keywords() -> Dict[str, Any]:
|
|
|
174
149
|
["reinforcement", "learning", evol],
|
|
175
150
|
[
|
|
176
151
|
["reinforcement", "learning"],
|
|
177
|
-
[
|
|
178
|
-
"offline",
|
|
179
|
-
f"on{_h_}policy",
|
|
180
|
-
f"off{_h_}policy",
|
|
181
|
-
f"model{_h_}based",
|
|
182
|
-
"deep",
|
|
183
|
-
"continual",
|
|
184
|
-
evol,
|
|
185
|
-
],
|
|
152
|
+
["offline", f"on{_h_}policy", f"off{_h_}policy", f"model{_h_}based", "deep", "continual", evol],
|
|
186
153
|
],
|
|
187
154
|
["policy", "search"],
|
|
188
155
|
[["policy"], ["policy", "search"]],
|
|
@@ -295,10 +262,7 @@ def obtain_search_keywords() -> Dict[str, Any]:
|
|
|
295
262
|
["upper", bound],
|
|
296
263
|
["lower", bound],
|
|
297
264
|
[[converg], [evol, "swarm", "colony", "genetic", analy]],
|
|
298
|
-
[
|
|
299
|
-
["time"],
|
|
300
|
-
[evol, "swarm", "colony", "genetic", analy, "hitting", computation, run],
|
|
301
|
-
],
|
|
265
|
+
[["time"], [evol, "swarm", "colony", "genetic", analy, "hitting", computation, run]],
|
|
302
266
|
[[theor], [evol, "swarm", "colony", "genetic", analy]],
|
|
303
267
|
[[bound], [evol, "swarm", "colony", "genetic", analy, "upper", "lower"]],
|
|
304
268
|
[["complexity"], [evol, "swarm", "colony", "genetic", analy]],
|
|
@@ -10,7 +10,16 @@ from .search_writers import WriteInitialResult, WriteSeparateResult
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def search_keywords_core(keywords_list_list: List[List[str]], library: Library, field: str) -> Tuple[Library, Library]:
|
|
13
|
-
"""Search keywords in
|
|
13
|
+
"""Search keywords in specified field such as title, abstract, or keywords.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
keywords_list_list (List[List[str]]): List of keyword lists to search for.
|
|
17
|
+
library (Library): Bibliography library to search.
|
|
18
|
+
field (str): Field to search in (e.g., 'title', 'abstract', 'keywords').
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
Tuple[Library, Library]: Tuple containing (matching_library, non_matching_library).
|
|
22
|
+
"""
|
|
14
23
|
search_library = []
|
|
15
24
|
no_search_library = []
|
|
16
25
|
|
|
@@ -36,31 +45,34 @@ def search_keywords_core(keywords_list_list: List[List[str]], library: Library,
|
|
|
36
45
|
|
|
37
46
|
|
|
38
47
|
class SearchInitialResult(BasicInput):
|
|
39
|
-
"""
|
|
48
|
+
"""Class for searching and processing initial results.
|
|
40
49
|
|
|
41
50
|
Args:
|
|
42
|
-
options:
|
|
51
|
+
options (dict): Configuration options.
|
|
43
52
|
|
|
44
53
|
Attributes:
|
|
45
|
-
options:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
deepcopy_library_for_every_field (bool = False): deepcopy library for every field
|
|
54
|
+
options (dict): Configuration options.
|
|
55
|
+
print_on_screen (bool): Whether to print results on screen. Defaults to False.
|
|
56
|
+
deepcopy_library_for_every_field (bool): Whether to deep copy library for every field. Defaults to False.
|
|
49
57
|
"""
|
|
50
58
|
|
|
51
59
|
def __init__(self, options: dict) -> None:
|
|
52
|
-
|
|
60
|
+
"""Initialize SearchInitialResult with configuration options.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
options (dict): Configuration options.
|
|
64
|
+
"""
|
|
53
65
|
super().__init__(options)
|
|
54
66
|
|
|
55
67
|
self.print_on_screen: bool = options.get("print_on_screen", False)
|
|
56
68
|
self.deepcopy_library_for_every_field = options.get("deepcopy_library_for_every_field", False)
|
|
57
69
|
|
|
58
|
-
self._python_bib = PythonRunBib(
|
|
70
|
+
self._python_bib = PythonRunBib(options)
|
|
59
71
|
|
|
60
72
|
_options = {}
|
|
61
73
|
_options["empty_entry_cite_keys"] = True
|
|
62
74
|
_options.update(self.options)
|
|
63
|
-
self._python_writer = PythonWriters(
|
|
75
|
+
self._python_writer = PythonWriters(_options)
|
|
64
76
|
|
|
65
77
|
def main(
|
|
66
78
|
self,
|
|
@@ -73,7 +85,21 @@ class SearchInitialResult(BasicInput):
|
|
|
73
85
|
output_prefix: str,
|
|
74
86
|
path_separate: str,
|
|
75
87
|
) -> Tuple[List[str], Dict[str, List[List[str]]], Dict[str, int], Library]:
|
|
76
|
-
"""
|
|
88
|
+
"""Main search method for processing search results.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
search_field_list (List[str]): List of fields to search.
|
|
92
|
+
path_initial (str): Path to initial directory.
|
|
93
|
+
library (Library): Bibliography library to search.
|
|
94
|
+
keywords_type (str): Type of keywords being searched.
|
|
95
|
+
keywords_list_list (List[List[str]]): List of keyword lists.
|
|
96
|
+
combine_keywords (str): Combined keywords string.
|
|
97
|
+
output_prefix (str): Prefix for output files.
|
|
98
|
+
path_separate (str): Path to separate directory.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
Tuple[List[str], Dict[str, List[List[str]]], Dict[str, int], Library]: Tuple containing error messages, field data, field numbers, and remaining library.
|
|
102
|
+
"""
|
|
77
103
|
error_pandoc_md_md, field_data_dict, no_search_library = [], {}, library
|
|
78
104
|
field_number_dict: Dict[str, int] = {}
|
|
79
105
|
|