File size: 1,211 Bytes
4275a6e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Ejemplo de uso del verificador de referencias descargado del Hub.

    pip install huggingface_hub requests
    python example.py
"""

import sys

from huggingface_hub import snapshot_download

sys.path.insert(0, snapshot_download("aitziberluis/citation-checker"))
from checker import extract, verify  # noqa: E402

TEXTO = """
LeCun, Y., Bengio, Y., & Hinton, G. (2015). Deep learning. Nature, 521(7553), 436-444. https://doi.org/10.1038/nature14539

Vaswani, A., Shazeer, N., Parmar, N., et al. (2017). Attention is all you need. Advances in Neural Information Processing Systems, 30.

Martinez-Soto, R., & Vidal, P. (2021). Quantum-enhanced gradient descent for sparse neural architectures. Journal of Computational Intelligence Methods, 14(3), 211-229.
"""

if __name__ == "__main__":
    referencias, modo = extract(TEXTO)
    print(f"Modo de extraccion: {modo} | {len(referencias)} referencias\n")
    for ref in referencias:
        resultado = verify(ref)
        print(f"[{resultado['verdict']}] {ref['raw'][:70]}")
        print(f"   {resultado['note']}")
        if resultado["match"] and resultado["match"].get("url"):
            print(f"   Fuente: {resultado['match']['url']}")
        print()