<jupyter_start><jupyter_text>Testing the query API for the EP-full-text data  Imports<jupyter_code>import pandas as pd
import sys
sys.path.append("../")
# import custom modules
#from src.ep_text_util import test_query_ep_full_text as api
from src.ep_text_util import query_full_text as api<jupyter_output><empty_output><jupyter_text>Location of the data<jupyter_code># location of the PATSTAT data previously retrieved with the data_extraction_from_PATSTAT.ipynb notebook
output_files_prefix = 'test_query'
pre = '../data/raw/' + output_files_prefix
suf = '.csv'
# location of the patstat database
path_patstat = r'../data/ep_full_text_database/2020_edition/EP'<jupyter_output><empty_output><jupyter_text>Load data<jupyter_code># load PATSTAT data
table_main_patent_infos = pd.read_csv(pre + '_table_main_patent_infos' + suf, low_memory=False)<jupyter_output><empty_output><jupyter_text>Retrieve data from the EP-full text data using the custom API<jupyter_code>%%time

API = api.ApiEpoFullText()
API.fit_patstat_data(path = path_patstat, patstat_data = table_main_patent_infos)
full_text_data = API.query()<jupyter_output>Bucket 1 out of 16
Retrieving data from  ../data/ep_full_text_database/2020_edition/EP0300000.txt
Bucket 2 out of 16
Retrieving data from  ../data/ep_full_text_database/2020_edition/EP0400000.txt<jupyter_text>Store the result in a csv file<jupyter_code>file = pre + '_full_text' + suf # where to save
print('Saving results in {}'.format(file))
full_text_data.to_csv(file)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09383202099737532, 'fraction_numerical': 0.02099737532808399, 'mean_word_length': 7.288043478260869, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '494338', 'license': 'MIT', 'n_tokens_mistral': 577, 'n_tokens_neox': 541, 'n_words': 119, 'path': 'notebooks/query_full_text_with_API.ipynb', 'repo_name': 'amc-econ/nlp_patent_classification', 'size': '1524'}