literer


Nameliterer JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://github.com/JLDC/literer
Summaryliterer is a package that combines the Semantic Scholar and OpenAI APIs to create automated literature reviews
upload_time2023-03-31 09:38:02
maintainer
docs_urlNone
authorJonathan Chassot
requires_python
licenseMIT
keywords literature review openai semantic scholar
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # literer
**literer** is a Python package that combines the Semantic Scholar and OpenAI APIs to create a literature review on specified topics. The package allows users to specify keywords related to their research interest and generate a summary of relevant research papers.

## Installation
To install **literer**, install it using pip. Run the following commands:

```
pip install literer                               # Install the package with pip

# To uninstall the package again, just use
# pip uninstall literer
```

## Usage
After installation you can import the **literer** package and start using it.

### Configuring API keys and OpenAI Model
```python
import literer as lit
import openai

# Begin by setting OpenAI API key
openai.api_key = "YOUR_OPENAI_API_KEY_HERE"
# Optional: If you have one, you can also use your Semantic Scholar API key
s2_api_key = "YOUR_S2_API_KEY_HERE"
# Choose OpenAI model
lit.set_openai_model("gpt-4") # Default is 'gpt-3.5-turbo'
``` 

### Obtaining papers from Semantic Scholar

```python
# Get n_pubs=15 papers using a specific search keyword, one can also provide further
# filters, e.g., field of study, venue, or publication type (see docstring)
papers = lit.get_papers("active labor market policies", n_pubs=15,
    api_key=s2_api_key) # Leave api_key empty if you don't have one.

# Extract the BibTeX entries and save them to a bibliography.bib file
with open("bibiliography.bib", "w") as f:
    f.write(lit.create_bibliography(papers))
```

You can also ask **literer** to provide keywords to help you search for papers
```python
# Get 3 keywords suggestions
keywords = lit.get_keywords(topic="hetereogeneous treatment effects in active labor market policies", n_keywords=3)

# Iterate over the keywords and gather all papers into a larger list, filter
# to only return results from the top 5 econ journals
all_papers = []
for keyword in keywords:
    all_papers += get_papers(keyword=keyword, n_pubs=15, venue=lit.get_top_journals("Economics"))
```

### Provide a relevance score (and a reason for this score) based on the abstract
```python
scores, reasons = [], [] 

# Iterate over the collected paper, ask literer to provide a judgment of how
# relevant a given paper is based on a specific topic and a target journal for
# publication
topic = "heterogeneity of treatment effects in active labor market policies"
# target_journal can be either a list or a string of a single journal
target_journal = ["American Economic Review", "Quarterly Journal of Economics"]
for paper in papers:
    score, reason = lit.judge_paper(paper=paper, topic=topic, target_journal=target_journal)
    scores.append(score)
    reasons.append(reason)


# Optional: store the results in tabular form for ease of view
import pandas as pd

df_papers = pd.DataFrame({
    "authors": [", ".join(p["authors"]) for p in papers],
    "year": [p["year"] for p in all_papers],
    "title": [p["title"] for p in all_papers],
    "relevance_score": scores,
    "relevance_reason": reasons 
})
```

### Create a literature review to help you get a quick overview of the papers
```python
# Subset the papers to only keep the most relevant ones
min_relevance = 7 # Minimum relevance score to keep a paper in the literature review
best_papers = [p for i, p in enumerate(papers) if scores[i] >= min_relevance]
lit_review = lit.summarize_papers(best_papers)
```


## Example review

> Lechner (2002) emphasizes the importance of considering program heterogeneity when evaluating active labor market policies, particularly by comparing different propensity score techniques. This approach is also reflected in the study by Bennett and Ouazad (2018), which examines the impact of job displacement on crime rates and the mitigating role of active labor market policies in Denmark.
>
> Furthermore, studies by Sianesi (2004), Hoynes (1996), and Britto (2020) provide mixed evidence on the effectiveness of labor market interventions, highlighting the need for a delicate balance between financial support and activation measures for improving labor market outcomes. The role of unemployment benefits and short-time work programs in addressing different types of economic shocks is also underscored by Giupponi et al. (2022).
>
> On a global scale, the distinct challenges faced by developing countries, particularly in Africa, are explored by Bandiera et al. (2022), emphasizing the need for targeted policies that address the unique labor market obstacles faced by young African adults. Similarly, the challenges faced by specific populations, such as refugees and female workers, are analyzed by Brell et al. (2020) and Heath and Tan (2020), respectively, identifying the need for tailored interventions that empower these groups and promote their labor market integration.
>
> Lastly, the role of immigration restrictions as a form of active labor market policy is examined by Clemens et al. (2017), highlighting the limited and potentially perverse effects of such policies. This study underscores the importance of exploring a broader range of interventions and understanding their implications for labor market outcomes.
>
> Collectively, this literature provides a foundation for understanding the complexities of active labor market policies and their potential impacts on employment, wages, and welfare dependency. Future research should focus on disentangling the causal relationships between these policies and labor market outcomes, identifying optimal combinations of interventions, and understanding the long-term consequences of such policies on worker satisfaction and overall economic well-being.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/JLDC/literer",
    "name": "literer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "literature review,openai,semantic scholar",
    "author": "Jonathan Chassot",
    "author_email": "jonathan.chassot@unisg.ch",
    "download_url": "https://files.pythonhosted.org/packages/78/ef/c728155665f0642a30ea3e6b32fddbcc3fa9ff15feab63f7f107d6cf99d1/literer-0.1.4.tar.gz",
    "platform": null,
    "description": "# literer\n**literer** is a Python package that combines the Semantic Scholar and OpenAI APIs to create a literature review on specified topics. The package allows users to specify keywords related to their research interest and generate a summary of relevant research papers.\n\n## Installation\nTo install **literer**, install it using pip. Run the following commands:\n\n```\npip install literer                               # Install the package with pip\n\n# To uninstall the package again, just use\n# pip uninstall literer\n```\n\n## Usage\nAfter installation you can import the **literer** package and start using it.\n\n### Configuring API keys and OpenAI Model\n```python\nimport literer as lit\nimport openai\n\n# Begin by setting OpenAI API key\nopenai.api_key = \"YOUR_OPENAI_API_KEY_HERE\"\n# Optional: If you have one, you can also use your Semantic Scholar API key\ns2_api_key = \"YOUR_S2_API_KEY_HERE\"\n# Choose OpenAI model\nlit.set_openai_model(\"gpt-4\") # Default is 'gpt-3.5-turbo'\n``` \n\n### Obtaining papers from Semantic Scholar\n\n```python\n# Get n_pubs=15 papers using a specific search keyword, one can also provide further\n# filters, e.g., field of study, venue, or publication type (see docstring)\npapers = lit.get_papers(\"active labor market policies\", n_pubs=15,\n    api_key=s2_api_key) # Leave api_key empty if you don't have one.\n\n# Extract the BibTeX entries and save them to a bibliography.bib file\nwith open(\"bibiliography.bib\", \"w\") as f:\n    f.write(lit.create_bibliography(papers))\n```\n\nYou can also ask **literer** to provide keywords to help you search for papers\n```python\n# Get 3 keywords suggestions\nkeywords = lit.get_keywords(topic=\"hetereogeneous treatment effects in active labor market policies\", n_keywords=3)\n\n# Iterate over the keywords and gather all papers into a larger list, filter\n# to only return results from the top 5 econ journals\nall_papers = []\nfor keyword in keywords:\n    all_papers += get_papers(keyword=keyword, n_pubs=15, venue=lit.get_top_journals(\"Economics\"))\n```\n\n### Provide a relevance score (and a reason for this score) based on the abstract\n```python\nscores, reasons = [], [] \n\n# Iterate over the collected paper, ask literer to provide a judgment of how\n# relevant a given paper is based on a specific topic and a target journal for\n# publication\ntopic = \"heterogeneity of treatment effects in active labor market policies\"\n# target_journal can be either a list or a string of a single journal\ntarget_journal = [\"American Economic Review\", \"Quarterly Journal of Economics\"]\nfor paper in papers:\n    score, reason = lit.judge_paper(paper=paper, topic=topic, target_journal=target_journal)\n    scores.append(score)\n    reasons.append(reason)\n\n\n# Optional: store the results in tabular form for ease of view\nimport pandas as pd\n\ndf_papers = pd.DataFrame({\n    \"authors\": [\", \".join(p[\"authors\"]) for p in papers],\n    \"year\": [p[\"year\"] for p in all_papers],\n    \"title\": [p[\"title\"] for p in all_papers],\n    \"relevance_score\": scores,\n    \"relevance_reason\": reasons \n})\n```\n\n### Create a literature review to help you get a quick overview of the papers\n```python\n# Subset the papers to only keep the most relevant ones\nmin_relevance = 7 # Minimum relevance score to keep a paper in the literature review\nbest_papers = [p for i, p in enumerate(papers) if scores[i] >= min_relevance]\nlit_review = lit.summarize_papers(best_papers)\n```\n\n\n## Example review\n\n> Lechner (2002) emphasizes the importance of considering program heterogeneity when evaluating active labor market policies, particularly by comparing different propensity score techniques. This approach is also reflected in the study by Bennett and Ouazad (2018), which examines the impact of job displacement on crime rates and the mitigating role of active labor market policies in Denmark.\n>\n> Furthermore, studies by Sianesi (2004), Hoynes (1996), and Britto (2020) provide mixed evidence on the effectiveness of labor market interventions, highlighting the need for a delicate balance between financial support and activation measures for improving labor market outcomes. The role of unemployment benefits and short-time work programs in addressing different types of economic shocks is also underscored by Giupponi et al. (2022).\n>\n> On a global scale, the distinct challenges faced by developing countries, particularly in Africa, are explored by Bandiera et al. (2022), emphasizing the need for targeted policies that address the unique labor market obstacles faced by young African adults. Similarly, the challenges faced by specific populations, such as refugees and female workers, are analyzed by Brell et al. (2020) and Heath and Tan (2020), respectively, identifying the need for tailored interventions that empower these groups and promote their labor market integration.\n>\n> Lastly, the role of immigration restrictions as a form of active labor market policy is examined by Clemens et al. (2017), highlighting the limited and potentially perverse effects of such policies. This study underscores the importance of exploring a broader range of interventions and understanding their implications for labor market outcomes.\n>\n> Collectively, this literature provides a foundation for understanding the complexities of active labor market policies and their potential impacts on employment, wages, and welfare dependency. Future research should focus on disentangling the causal relationships between these policies and labor market outcomes, identifying optimal combinations of interventions, and understanding the long-term consequences of such policies on worker satisfaction and overall economic well-being.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "literer is a package that combines the Semantic Scholar and OpenAI APIs to create automated literature reviews",
    "version": "0.1.4",
    "split_keywords": [
        "literature review",
        "openai",
        "semantic scholar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "78efc728155665f0642a30ea3e6b32fddbcc3fa9ff15feab63f7f107d6cf99d1",
                "md5": "9500b7d65d60301a8615be5de2be1955",
                "sha256": "fd88aef13fab63591e7319348a8dc07c19b9ff8754258fe2daf50ce805930ede"
            },
            "downloads": -1,
            "filename": "literer-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "9500b7d65d60301a8615be5de2be1955",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12815,
            "upload_time": "2023-03-31T09:38:02",
            "upload_time_iso_8601": "2023-03-31T09:38:02.933129Z",
            "url": "https://files.pythonhosted.org/packages/78/ef/c728155665f0642a30ea3e6b32fddbcc3fa9ff15feab63f7f107d6cf99d1/literer-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-31 09:38:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "JLDC",
    "github_project": "literer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "literer"
}
        
Elapsed time: 0.18686s