from typing import Dict, Any, List import datasets class SuperSciRepConfig(datasets.BuilderConfig): """BuilderConfig for SuperGLUE.""" def __init__(self, features: Dict[str, Any], task_type: str, citation: str = "", licenses: str = "", is_training: bool = False, homepage: str = "", url="", **kwargs): """BuilderConfig for SuperGLUE. Args: features: *list[string]*, list of the features that will appear in the feature dict. Should not include "label". data_url: *string*, url to download the zip file from. citation: *string*, citation for the data set. url: *string*, url for information about the data set. label_classes: *list[string]*, the list of classes for the label if the label is present as a string. Non-string labels will be cast to either 'False' or 'True'. **kwargs: keyword arguments forwarded to super. """ super().__init__(version=datasets.Version("1.1.0"), **kwargs) self.features = features self.task_type = task_type self.citation = citation self.license = licenses self.is_training = is_training self.homepage = homepage self.url = url @classmethod def get_features(self, feature_names: List[str], type_mapping: Dict[str, Any] = None) -> Dict[str, Any]: full_text_mapping = {"full_text": [{"title": datasets.Value("string"), "sentences": datasets.features.Sequence(datasets.Value("string"))}]} type_mapping = {**full_text_mapping, **type_mapping} features = {name: type_mapping[name] if name in type_mapping else datasets.Value("string") for name in feature_names} if "corpus_id" in features: features["corpus_id"] = datasets.Value("uint64") return features SUPERSCIREPEVAL_CONFIGS = [ SuperSciRepConfig(name="fos", features=SuperSciRepConfig.get_features( ["doc_id", "corpus_id", "title", "abstract", "full_text", "labels", "labels_text"], {"labels": datasets.Sequence(datasets.Value("int32")), "labels_text": datasets.Sequence(datasets.Value("string"))}), task_type="classification (multi-label)", is_training=True, description=""), SuperSciRepConfig(name="cite_count", features=SuperSciRepConfig.get_features( ["doc_id", "corpus_id", "title", "abstract", "full_text", "venue", "n_citations", "log_citations"], {"n_citations": datasets.Value("int32"), "log_citations": datasets.Value("float32")}), task_type="regression", is_training=True, description="" ), SuperSciRepConfig(name="pub_year", features=SuperSciRepConfig.get_features( ["doc_id", "corpus_id", "title", "abstract", "full_text", "year", "venue", "norm_year", "scaled_year", "n_authors", "norm_authors"], {"year": datasets.Value("int32"), "norm_year": datasets.Value("float32"), "scaled_year": datasets.Value("float32"), "n_authors": datasets.Value("int32"), "norm_authors": datasets.Value("float32"), }), task_type="regression", is_training=True, description=""), SuperSciRepConfig(name="high_influence_cite", features=SuperSciRepConfig.get_features(["query", "candidates"], {"query": { "doc_id": datasets.Value("string"), "title": datasets.Value("string"), "abstract": datasets.Value( "string"), "full_text": [{"title": datasets.Value("string"), "sentences": datasets.features.Sequence(datasets.Value("string"))}], "corpus_id": datasets.Value("uint64")}, "candidates": [{"doc_id": datasets.Value("string"), "title": datasets.Value("string"), "abstract": datasets.Value( "string"), "full_text": [{"title": datasets.Value("string"), "sentences": datasets.features.Sequence(datasets.Value("string"))}], "corpus_id": datasets.Value("uint64"), "score": datasets.Value("uint32")}]}), task_type="proximity", is_training=True, description=""), SuperSciRepConfig(name="search", features=SuperSciRepConfig.get_features(["query", "doc_id", "candidates"], {"candidates": [{ "doc_id": datasets.Value("string"), "title": datasets.Value("string"), "abstract": datasets.Value( "string"), "full_text": [{"title": datasets.Value("string"), "sentences": datasets.features.Sequence(datasets.Value("string"))}], "corpus_id": datasets.Value("uint64"), "venue": datasets.Value("string"), "year": datasets.Value("float64"), "author_names": datasets.Sequence(datasets.Value("string")), "n_citations": datasets.Value("int32"), "n_key_citations": datasets.Value("int32"), "score": datasets.Value("uint32")}]}), task_type="search", is_training=True, description=""), SuperSciRepConfig(name="feeds_1", features=SuperSciRepConfig.get_features(["query", "feed_id", "candidates"], {"query": { "doc_id": datasets.Value("string"), "title": datasets.Value("string"), "abstract": datasets.Value( "string"), "full_text": [{"title": datasets.Value("string"), "sentences": datasets.features.Sequence(datasets.Value("string"))}], "corpus_id": datasets.Value("uint64")}, "candidates": [{ "doc_id": datasets.Value("string"), "title": datasets.Value("string"), "abstract": datasets.Value( "string"), "full_text": [{"title": datasets.Value("string"), "sentences": datasets.features.Sequence(datasets.Value("string"))}], "corpus_id": datasets.Value("uint64"), "score": datasets.Value("uint32")}]}), task_type="proximity", description="", url="feeds/feeds_1"), SuperSciRepConfig(name="feeds_m", features=SuperSciRepConfig.get_features(["query", "feed_id", "candidates"], {"query": { "doc_id": datasets.Value("string"), "title": datasets.Value("string"), "abstract": datasets.Value( "string"), "full_text": [{"title": datasets.Value("string"), "sentences": datasets.features.Sequence(datasets.Value("string"))}], "corpus_id": datasets.Value("uint64")}, "candidates": [{ "doc_id": datasets.Value("string"), "title": datasets.Value("string"), "abstract": datasets.Value( "string"), "full_text": [{"title": datasets.Value("string"), "sentences": datasets.features.Sequence(datasets.Value("string"))}], "corpus_id": datasets.Value("uint64"), "score": datasets.Value("uint32")}]}), task_type="proximity", description="", url="feeds/feeds_m"), SuperSciRepConfig(name="feeds_title", features=SuperSciRepConfig.get_features(["query", "doc_id", "feed_id", "abbreviations", "candidates"], {"candidates": [{ "doc_id": datasets.Value("string"), "title": datasets.Value("string"), "abstract": datasets.Value( "string"), "full_text": [{"title": datasets.Value("string"), "sentences": datasets.features.Sequence(datasets.Value("string"))}], "corpus_id": datasets.Value("uint64"), "score": datasets.Value("uint32")}]}), task_type="search", description="", url="feeds/feeds_title"), SuperSciRepConfig(name="peer_review_score_hIndex", features=SuperSciRepConfig.get_features( ["doc_id", "corpus_id", "title", "abstract", "full_text", "rating", "confidence", "authors", "decision", "mean_rating", "hIndex"], {"mean_rating": datasets.Value("float32"), "rating": datasets.Sequence(datasets.Value("int32")), "authors": datasets.Sequence(datasets.Value("string")), "hIndex": datasets.Sequence(datasets.Value("string")) }), task_type="regression", description="" ), SuperSciRepConfig(name="tweet_mentions", features=SuperSciRepConfig.get_features( ["doc_id", "corpus_id", "title", "abstract", "full_text", "index", "retweets", "count", "mentions"], {"index": datasets.Value("int32"), "count": datasets.Value("int32"), "retweets": datasets.Value("float32"), "mentions": datasets.Value("float32")}), task_type="regression", description="", citation="@article{Jain2021TweetPapAD,\ title={TweetPap: A Dataset to Study the Social Media Discourse of Scientific Papers},\ author={Naman Jain and Mayank Kumar Singh},\ journal={2021 ACM/IEEE Joint Conference on Digital Libraries (JCDL)},\ year={2021},\ pages={328-329}\ }"), SuperSciRepConfig(name="scidocs_view_cite_read", features=SuperSciRepConfig.get_features( ["doc_id", "corpus_id", "title", "abstract", "full_text", "authors", "cited_by", "references", "year"], {"year": datasets.Value("int32"), "authors": datasets.Sequence(datasets.Value("string")), "cited_by": datasets.Sequence(datasets.Value("string")), "references": datasets.Sequence(datasets.Value("string")) }), task_type="metadata", description="", url="scidocs/view_cite_read", homepage="https://github.com/allenai/scidocs", citation="@inproceedings{specter2020cohan,\ title={SPECTER: Document-level Representation Learning using Citation-informed Transformers},\ author={Arman Cohan and Sergey Feldman and Iz Beltagy and Doug Downey and Daniel S. Weld},\ booktitle={ACL},\ year={2020}\ }"), SuperSciRepConfig(name="paper_reviewer_matching", features=SuperSciRepConfig.get_features( ["doc_id", "title", "abstract", "full_text", "corpus_id"], {}), task_type="metadata", description="", citation="@inproceedings{Mimno2007ExpertiseMF,\ title={Expertise modeling for matching papers with reviewers},\ author={David Mimno and Andrew McCallum},\ booktitle={KDD '07},\ year={2007}\ }, @ARTICLE{9714338,\ author={Zhao, Yue and Anand, Ajay and Sharma, Gaurav},\ journal={IEEE Access}, \ title={Reviewer Recommendations Using Document Vector Embeddings and a Publisher Database: Implementation and Evaluation}, \ year={2022},\ volume={10},\ number={},\ pages={21798-21811},\ doi={10.1109/ACCESS.2022.3151640}}") ]