File size: 7,425 Bytes
1dbf275
 
 
 
 
 
1d37b85
1dbf275
 
 
 
 
 
 
 
1d37b85
 
 
 
 
 
 
 
1dbf275
 
 
 
 
1d37b85
1dbf275
83c258a
1dbf275
84b6fce
 
 
 
 
1dbf275
 
 
1d37b85
 
c0cf35d
 
 
 
1dbf275
 
 
1d37b85
 
baf151d
 
1d37b85
 
 
 
 
 
 
 
 
 
 
d239d4b
1d37b85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1dbf275
f85f530
 
 
 
 
1dbf275
 
4649deb
 
83c258a
4649deb
83c258a
1dbf275
4649deb
1dbf275
 
 
 
 
 
84b6fce
 
1dbf275
 
 
 
 
 
 
 
 
 
84b6fce
 
 
 
 
1dbf275
 
 
 
 
 
 
 
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
---
library_name: transformers
license: mit
base_model: FacebookAI/xlm-roberta-base
tags:
- generated_from_trainer
language: en
metrics:
- accuracy
- precision
- recall
- f1
model-index:
- name: academic_main_text_classifier_en
  results: []
widget:
 - text: "In the case of (ioii) and (1 lii), the passive transformation will apply to the embedded sentence, and in all four cases other operations will give the final surface forms of (8) and (g)."
 - text: "(10) (i) Noun Phrase — Verb — Noun Phrase — Sentence (/ — persuaded — a specialist — a specialist will examine John) (ii) Noun Phrase — Verb — Noun Phrase — Sentence (/ — persuaded — John — a specialist will examine John)"
 - text: "184 SOME RESIDUAL PROBLEMS"
 - text: "Peshkovskii, A. M. (1956). Russkii Sintaksis v Nauchnom Osveshchenii. Moscow."
 - text: "S -» NP^Aux^VP"
 - text: "(sincerity, [+N, —Count, +Abstract]) (boy, [+N, —Count, +Common, +Animate, +Human]) (may, [+M])"

---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# Academic Main Text_Classifier (en)

This model is a fine-tuned version of [FacebookAI/xlm-roberta-base](https://huggingface.co/FacebookAI/xlm-roberta-base) on a labelled dataset of publications in the Bibliography of Linguistic Literature.
It achieves the following results on the evaluation set:
- Loss: 0.3476
- Accuracy: 0.9242
- Precision: 0.9242
- Recall: 0.9242
- F1: 0.9242

## Model description

The model is fine-tuned with academic publications in Linguistics, to classify texts in publications into 4 classes as a filter to other tasks. Sentence-based data obtained from OCR-processed PDF files was annotated manually with the following classes:

- 0: out of scope - materials that are of low significance, eg. page number and page header, noise from OCR/pdf-to-text convertion
- 1: main text - texts that are the main texts of the publication, to be used for down-stream tasks
- 2: examples - texts that are captions of the figures, or quotes or excerpts
- 3: references - references of the publication, excluding in-text citations

## Intended uses & limitations

Intended uses:

- filter out noise from OCR of academic texts (conference papers, journals, books etc.)
- extract main text in academic texts for down-stream NLP tasks

Limitations:

- training and evaluation data is limited to English, and academic texts in Linguistics (though still to a higher extent usable for German texts)

## How to run

```python
from transformers import pipeline

# define model name
model_name = "ubffm/academic_text_classifier_en"

# run model with hf pipeline
## return output for the best label
## eg. [{'label': 'EXAMPLE', 'score': 0.9601941108703613}]
classifier = pipeline("text-classification", model=model_name, tokenizer=model_name)

## return output for all labels
## eg. [[{'label': 'OUT OF SCOPE', 'score': 0.007808608002960682}, {'label': 'MAIN TEXT', 'score': 0.028077520430088043}, {'label': 'EXAMPLE', 'score': 0.9601941108703613}, {'label': 'REFERENCE', 'score': 0.003919811453670263}]]
classifier = pipeline("text-classification", model=model_name, tokenizer=model_name, return_all_scores=True)

# Perform inference on your input text
your_text = "your text here."
result = classifier(your_text)

print(result)
```

## Try it yourself with the following examples (not in training/ evaluation data)

Excerpts from Chomsky, N. (2014). Aspects of the Theory of Syntax (No. 11). MIT press.
retrieved from https://apps.dtic.mil/sti/pdfs/AD0616323.pdf

- In the case of (ioii) and (1 lii), the passive transformation will
apply to the embedded sentence, and in all four cases other
operations will give the final surface forms of (8) and (g).


- (10) (i) Noun Phrase — Verb — Noun Phrase — Sentence
(/ — persuaded — a specialist — a specialist will examine
John)
(ii) Noun Phrase — Verb — Noun Phrase — Sentence
(/ — persuaded — John — a specialist will examine John)


- (13) S
Det
Predicate-Phrase
[+Definite] nom VP
their
F1...Fm Det N
destroy [+Definite] G, ... G,
the property

- 184 SOME RESIDUAL PROBLEMS

- Peshkovskii, A. M. (1956). Russkii Sintaksis v Nauchnom Osveshchenii.
Moscow.

- S -» NP^Aux^VP

- (sincerity, [+N, —Count, +Abstract])
(boy, [+N, —Count, +Common, +Animate, +Human])
(may, [+M])


## Problematic cases

Definitions or findings written in point form are challenging for the model. For example:

- (2) (i) the string (1) is a Sentence (S); frighten the boy is a Verb
Phrase (VP) consisting of the Verb (V) frighten and the
Noun Phrase (NP) the boy; sincerity is also an NP; the
NP the boy consists of the Determiner (Det) the, followed
by a Noun (N); the NP sincerity consists of just an N;
the is, furthermore, an Article (Art); may is a Verbal
Auxiliary (Aux) and, furthermore, a Modal (M).

- (v) specification of a function m such that m(i) is an integer
associated with the grammar G4 as its value (with, let us
say, lower value indicated by higher number)

Another type of input is, longer and sentence-like running titles. For example:

- Verb Placement in Early West-Germanic 155


## Training and evaluation data

- Manually labelled dataset on Huggingface:
ubffm/academic_main_text_classifier_en_annotated (https://huggingface.co/datasets/ubffm/academic_main_text_classifier_en_annotated)

- The Bibliography of Linguistic Literature (BLL) is one of the most comprehensive sources of bibliographic information for the general linguistics with its subdomains and neighboring disciplines as well as for the English, German and Romance linguistics. The subject bibliography is based mainly on the library's holdings on linguistics. It lists monographs, dissertations, articles from periodicals, collective works, conference contributions, unpublished research papers, etc. The printed edition is published annually (at the end of each year) and covers the literature of the previous year and some supplements. Usually, it includes about 10,000 references per year. (Frankfurt a. M. : Klostermann, 1.1971/75(1976) - 47.2021 (2022))
(See more at https://www.ub.uni-frankfurt.de/linguistik/sammlung_en.html)


## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 16
- eval_batch_size: 32
- seed: 42
- optimizer: Use adamw_torch_fused with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- lr_scheduler_warmup_steps: 500
- num_epochs: 5

### Training results

| Training Loss | Epoch | Step | Validation Loss | Accuracy | Precision | Recall | F1     |
|:-------------:|:-----:|:----:|:---------------:|:--------:|:---------:|:------:|:------:|
| 0.374         | 1.0   | 762  | 0.3602          | 0.9035   | 0.9035    | 0.9035 | 0.9035 |
| 0.2924        | 2.0   | 1524 | 0.3104          | 0.9170   | 0.9170    | 0.9170 | 0.9170 |
| 0.2438        | 3.0   | 2286 | 0.2851          | 0.9262   | 0.9262    | 0.9262 | 0.9262 |
| 0.1795        | 4.0   | 3048 | 0.3492          | 0.9252   | 0.9252    | 0.9252 | 0.9252 |
| 0.151         | 5.0   | 3810 | 0.3476          | 0.9242   | 0.9242    | 0.9242 | 0.9242 |


### Framework versions

- Transformers 4.57.1
- Pytorch 2.9.0+cu128
- Datasets 4.2.0
- Tokenizers 0.22.1