Skip to content

Commit

Permalink
updating crest brat notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
phosseini committed Dec 7, 2021
1 parent 55d49aa commit c529b89
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions notebooks/crest_brat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"source": [
"import os\n",
"import sys\n",
"import pandas as pd\n",
"\n",
"root_path = os.path.abspath(os.path.join(os.path.dirname(\"__file__\"), '..'))\n",
"sys.path.insert(0, root_path)\n",
Expand All @@ -38,17 +39,10 @@
"metadata": {},
"outputs": [],
"source": [
"crest_file_path='../data/crest_sample.xlsx'\n",
"crest_file_path = '../data/crest_sample.xlsx'\n",
"brat_folder_path = '../data/crest_brat/1'\n",
"\n",
"# converting the semeval 2007 dataset to a CREST-formatted data frame\n",
"df, mis = Converter().convert_semeval_2007_4()\n",
"\n",
"# getting a smaller sample\n",
"df = df[:50]\n",
"\n",
"# storing the data frame as an excel file (we need this file when converting data back from BRAT to CREST to read some fields)\n",
"df.to_excel(crest_file_path)\n",
"df = pd.read_excel(crest_file_path)\n",
"\n",
"# now, converting the CREST-formatted data to BRAT\n",
"crest2brat(df, brat_folder_path)"
Expand All @@ -70,20 +64,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# converting BRAT back to CREST-formatted data\n",
"brat2crest(brat_folder_path, crest_file_path)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit c529b89

Please sign in to comment.