File size: 10,744 Bytes
6c72393 d425305 6c72393 d425305 6c72393 d425305 8ef137f f9c43d9 d425305 f9c43d9 d425305 f9c43d9 d425305 f9c43d9 7aab328 f9c43d9 d425305 f9c43d9 d425305 f9c43d9 d425305 f9c43d9 d425305 288f86e d425305 26957cf d425305 8cf350d 660ce40 8cf350d 660ce40 63486ef d425305 9691a02 4622d0b d425305 8cf350d 9691a02 d425305 4088d9b 8cf350d 4088d9b 8cf350d 4088d9b 8cf350d d425305 63486ef 4088d9b d425305 f9c43d9 d425305 4088d9b d425305 8cf350d d425305 63486ef d425305 4088d9b 63486ef 4088d9b 63486ef 4622d0b 4088d9b 63486ef 4088d9b 63486ef 4088d9b 63486ef 4088d9b 63486ef 4088d9b 63486ef 4088d9b 63486ef 4088d9b 8cf350d 4622d0b 63486ef 4622d0b 63486ef 4622d0b 63486ef 4622d0b d425305 9691a02 26957cf d425305 cd40506 288f86e 26957cf d425305 cd40506 d425305 26957cf d425305 288f86e d425305 f9c43d9 288f86e 63486ef 288f86e 8276255 f9c43d9 bb4fe11 f9c43d9 d425305 f9c43d9 d425305 f9c43d9 4088d9b 19f4a7f 6bb5367 d5fcf42 dcd4222 d156757 1286a8e 947ff53 d425305 f9c43d9 d425305 f9c43d9 d425305 f9c43d9 d425305 f9c43d9 d425305 | 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | ---
license: mit
language:
- en,
tags:
- legal
- patents
pretty_name: PatClass2011
size_categories:
- 10B<n<100B
---
# PatClass2011 Dataset

## Dataset Summary
The **PatClass2011** dataset is a comprehensive collection of approximately 719,000 patent documents from the CLEF-IP 2011 Test Collection,
focusing on patent classification tasks. Each entry encompasses detailed metadata and textual content, including titles, abstracts, descriptions, and claims.
The dataset is structured to facilitate research in patent classification, information retrieval, and natural language processing.
## Languages
The dataset contains English, French and German text.
## Domain
Patents (intellectual property).
## Dataset Curators
The dataset was created by Eleni Kamateri and Tasos Mylonidis
## Dataset Structure
The dataset consists of 28 folders which correspond to a specific year, ranging from 1978 to 2005. Within each yearly subdirectory, you'll find a CSV file named in the format
clefip2011_en_classification_<year>.csv. These files contain patent data that were all published that year.
This structure facilitates year-wise analysis, allowing researchers to study trends and patterns in patent classifications over time. In total, there are 19 data fields for each CSV
### Data Fields
The dataset is provided in CSV format and includes the aforementioned fields
- `ucid`: Unique identifier for the patent document.
- `patent_number`: Patent document number.
- `country`: Country code of the patent.
- `kind`: Kind code indicating the type of patent document.
- `lang`: Language of the patent document.
- `date`: Publication date of the patent.
- `application_date`: Date when the patent application was filed.
- `date_produced`: Date when the data was inserted in the dataset.
- `status`: Status of the patent document.
- `main_code`: Primary classification code assigned to the patent.
- `further_codes`: Additional classification codes.
- `ipcr_codes`: International Patent Classification codes.
- `ecla_codes`: European Classification codes.
- `title`: Title of the patent document.
- `abstract`: Abstract summarizing the patent.
- `description`: Detailed description of the patent.
- `claims`: Claims defining the scope of the patent protection.
- `applicants`: Entities or individuals who applied for the patent.
- `inventors`: Inventors credited in the patent document.
## Usage
## Loading the Dataset
### Sample ( 1985 March to April )
The following script can be used to load a sample version of the dataset, which contains all the patent applications
that were published from March until April in 1985, with all columns and once with selected columns.
```python
from datasets import load_dataset
import pandas as pd
from datetime import datetime
import gc
def load_temporal_optimized(start_date, end_date, columns_to_keep=None):
"""
Load only the necessary CSV files from a Hugging Face dataset repository.
:param start_date: str, the start date in 'YYYY-MM-DD' format (inclusive)
:param end_date: str, the end date in 'YYYY-MM-DD' format (inclusive)
:param columns_to_keep: list of str, optional. Specific columns to load (e.g., ["date", "lang"]).
:return: pd.DataFrame, combined data from selected CSVs
"""
huggingface_dataset_name = "amylonidis/PatClass2011"
column_types = {
"ucid": "string[pyarrow]",
"country": "category",
"kind": "category",
"lang": "category",
"date": "Int32",
"application_date": "Int32",
"date_produced": "Int32",
"status": "category",
"main_code": "string[pyarrow]",
"further_codes": "string[pyarrow]",
"ipcr_codes": "string[pyarrow]",
"ecla_codes": "string[pyarrow]",
"title": "string[pyarrow]",
"abstract": "string[pyarrow]",
"description": "string[pyarrow]",
"claims": "string[pyarrow]",
"applicants": "string[pyarrow]",
"inventors": "string[pyarrow]",
"patent_number": "Int64",
}
category_cols = {"country", "kind", "lang", "status"}
dataset_years = [str(year) for year in range(1978, 2006)]
start_date_int = int(datetime.strptime(start_date, "%Y-%m-%d").strftime("%Y%m%d"))
end_date_int = int(datetime.strptime(end_date, "%Y-%m-%d").strftime("%Y%m%d"))
start_year, end_year = str(start_date_int)[:4], str(end_date_int)[:4]
given_years = [str(year) for year in range(int(start_year), int(end_year) + 1)]
matching_years = [f for f in dataset_years if f in given_years]
if not matching_years:
raise ValueError(f"No matching CSV files found for {start_date} to {end_date}")
df_list = []
for year in matching_years:
filepath = f"data/years/{year}/clefip2011_en_classification_{year}_validated.csv"
try:
# 1. Load the dataset (This stays on disk as an Arrow memory-map, NOT in RAM)
dataset = load_dataset(
huggingface_dataset_name,
data_files=filepath,
split="train",
sep=";",
on_bad_lines="skip"
)
# Select Columns Before Chunking
if columns_to_keep is not None:
# Safety check: Only select columns that actually exist in this specific file
valid_columns = [col for col in columns_to_keep if col in dataset.column_names]
if valid_columns:
dataset = dataset.select_columns(valid_columns)
# 2. Tell HuggingFace to output Pandas dataframes when sliced
dataset = dataset.with_format("pandas")
# 3. CHUNKING: Process exactly 40,000 rows at a time
chunk_size = 10000
for i in range(0, len(dataset), chunk_size):
# Only these 40,000 rows are loaded into RAM
df_chunk = dataset[i : i + chunk_size]
df_chunk.columns = df_chunk.columns.str.strip()
# Filter this specific chunk
if "date" in df_chunk.columns:
temp_dates = pd.to_numeric(df_chunk["date"], errors="coerce")
mask = (temp_dates >= start_date_int) & (temp_dates <= end_date_int)
df_filtered = df_chunk[mask].copy()
else:
df_filtered = df_chunk.copy()
# Apply types and append
if not df_filtered.empty:
# Step 1: Cast category columns via string[pyarrow] first to handle None/mixed types
for col in category_cols:
if col in df_filtered.columns:
df_filtered[col] = pd.Categorical(df_filtered[col])
# Step 2: Apply remaining column types, skipping category cols already handled
valid_column_types = {
col: dtype for col, dtype in column_types.items()
if col in df_filtered.columns and col not in category_cols
}
df_filtered = df_filtered.astype(valid_column_types)
df_list.append(df_filtered)
# Clear chunk from memory immediately
del df_chunk, df_filtered
gc.collect()
# Clear the dataset object from memory before the next year
del dataset
gc.collect()
except Exception as e:
print(f"Error processing {filepath}: {e}")
if not df_list:
return pd.DataFrame()
# Combine chunks
final_df = pd.concat(df_list, ignore_index=True)
for col in category_cols:
if col in final_df.columns:
final_df[col] = pd.Categorical(final_df[col])
# Destroy the list
del df_list
gc.collect()
return final_df
```
```python
def load_full():
dataset_full_no_optimization = load_dataset("amylonidis/PatClass2011",split="train",sep=";",on_bad_lines="skip")
df_full_no_optimization = dataset_full_no_optimization.to_pandas()
return df_full_no_optimization
```
Load All Columns
```python
df = load_full()
```
Load Selected Columns
```python
columns_to_keep = [
"applicants",
"lang"
]
start_date = "1985-03-01"
end_date = "1985-04-30"
df = load_temporal_optimized(start_date, end_date, columns_to_keep)
```
## Loading Script Benchmarks
The following Google Colab notebooks present performance metrics regarding the custom Loading Script performed on different environments
- [Google Colab Environment](https://colab.research.google.com/drive/1RbRJIek_aoEtTVvRYUqc8t5SrGpPR665?usp=sharing)
- [High Performance Server Environment](https://colab.research.google.com/drive/1xEYApVr3jnPTuNx8Xb0xwe0qEw4-gKFZ?usp=sharing)
- [Standard Workstation Environment](https://colab.research.google.com/drive/1sw0ldf1CL8r9rJEU4Sa51WghTJmW502H?usp=sharing)
## Google Colab Analytics
You can also use the following Google Colab notebooks to explore the Analytics that were performed to the dataset.
- [Date Analytics](https://colab.research.google.com/drive/17KXRabtBLPiPmgVIl2N30MoRqzOqlX-N?usp=sharing)
- [Applicant - Inventor Name Analytics](https://colab.research.google.com/drive/1arh4oQ5C9BquulFX-cqsb0lmHgjS5Vcx?usp=sharing)
- [Main Codes Analytics](https://colab.research.google.com/drive/1utNvvmCUGrr81SNyMam2vWqyFUp1fFEq?usp=sharing)
- [Section Title Analytics](https://colab.research.google.com/drive/1hDk25NZykpxenLg1Hck-0J_y6qHWHKOn?usp=sharing)
- [Section Abstract Analytics](https://colab.research.google.com/drive/1a16PS_1KyhhwXSoFJnkjRlVFBn4EQyR1?usp=sharing)
- [Section Claims Analytics](https://colab.research.google.com/drive/1MkrTpMY9u5CyhYIE5MD3MBWbZ0_2GO1w?usp=sharing)
- [Section Description Analytics](https://colab.research.google.com/drive/1D3MPzb1LVFLdnIjuJcD5OJTwuvYz_c5J?usp=sharing)
## Dataset Creation
### Source Data
The PatClass2011 dataset aggregates the patent documents from the CLEF-IP 2011 Test Collection using a parsing script. The data includes both metadata and full-text fields, facilitating a wide range of research applications.
### Annotations
The dataset does not contain any human-written or computer-generated annotations beyond those produced by patent documents of the Source Data.
## Licensing Information
This dataset is distributed under the [MIT License](https://opensource.org/licenses/MIT). Users are free to use, modify, and distribute the dataset, provided that the original authors are credited.
## Citation
If you utilize the PatClass2011 dataset in your research or applications, please cite it appropriately.
--- |