jeanpoll
commited on
Commit
·
237ffba
1
Parent(s):
6b57103
remove everything v2
Browse files- .idea/.gitignore +0 -3
- .idea/inspectionProfiles/Project_Default.xml +0 -14
- .idea/inspectionProfiles/profiles_settings.xml +0 -6
- .idea/misc.xml +0 -4
- .idea/modules.xml +0 -8
- .idea/vcs.xml +0 -6
- .idea/wikiner_fr.iml +0 -8
- .ipynb_checkpoints/wikiner_fr-checkpoint.py +0 -169
.idea/.gitignore
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
# Default ignored files
|
2 |
-
/shelf/
|
3 |
-
/workspace.xml
|
|
|
|
|
|
|
|
.idea/inspectionProfiles/Project_Default.xml
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<component name="InspectionProjectProfileManager">
|
2 |
-
<profile version="1.0">
|
3 |
-
<option name="myName" value="Project Default" />
|
4 |
-
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
5 |
-
<option name="ignoredPackages">
|
6 |
-
<value>
|
7 |
-
<list size="1">
|
8 |
-
<item index="0" class="java.lang.String" itemvalue="transformers" />
|
9 |
-
</list>
|
10 |
-
</value>
|
11 |
-
</option>
|
12 |
-
</inspection_tool>
|
13 |
-
</profile>
|
14 |
-
</component>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.idea/inspectionProfiles/profiles_settings.xml
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<component name="InspectionProjectProfileManager">
|
2 |
-
<settings>
|
3 |
-
<option name="USE_PROJECT_PROFILE" value="false" />
|
4 |
-
<version value="1.0" />
|
5 |
-
</settings>
|
6 |
-
</component>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.idea/misc.xml
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<project version="4">
|
3 |
-
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (nlp_37_dev)" project-jdk-type="Python SDK" />
|
4 |
-
</project>
|
|
|
|
|
|
|
|
|
|
.idea/modules.xml
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<project version="4">
|
3 |
-
<component name="ProjectModuleManager">
|
4 |
-
<modules>
|
5 |
-
<module fileurl="file://$PROJECT_DIR$/.idea/wikiner_fr.iml" filepath="$PROJECT_DIR$/.idea/wikiner_fr.iml" />
|
6 |
-
</modules>
|
7 |
-
</component>
|
8 |
-
</project>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.idea/vcs.xml
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<project version="4">
|
3 |
-
<component name="VcsDirectoryMappings">
|
4 |
-
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
5 |
-
</component>
|
6 |
-
</project>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.idea/wikiner_fr.iml
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<module type="PYTHON_MODULE" version="4">
|
3 |
-
<component name="NewModuleRootManager">
|
4 |
-
<content url="file://$MODULE_DIR$" />
|
5 |
-
<orderEntry type="jdk" jdkName="Python 3.7 (nlp_37_dev)" jdkType="Python SDK" />
|
6 |
-
<orderEntry type="sourceFolder" forTests="false" />
|
7 |
-
</component>
|
8 |
-
</module>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ipynb_checkpoints/wikiner_fr-checkpoint.py
DELETED
@@ -1,169 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
"""Wikiner dataset for NER in french language """
|
16 |
-
|
17 |
-
from __future__ import absolute_import, division, print_function
|
18 |
-
|
19 |
-
import csv
|
20 |
-
import json
|
21 |
-
import os
|
22 |
-
|
23 |
-
import datasets
|
24 |
-
from datasets import Dataset
|
25 |
-
|
26 |
-
|
27 |
-
_NER_LABEL_NAMES = [
|
28 |
-
"O",
|
29 |
-
"LOC",
|
30 |
-
"PER",
|
31 |
-
"MISC",
|
32 |
-
"ORG"
|
33 |
-
]
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
# TODO: Add BibTeX citation
|
38 |
-
# Find for instance the citation on arxiv or on the dataset repo/website
|
39 |
-
_CITATION = """\
|
40 |
-
@InProceedings{huggingface:dataset,
|
41 |
-
title = {Wikiner dataset for NER task in french},
|
42 |
-
authors={Created by Nothman et al. at 2013},
|
43 |
-
year={2013}
|
44 |
-
}
|
45 |
-
"""
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
# TODO: Add description of the dataset here
|
53 |
-
# You can copy an official description
|
54 |
-
_DESCRIPTION = """\
|
55 |
-
Dataset can be used to train on NER task for french langugage.
|
56 |
-
"""
|
57 |
-
|
58 |
-
# TODO: Add a link to an official homepage for the dataset here
|
59 |
-
_HOMEPAGE = "https://www.sciencedirect.com/science/article/pii/S0004370212000276?via%3Dihub"
|
60 |
-
|
61 |
-
# TODO: Add the licence for the dataset here if you can find it
|
62 |
-
_LICENSE = ""
|
63 |
-
|
64 |
-
# TODO: Add link to the official dataset URLs here
|
65 |
-
# The HuggingFace dataset library don't host the datasets but only point to the original files
|
66 |
-
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
67 |
-
_URLs = {
|
68 |
-
"NER": "https://huggingface.co/datasets/Jean-Baptiste/wikiner_fr/resolve/main/data.zip"
|
69 |
-
}
|
70 |
-
|
71 |
-
|
72 |
-
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
73 |
-
class WikinerFr(datasets.GeneratorBasedBuilder):
|
74 |
-
|
75 |
-
VERSION = datasets.Version("1.0.0")
|
76 |
-
|
77 |
-
# This is an example of a dataset with multiple configurations.
|
78 |
-
# If you don't want/need to define several sub-sets in your dataset,
|
79 |
-
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
80 |
-
|
81 |
-
# If you need to make complex sub-parts in the datasets with configurable options
|
82 |
-
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
83 |
-
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
84 |
-
|
85 |
-
# You will be able to load one or the other configurations in the following list with
|
86 |
-
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
87 |
-
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
88 |
-
BUILDER_CONFIGS = [
|
89 |
-
datasets.BuilderConfig(name="NER", version="0.0.1", description="Dataset for entity recognition")
|
90 |
-
]
|
91 |
-
|
92 |
-
DEFAULT_CONFIG_NAME = "NER" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
93 |
-
|
94 |
-
def _info(self):
|
95 |
-
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
96 |
-
if self.config.name == "NER": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
97 |
-
features = datasets.Features(
|
98 |
-
{
|
99 |
-
"id": datasets.Value("int32"),
|
100 |
-
"ner_tags": datasets.Sequence(
|
101 |
-
feature=datasets.ClassLabel(num_classes=len(_NER_LABEL_NAMES), names=_NER_LABEL_NAMES)
|
102 |
-
),
|
103 |
-
"tokens": datasets.Sequence(feature=datasets.Value("string")),
|
104 |
-
}
|
105 |
-
)
|
106 |
-
|
107 |
-
return datasets.DatasetInfo(
|
108 |
-
# This is the description that will appear on the datasets page.
|
109 |
-
description=_DESCRIPTION,
|
110 |
-
# This defines the different columns of the dataset and their types
|
111 |
-
features=features, # Here we define them above because they are different between the two configurations
|
112 |
-
# If there's a common (input, target) tuple from the features,
|
113 |
-
# specify them here. They'll be used if as_supervised=True in
|
114 |
-
# builder.as_dataset.
|
115 |
-
supervised_keys=("id", "ner_tags"),
|
116 |
-
# Homepage of the dataset for documentation
|
117 |
-
homepage=_HOMEPAGE,
|
118 |
-
# License for the dataset if available
|
119 |
-
license=_LICENSE,
|
120 |
-
# Citation for the dataset
|
121 |
-
citation=_CITATION,
|
122 |
-
)
|
123 |
-
|
124 |
-
def _split_generators(self, dl_manager):
|
125 |
-
"""Returns SplitGenerators."""
|
126 |
-
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
127 |
-
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
128 |
-
|
129 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
|
130 |
-
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
131 |
-
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
132 |
-
|
133 |
-
if self.config.data_dir:
|
134 |
-
data_dir = self.config.data_dir
|
135 |
-
else:
|
136 |
-
my_urls = _URLs[self.config.name]
|
137 |
-
data_dir = dl_manager.download_and_extract(my_urls)
|
138 |
-
|
139 |
-
|
140 |
-
return [
|
141 |
-
datasets.SplitGenerator(
|
142 |
-
name=datasets.Split.TRAIN,
|
143 |
-
# These kwargs will be passed to _generate_examples
|
144 |
-
gen_kwargs={
|
145 |
-
"filepath": os.path.join(data_dir, "data","train"),
|
146 |
-
"split": "train",
|
147 |
-
},
|
148 |
-
),
|
149 |
-
datasets.SplitGenerator(
|
150 |
-
name=datasets.Split.TEST,
|
151 |
-
# These kwargs will be passed to _generate_examples
|
152 |
-
gen_kwargs={
|
153 |
-
"filepath": os.path.join(data_dir, "data", "test"),
|
154 |
-
"split": "test"
|
155 |
-
},
|
156 |
-
)
|
157 |
-
]
|
158 |
-
|
159 |
-
def _generate_examples(
|
160 |
-
self, filepath, split # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
161 |
-
):
|
162 |
-
""" Yields examples as (key, example) tuples. """
|
163 |
-
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
164 |
-
# The `key` is here for legacy reason (tfds) and is not important in itself.
|
165 |
-
dataset = Dataset.load_from_disk(filepath)
|
166 |
-
for i in range(0, len(dataset)):
|
167 |
-
# print(dataset[i])
|
168 |
-
yield i, {"id": str(dataset[i]["id"]),"tokens": dataset[i]["tokens"], "ner_tags": dataset[i]["ner_tags"]}
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|