Loading...
Loading...
Format citations in APA, MLA, Chicago, IEEE, Harvard styles from structured data, DOI/ISBN lookup, or manual entry. Generate bibliographies with auto-sort.
npx skill4agent add dkyazzentwatwa/chatgpt-skills citation-bibliography-generatorfrom scripts.citation_generator import CitationGenerator
# Create generator with desired style
gen = CitationGenerator(style='apa')
# Cite a book
citation = gen.cite_book(
authors=["Smith, John", "Doe, Jane"],
title="Research Methods in Social Science",
year=2020,
publisher="Academic Press",
city="New York"
)
print(citation)
# Output: Smith, J., & Doe, J. (2020). Research methods in social science. Academic Press.
# Build bibliography
gen.add_to_bibliography(citation)
bibliography = gen.generate_bibliography()
print(bibliography)(Smith, 2020, p. 45)Smith (2020) argues that...gen = CitationGenerator(style='apa')stylecitation = gen.cite_book(
authors=["Last, First", "Last, First"],
title="Book Title",
year=2020,
publisher="Publisher Name",
city="City", # Optional
edition="3rd ed.", # Optional
isbn="978-0-123456-78-9" # Optional
)citation = gen.cite_article(
authors=["Last, First"],
title="Article Title",
journal="Journal Name",
year=2020,
volume=10, # Optional
issue=2, # Optional
pages="45-67", # Optional
doi="10.1234/example" # Optional
)citation = gen.cite_website(
authors=["Last, First"], # Can be empty list
title="Page Title",
url="https://example.com",
access_date="2024-01-15",
publish_date="2023-12-01" # Optional
)citation = gen.cite_from_doi(doi="10.1234/example")gen.add_to_bibliography(citation)bibliography = gen.generate_bibliography(
sort_by='author', # 'author', 'year', or 'title'
deduplicate=True # Remove duplicate entries
)gen.export_bibtex(output_path='references.bib')citation = gen.in_text_citation(
authors=["Smith, J."],
year=2020,
page="45", # Optional
narrative=False # True for narrative style
)(Smith, 2020, p. 45)Smith (2020)citations = gen.import_from_csv(csv_path='citations.csv')type,authors,title,year,journal,publisher,doi,isbn,url,access_date
article,"Smith, J.|Doe, A.",Research Methods,2020,Journal of Science,,10.1234/example,,,
book,"Johnson, M.",Data Analysis,2019,,Academic Press,,978-0-123456-78-9,,
website,,"Web Page Title",2024,,,,,https://example.com,2024-01-15|python scripts/citation_generator.py book \
--authors "Smith, J." "Doe, A." \
--title "Research Methods" \
--year 2020 \
--publisher "Academic Press" \
--city "New York" \
--style apapython scripts/citation_generator.py article \
--authors "Smith, J." \
--title "Study Title" \
--journal "Journal Name" \
--year 2020 \
--volume 10 \
--issue 2 \
--pages "45-67" \
--doi "10.1234/example" \
--style mlapython scripts/citation_generator.py website \
--title "Page Title" \
--url "https://example.com" \
--access-date "2024-01-15" \
--style chicagopython scripts/citation_generator.py doi \
--doi "10.1234/example" \
--style apapython scripts/citation_generator.py batch \
--input citations.csv \
--style harvard \
--output bibliography.txt \
--sort authorpython scripts/citation_generator.py batch \
--input citations.csv \
--format bibtex \
--output references.bib| Argument | Description | Default |
|---|---|---|
| Citation style (apa/mla/chicago/ieee/harvard) | apa |
| Author names (multiple allowed) | - |
| Title of work | - |
| Publication year | - |
| Input CSV file (batch mode) | - |
| Output file path | stdout |
| Output format (text/bibtex) | text |
| Sort bibliography by (author/year/title) | author |
gen = CitationGenerator(style='apa')
citation = gen.cite_book(
authors=["Doe, Jane", "Smith, John"],
title="The Art of Research",
year=2021,
publisher="University Press",
edition="2nd ed."
)
print(citation)
# Doe, J., & Smith, J. (2021). The art of research (2nd ed.). University Press.gen = CitationGenerator(style='mla')
citation = gen.cite_article(
authors=["Johnson, Mary"],
title="Digital Humanities in the 21st Century",
journal="Modern Research Quarterly",
year=2022,
volume=15,
issue=3,
pages="112-145",
doi="10.5678/mrq.2022.15.3"
)
print(citation)
# Johnson, Mary. "Digital Humanities in the 21st Century." Modern Research Quarterly, vol. 15, no. 3, 2022, pp. 112-145. DOI: 10.5678/mrq.2022.15.3.gen = CitationGenerator(style='chicago')
citation = gen.cite_website(
authors=["Brown, Robert"],
title="Understanding Machine Learning",
url="https://ml-guide.example.com",
access_date="2024-01-20",
publish_date="2023-11-15"
)
print(citation)
# Brown, Robert. "Understanding Machine Learning." Last modified November 15, 2023. Accessed January 20, 2024. https://ml-guide.example.com.gen = CitationGenerator(style='apa')
# Add multiple citations
gen.add_to_bibliography(gen.cite_book(
authors=["Smith, A."],
title="First Book",
year=2020,
publisher="Press A"
))
gen.add_to_bibliography(gen.cite_article(
authors=["Jones, B."],
title="Research Article",
journal="Journal X",
year=2021
))
# Generate formatted bibliography
bibliography = gen.generate_bibliography(sort_by='author')
print(bibliography)gen = CitationGenerator(style='ieee')
citation = gen.cite_from_doi(doi="10.1109/ACCESS.2019.2947014")
print(citation)
# Auto-fetches metadata and formats in IEEE stylegen = CitationGenerator(style='harvard')
citations = gen.import_from_csv('my_references.csv')
# Add all to bibliography
for citation in citations:
gen.add_to_bibliography(citation)
# Generate and export
gen.export_bibtex('references.bib')pandas>=2.0.0
requests>=2.31.0pip install -r scripts/requirements.txt