auto_research.search.information module

extract_exact_date(result)[source]

Extracts the exact date from the abstract of a research paper result.

Parameters:

result (dict) – A dictionary containing paper metadata, including the abstract.

Returns:

The extracted date if found in the abstract, otherwise None.

Return type:

Optional[datetime.date]

Example

>>> result = {"bib": {"abstract": "Published 3 days ago."}}
>>> extract_exact_date(result)  # Today's date minus 3 days
datetime.date(2023, 10, 7)
save_meta_data(meta_data_path, papers_info)[source]

Saves paper metadata to a JSON file, ensuring no duplicate entries based on paper titles.

Parameters:
  • meta_data_path (str) – The file path where the metadata should be saved.

  • papers_info (list[dict]) – A list of dictionaries containing paper metadata.

Raises:

ValueError – If either existing data or new data is not a list.

Return type:

None

Example

>>> papers_info = [{"title": "Paper 1", "abstract": "..."}]
>>> save_meta_data("metadata.json", papers_info)
Metadata saved to metadata.json
read_meta_data(meta_data_path)[source]

Reads paper metadata from a JSON file.

Parameters:

meta_data_path (str) – The file path from which to read the metadata.

Returns:

A list of dictionaries containing paper metadata. Returns an empty list if

the file does not exist.

Return type:

list[dict]

Example

>>> read_meta_data("metadata.json")
[{"title": "Paper 1", "abstract": "..."}]