Datasets:

Modalities:
Text
Languages:
English
ArXiv:
Libraries:
Datasets
License:
nlpaueb commited on
Commit
6e4eb3f
1 Parent(s): 5c6211e

Upload finer-139.py

Browse files
Files changed (1) hide show
  1. finer-139.py +403 -0
finer-139.py ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
16
+ """FiNER-139: A Financial Numeric Entity Recognition dataset"""
17
+
18
+
19
+ import datasets
20
+ import json
21
+ import os
22
+
23
+ logger = datasets.logging.get_logger(__name__)
24
+
25
+ _CITATION = """@inproceedings{loukas-etal-2022-finer,
26
+ title = "{FiNER: Financial Numeric Entity Recognition for XBRL Tagging}",
27
+ author = "Loukas, Lefteris and
28
+ Fergadiotis, Manos and
29
+ Chalkidis, Ilias and
30
+ Spyropoulou, Eirini and
31
+ Malakasiotis, Prodromos and
32
+ Androutsopoulos, Ion and
33
+ Paliouras George",
34
+ booktitle = "Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics",
35
+ month = "may",
36
+ year = "2022",
37
+ publisher = "Association for Computational Linguistics",
38
+ }"""
39
+
40
+ _DESCRIPTION = """
41
+ FiNER-139 is a named entity recognition dataset consisting of 10K annual
42
+ and quarterly English reports (filings) of publicly traded companies
43
+ downloaded from the U.S. Securities and Exchange Commission (SEC)
44
+ annotated with 139 XBRL tags in the IOB2 format.
45
+ """
46
+
47
+ _DATA_URL = "https://zenodo.org/record/6339605/files/finer-139.zip"
48
+
49
+ _HOMEPAGE = "http://nlp.cs.aueb.gr/"
50
+
51
+ _VERSION = "1.0.0"
52
+
53
+ _LABELS = [
54
+ "O",
55
+ "B-AccrualForEnvironmentalLossContingencies",
56
+ "B-AcquiredFiniteLivedIntangibleAssetsWeightedAverageUsefulLife",
57
+ "I-AcquiredFiniteLivedIntangibleAssetsWeightedAverageUsefulLife",
58
+ "B-AllocatedShareBasedCompensationExpense",
59
+ "B-AmortizationOfFinancingCosts",
60
+ "B-AmortizationOfIntangibleAssets",
61
+ "I-AmortizationOfIntangibleAssets",
62
+ "B-AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareAmount",
63
+ "I-AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareAmount",
64
+ "B-AreaOfRealEstateProperty",
65
+ "I-AreaOfRealEstateProperty",
66
+ "B-AssetImpairmentCharges",
67
+ "B-BusinessAcquisitionEquityInterestsIssuedOrIssuableNumberOfSharesIssued",
68
+ "B-BusinessAcquisitionPercentageOfVotingInterestsAcquired",
69
+ "I-BusinessAcquisitionPercentageOfVotingInterestsAcquired",
70
+ "B-BusinessCombinationAcquisitionRelatedCosts",
71
+ "B-BusinessCombinationConsiderationTransferred1",
72
+ "B-BusinessCombinationContingentConsiderationLiability",
73
+ "B-BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedIntangibleAssetsOtherThanGoodwill",
74
+ "B-BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedIntangibles",
75
+ "B-CapitalizedContractCostAmortization",
76
+ "B-CashAndCashEquivalentsFairValueDisclosure",
77
+ "B-ClassOfWarrantOrRightExercisePriceOfWarrantsOrRights1",
78
+ "B-CommonStockCapitalSharesReservedForFutureIssuance",
79
+ "B-CommonStockDividendsPerShareDeclared",
80
+ "B-CommonStockParOrStatedValuePerShare",
81
+ "B-CommonStockSharesAuthorized",
82
+ "I-CommonStockSharesAuthorized",
83
+ "B-CommonStockSharesOutstanding",
84
+ "B-ConcentrationRiskPercentage1",
85
+ "B-ContractWithCustomerLiability",
86
+ "B-ContractWithCustomerLiabilityRevenueRecognized",
87
+ "B-CumulativeEffectOfNewAccountingPrincipleInPeriodOfAdoption",
88
+ "B-DebtInstrumentBasisSpreadOnVariableRate1",
89
+ "B-DebtInstrumentCarryingAmount",
90
+ "B-DebtInstrumentConvertibleConversionPrice1",
91
+ "B-DebtInstrumentFaceAmount",
92
+ "I-DebtInstrumentFaceAmount",
93
+ "B-DebtInstrumentFairValue",
94
+ "B-DebtInstrumentInterestRateEffectivePercentage",
95
+ "B-DebtInstrumentInterestRateStatedPercentage",
96
+ "B-DebtInstrumentMaturityDate",
97
+ "I-DebtInstrumentMaturityDate",
98
+ "B-DebtInstrumentRedemptionPricePercentage",
99
+ "B-DebtInstrumentTerm",
100
+ "I-DebtInstrumentTerm",
101
+ "B-DebtInstrumentUnamortizedDiscount",
102
+ "B-DebtWeightedAverageInterestRate",
103
+ "B-DeferredFinanceCostsGross",
104
+ "B-DeferredFinanceCostsNet",
105
+ "B-DefinedBenefitPlanContributionsByEmployer",
106
+ "B-DefinedContributionPlanCostRecognized",
107
+ "B-Depreciation",
108
+ "B-DerivativeFixedInterestRate",
109
+ "B-DerivativeNotionalAmount",
110
+ "B-DisposalGroupIncludingDiscontinuedOperationConsideration",
111
+ "B-EffectiveIncomeTaxRateContinuingOperations",
112
+ "B-EffectiveIncomeTaxRateReconciliationAtFederalStatutoryIncomeTaxRate",
113
+ "B-EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognized",
114
+ "B-EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedPeriodForRecognition1",
115
+ "I-EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedPeriodForRecognition1",
116
+ "B-EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedShareBasedAwardsOtherThanOptions",
117
+ "B-EmployeeServiceShareBasedCompensationTaxBenefitFromCompensationExpense",
118
+ "B-EquityMethodInvestmentOwnershipPercentage",
119
+ "I-EquityMethodInvestmentOwnershipPercentage",
120
+ "B-EquityMethodInvestments",
121
+ "B-FiniteLivedIntangibleAssetUsefulLife",
122
+ "I-FiniteLivedIntangibleAssetUsefulLife",
123
+ "B-GainsLossesOnExtinguishmentOfDebt",
124
+ "B-Goodwill",
125
+ "B-GoodwillImpairmentLoss",
126
+ "B-GuaranteeObligationsMaximumExposure",
127
+ "B-IncomeLossFromEquityMethodInvestments",
128
+ "B-IncomeTaxExpenseBenefit",
129
+ "B-InterestExpense",
130
+ "B-InterestExpenseDebt",
131
+ "B-LeaseAndRentalExpense",
132
+ "B-LesseeOperatingLeaseRenewalTerm",
133
+ "I-LesseeOperatingLeaseRenewalTerm",
134
+ "B-LesseeOperatingLeaseTermOfContract",
135
+ "I-LesseeOperatingLeaseTermOfContract",
136
+ "B-LettersOfCreditOutstandingAmount",
137
+ "B-LineOfCredit",
138
+ "B-LineOfCreditFacilityCommitmentFeePercentage",
139
+ "B-LineOfCreditFacilityCurrentBorrowingCapacity",
140
+ "B-LineOfCreditFacilityInterestRateAtPeriodEnd",
141
+ "B-LineOfCreditFacilityMaximumBorrowingCapacity",
142
+ "B-LineOfCreditFacilityRemainingBorrowingCapacity",
143
+ "B-LineOfCreditFacilityUnusedCapacityCommitmentFeePercentage",
144
+ "B-LongTermDebt",
145
+ "B-LongTermDebtFairValue",
146
+ "B-LossContingencyAccrualAtCarryingValue",
147
+ "B-LossContingencyDamagesSoughtValue",
148
+ "B-LossContingencyEstimateOfPossibleLoss",
149
+ "B-LossContingencyPendingClaimsNumber",
150
+ "I-LossContingencyPendingClaimsNumber",
151
+ "B-MinorityInterestOwnershipPercentageByNoncontrollingOwners",
152
+ "B-MinorityInterestOwnershipPercentageByParent",
153
+ "B-NumberOfOperatingSegments",
154
+ "B-NumberOfRealEstateProperties",
155
+ "I-NumberOfRealEstateProperties",
156
+ "B-NumberOfReportableSegments",
157
+ "B-OperatingLeaseCost",
158
+ "B-OperatingLeaseExpense",
159
+ "B-OperatingLeaseLiability",
160
+ "B-OperatingLeasePayments",
161
+ "B-OperatingLeaseRightOfUseAsset",
162
+ "B-OperatingLeaseWeightedAverageDiscountRatePercent",
163
+ "B-OperatingLeaseWeightedAverageRemainingLeaseTerm1",
164
+ "I-OperatingLeaseWeightedAverageRemainingLeaseTerm1",
165
+ "B-OperatingLeasesRentExpenseNet",
166
+ "B-OperatingLossCarryforwards",
167
+ "B-PaymentsToAcquireBusinessesGross",
168
+ "B-PaymentsToAcquireBusinessesNetOfCashAcquired",
169
+ "B-PreferredStockDividendRatePercentage",
170
+ "B-PreferredStockSharesAuthorized",
171
+ "I-PreferredStockSharesAuthorized",
172
+ "B-ProceedsFromIssuanceOfCommonStock",
173
+ "B-PropertyPlantAndEquipmentUsefulLife",
174
+ "I-PropertyPlantAndEquipmentUsefulLife",
175
+ "B-PublicUtilitiesRequestedRateIncreaseDecreaseAmount",
176
+ "B-RelatedPartyTransactionAmountsOfTransaction",
177
+ "I-RelatedPartyTransactionAmountsOfTransaction",
178
+ "B-RelatedPartyTransactionExpensesFromTransactionsWithRelatedParty",
179
+ "I-RelatedPartyTransactionExpensesFromTransactionsWithRelatedParty",
180
+ "B-RepaymentsOfDebt",
181
+ "B-RestructuringAndRelatedCostExpectedCost1",
182
+ "B-RestructuringCharges",
183
+ "B-RevenueFromContractWithCustomerExcludingAssessedTax",
184
+ "B-RevenueFromContractWithCustomerIncludingAssessedTax",
185
+ "B-RevenueFromRelatedParties",
186
+ "B-RevenueRemainingPerformanceObligation",
187
+ "B-Revenues",
188
+ "B-SaleOfStockNumberOfSharesIssuedInTransaction",
189
+ "I-SaleOfStockNumberOfSharesIssuedInTransaction",
190
+ "B-SaleOfStockPricePerShare",
191
+ "B-ShareBasedCompensation",
192
+ "B-ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1",
193
+ "I-ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1",
194
+ "B-ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriod",
195
+ "I-ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriod",
196
+ "B-ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriodWeightedAverageGrantDateFairValue",
197
+ "B-ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedNumber",
198
+ "B-ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriodTotalFairValue",
199
+ "B-ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAuthorized",
200
+ "I-ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAuthorized",
201
+ "B-ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant",
202
+ "B-ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisesInPeriodTotalIntrinsicValue",
203
+ "B-ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodGross",
204
+ "B-ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodWeightedAverageGrantDateFairValue",
205
+ "B-SharePrice",
206
+ "B-SharebasedCompensationArrangementBySharebasedPaymentAwardAwardVestingRightsPercentage",
207
+ "I-SharebasedCompensationArrangementBySharebasedPaymentAwardAwardVestingRightsPercentage",
208
+ "B-SharebasedCompensationArrangementBySharebasedPaymentAwardExpirationPeriod",
209
+ "I-SharebasedCompensationArrangementBySharebasedPaymentAwardExpirationPeriod",
210
+ "B-StockIssuedDuringPeriodSharesNewIssues",
211
+ "I-StockIssuedDuringPeriodSharesNewIssues",
212
+ "B-StockRepurchaseProgramAuthorizedAmount1",
213
+ "B-StockRepurchaseProgramRemainingAuthorizedRepurchaseAmount1",
214
+ "B-StockRepurchasedAndRetiredDuringPeriodShares",
215
+ "B-StockRepurchasedDuringPeriodShares",
216
+ "I-StockRepurchasedDuringPeriodShares",
217
+ "B-SupplementalInformationForPropertyCasualtyInsuranceUnderwritersPriorYearClaimsAndClaimsAdjustmentExpense",
218
+ "B-TreasuryStockAcquiredAverageCostPerShare",
219
+ "B-TreasuryStockSharesAcquired",
220
+ "I-TreasuryStockSharesAcquired",
221
+ "B-TreasuryStockValueAcquiredCostMethod",
222
+ "B-UnrecognizedTaxBenefits",
223
+ "B-UnrecognizedTaxBenefitsThatWouldImpactEffectiveTaxRate",
224
+ "I-DeferredFinanceCostsGross",
225
+ "I-CommonStockParOrStatedValuePerShare",
226
+ "I-LossContingencyEstimateOfPossibleLoss",
227
+ "I-DefinedContributionPlanCostRecognized",
228
+ "I-DebtInstrumentFairValue",
229
+ "I-ContractWithCustomerLiabilityRevenueRecognized",
230
+ "I-RevenueRemainingPerformanceObligation",
231
+ "I-EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognized",
232
+ "I-DebtInstrumentInterestRateStatedPercentage",
233
+ "I-OperatingLossCarryforwards",
234
+ "I-MinorityInterestOwnershipPercentageByNoncontrollingOwners",
235
+ "I-InterestExpense",
236
+ "I-LongTermDebt",
237
+ "I-ShareBasedCompensation",
238
+ "I-DebtWeightedAverageInterestRate",
239
+ "I-DebtInstrumentCarryingAmount",
240
+ "I-DebtInstrumentConvertibleConversionPrice1",
241
+ "I-IncomeTaxExpenseBenefit",
242
+ "I-ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodWeightedAverageGrantDateFairValue",
243
+ "I-EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedShareBasedAwardsOtherThanOptions",
244
+ "I-EquityMethodInvestments",
245
+ "I-DebtInstrumentUnamortizedDiscount",
246
+ "I-GainsLossesOnExtinguishmentOfDebt",
247
+ "I-ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant",
248
+ "I-BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedIntangibleAssetsOtherThanGoodwill",
249
+ "I-PreferredStockDividendRatePercentage",
250
+ "I-RevenueFromContractWithCustomerIncludingAssessedTax",
251
+ "I-OperatingLeaseWeightedAverageDiscountRatePercent",
252
+ "I-LineOfCredit",
253
+ "I-LineOfCreditFacilityMaximumBorrowingCapacity",
254
+ "I-EffectiveIncomeTaxRateReconciliationAtFederalStatutoryIncomeTaxRate",
255
+ "I-LineOfCreditFacilityCommitmentFeePercentage",
256
+ "I-BusinessCombinationConsiderationTransferred1",
257
+ "I-CommonStockDividendsPerShareDeclared",
258
+ "I-DebtInstrumentBasisSpreadOnVariableRate1",
259
+ "I-DisposalGroupIncludingDiscontinuedOperationConsideration",
260
+ "I-ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodGross",
261
+ "I-CommonStockSharesOutstanding",
262
+ "I-AmortizationOfFinancingCosts",
263
+ "I-LineOfCreditFacilityCurrentBorrowingCapacity",
264
+ "I-TreasuryStockValueAcquiredCostMethod",
265
+ "I-ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedNumber",
266
+ "I-DebtInstrumentInterestRateEffectivePercentage",
267
+ "I-SaleOfStockPricePerShare",
268
+ "I-CapitalizedContractCostAmortization",
269
+ "I-RestructuringCharges",
270
+ "I-ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriodTotalFairValue",
271
+ "I-AccrualForEnvironmentalLossContingencies",
272
+ "I-CashAndCashEquivalentsFairValueDisclosure",
273
+ "I-ProceedsFromIssuanceOfCommonStock",
274
+ "I-Revenues",
275
+ "I-BusinessCombinationRecognizedIdentifiableAssetsAcquiredAndLiabilitiesAssumedIntangibles",
276
+ "I-LettersOfCreditOutstandingAmount",
277
+ "I-ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriodWeightedAverageGrantDateFairValue",
278
+ "I-OperatingLeasePayments",
279
+ "I-LineOfCreditFacilityRemainingBorrowingCapacity",
280
+ "I-PaymentsToAcquireBusinessesGross",
281
+ "I-TreasuryStockAcquiredAverageCostPerShare",
282
+ "I-DeferredFinanceCostsNet",
283
+ "I-StockRepurchaseProgramAuthorizedAmount1",
284
+ "I-InterestExpenseDebt",
285
+ "I-ContractWithCustomerLiability",
286
+ "I-OperatingLeaseExpense",
287
+ "I-Depreciation",
288
+ "I-AllocatedShareBasedCompensationExpense",
289
+ "I-LossContingencyAccrualAtCarryingValue",
290
+ "I-LineOfCreditFacilityUnusedCapacityCommitmentFeePercentage",
291
+ "I-SupplementalInformationForPropertyCasualtyInsuranceUnderwritersPriorYearClaimsAndClaimsAdjustmentExpense",
292
+ "I-OperatingLeaseLiability",
293
+ "I-RevenueFromRelatedParties",
294
+ "I-PaymentsToAcquireBusinessesNetOfCashAcquired",
295
+ "I-BusinessCombinationContingentConsiderationLiability",
296
+ "I-LossContingencyDamagesSoughtValue",
297
+ "I-NumberOfOperatingSegments",
298
+ "I-BusinessAcquisitionEquityInterestsIssuedOrIssuableNumberOfSharesIssued",
299
+ "I-OperatingLeaseRightOfUseAsset",
300
+ "I-BusinessCombinationAcquisitionRelatedCosts",
301
+ "I-UnrecognizedTaxBenefits",
302
+ "I-GuaranteeObligationsMaximumExposure",
303
+ "I-RestructuringAndRelatedCostExpectedCost1",
304
+ "I-DefinedBenefitPlanContributionsByEmployer",
305
+ "I-OperatingLeaseCost",
306
+ "I-DerivativeFixedInterestRate",
307
+ "I-Goodwill",
308
+ "I-GoodwillImpairmentLoss",
309
+ "I-CommonStockCapitalSharesReservedForFutureIssuance",
310
+ "I-StockRepurchasedAndRetiredDuringPeriodShares",
311
+ "I-EmployeeServiceShareBasedCompensationTaxBenefitFromCompensationExpense",
312
+ "I-IncomeLossFromEquityMethodInvestments",
313
+ "I-NumberOfReportableSegments",
314
+ "I-LongTermDebtFairValue",
315
+ "I-RepaymentsOfDebt",
316
+ "I-ConcentrationRiskPercentage1",
317
+ "I-DebtInstrumentRedemptionPricePercentage",
318
+ "I-CumulativeEffectOfNewAccountingPrincipleInPeriodOfAdoption",
319
+ "I-SharePrice",
320
+ "I-UnrecognizedTaxBenefitsThatWouldImpactEffectiveTaxRate",
321
+ "I-ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisesInPeriodTotalIntrinsicValue",
322
+ "I-EffectiveIncomeTaxRateContinuingOperations",
323
+ "I-RevenueFromContractWithCustomerExcludingAssessedTax",
324
+ "I-StockRepurchaseProgramRemainingAuthorizedRepurchaseAmount1",
325
+ "I-LineOfCreditFacilityInterestRateAtPeriodEnd",
326
+ "I-ClassOfWarrantOrRightExercisePriceOfWarrantsOrRights1",
327
+ "I-OperatingLeasesRentExpenseNet",
328
+ "I-LeaseAndRentalExpense",
329
+ "I-PublicUtilitiesRequestedRateIncreaseDecreaseAmount",
330
+ "I-MinorityInterestOwnershipPercentageByParent",
331
+ "I-AssetImpairmentCharges",
332
+ "I-DerivativeNotionalAmount",
333
+ ]
334
+
335
+
336
+ class Finer139Config(datasets.BuilderConfig):
337
+ """BuilderConfig for FiNER-139"""
338
+ def __init__(self, **kwargs):
339
+ super(Finer139Config, self).__init__(version=datasets.Version(_VERSION, ""), **kwargs)
340
+
341
+
342
+ class Finer139(datasets.GeneratorBasedBuilder):
343
+ """
344
+ FiNER-139 is a named entity recognition dataset consisting of 10K annual
345
+ and quarterly English reports (filings) of publicly traded companies
346
+ downloaded from the U.S. Securities and Exchange Commission (SEC)
347
+ annotated with 139 XBRL tags in the IOB2 format.
348
+ """
349
+
350
+ VERSION = datasets.Version(_VERSION)
351
+ BUILDER_CONFIGS = [
352
+ Finer139Config(name='finer139', description="FiNER-139 dataset")
353
+ ]
354
+
355
+ def _info(self):
356
+ features = datasets.Features(
357
+ {
358
+ "id": datasets.Value("int32"),
359
+ "tokens": datasets.Sequence(datasets.Value("string")),
360
+ "ner_tags": datasets.Sequence(datasets.features.ClassLabel(names=_LABELS))
361
+ }
362
+ )
363
+ return datasets.DatasetInfo(
364
+ description=_DESCRIPTION,
365
+ features=features,
366
+ supervised_keys=None,
367
+ homepage=_HOMEPAGE,
368
+ citation=_CITATION,
369
+ )
370
+
371
+ def _split_generators(self, dl_manager):
372
+ data_dir = dl_manager.download_and_extract(_DATA_URL)
373
+
374
+ return [
375
+ datasets.SplitGenerator(
376
+ name=datasets.Split.TRAIN,
377
+ gen_kwargs={"filepath": os.path.join(data_dir, "train.jsonl")},
378
+ ),
379
+ datasets.SplitGenerator(
380
+ name=datasets.Split.VALIDATION,
381
+ gen_kwargs={"filepath": os.path.join(data_dir, "validation.jsonl")},
382
+ ),
383
+ datasets.SplitGenerator(
384
+ name=datasets.Split.TEST,
385
+ gen_kwargs={"filepath": os.path.join(data_dir, "test.jsonl")},
386
+ )
387
+ ]
388
+
389
+ def _generate_examples(self, filepath):
390
+ """
391
+ Reads line by line samples and generates examples.
392
+
393
+ :param filepath: Path to jsonl file with line by line samples.
394
+ """
395
+ logger.info("⏳ Generating examples from = %s", filepath)
396
+ with open(filepath, encoding="utf-8") as f:
397
+ for row in f:
398
+ data = json.loads(row)
399
+ yield data["id"], {
400
+ "id": data["id"],
401
+ "tokens": data["tokens"],
402
+ "ner_tags": data["ner_tags"]
403
+ }