WING-NUS / SciAssist

Other
18 stars 4 forks source link

Completed the functions related to Reference Entity Linking #42

Open Alex592800 opened 7 months ago

Alex592800 commented 7 months ago

Two class:

ReferenceEntityLinkingLocal: The pipeline for reference entity linking (Local Version, No Internet Connection Required).

ReferenceEntityLinkingOnline: The pipeline for reference entity linking (Online Version, Requires Network for Retrieving Corresponding Reference Articles).

1.For ReferenceEntityLinkingLocal: Example:

            >>> from SciAssist import ReferenceEntityLinkingLocal
            >>> pipeline = ReferenceEntityLinkingLocal()
            >>> pipeline.predict(
            ...     './sample_papers'
            ... )

            [
                {
                    "reference_key": "0_6|bert: pre-training of deep bidirectional transformers for language understanding",
                    "cited_references": [
                        ["0_6", "bert: pre-training of deep bidirectional transformers for language understanding"],
                        ["2_11", "bert: pretraining of deep bidirectional transformers for lan-guage understanding"]
                        ]
                    "cited_number": cited_number
                },
                // ... Another JSON objects
            ]

2.For ReferenceEntityLinkingOnline, there are 2 functions: predict(file_dir) and batch_title_to_references(title_list) 2.1 For predict(file_dir): Example:

from SciAssist import ReferenceEntityLinkingOnline pipeline = ReferenceEntityLinkingOnline() pipeline.predict( ... './sample_papers' ... )

        [
            {
                "reference_id": "3f144a0d7ad2d92589f61cf466acc921c6d6a123",
                "detail":{
                    "paperId": "3f144a0d7ad2d92589f61cf466acc921c6d6a123",
                    "title": "Automatic Generation of Related Work Sections in Scientific Papers: An Optimization Approach",
                    "isOpenAccess": true,
                    "openAccessPdf": {"url": "https://aclanthology.org/D14-1170.pdf", "status": null},
                    "citationStyles": {"bibtex": "@Misc{None,\n author = {Yue Hu and Xiaojun Wan},\n title = {Automatic Generation of Related Work Sections in Scientific Papers: An Optimization Approach}\n}\n"},
                    "authors": [{"authorId": "2108954687", "name": "Yue Hu"}, {"authorId": "145078589", "name": "Xiaojun Wan"}],
                    "cited_number": 3
                    }
            },
            // ... Another JSON objects
        ]

    2.2 For batch_title_to_references(title_list)
    Example:
        >>> from SciAssist import ReferenceEntityLinkingOnline
        >>> pipeline = ReferenceEntityLinkingOnline()
        >>> pipeline.batch_title_to_references(
        ...     [
        ...            'Automatic generation of related work sections in scientific papers: an Optimization Approach',
        ...            'Automatic Generation of Citation Texts in Scholarly Papers: A Pilot Study',
        ...             #... Another Title Strings
        ...       ]
        ... )

        [
            {
                "reference_id": "3f144a0d7ad2d92589f61cf466acc921c6d6a123",
                "detail":{
                    "paperId": "3f144a0d7ad2d92589f61cf466acc921c6d6a123",
                    "title": "Automatic Generation of Related Work Sections in Scientific Papers: An Optimization Approach",
                    "isOpenAccess": true,
                    "openAccessPdf": {"url": "https://aclanthology.org/D14-1170.pdf", "status": null},
                    "citationStyles": {"bibtex": "@Misc{None,\n author = {Yue Hu and Xiaojun Wan},\n title = {Automatic Generation of Related Work Sections in Scientific Papers: An Optimization Approach}\n}\n"},
                    "authors": [{"authorId": "2108954687", "name": "Yue Hu"}, {"authorId": "145078589", "name": "Xiaojun Wan"}],
                    "cited_number": 3
                    }
            },
            // ... Another JSON objects
        ]