c-ho's picture
Update README.md
d239d4b verified
metadata
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])

Academic Main Text_Classifier (en)

This model is a fine-tuned version of 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

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