# One-Class Learning for AI-Generated Essay Detection
## 2 Materials and Methods
### Datasets  
The dataset (the datasets are available at the following public repository: [[https://github.com/rorizzo/one-class-essay-detection](https://github.com/rorizzo/one-class-essay-detection)]([https://github.com/rorizzo/one-class-essay-detection](https://github.com/rorizzo/one-class-essay-detection)) (accessed on 1 July 2023)) for this study encompasses essays written by L2 English learners, L2 Spanish learners, and AI-generated counterparts. For the human-generated essays, two corpora were used:  
1. **L2 English:** the Uppsala Student English Corpus (USE) ([[https://ota.bodleian.ox.ac.uk/repository/xmlui/handle/20.500.12024/2457](https://ota.bodleian.ox.ac.uk/repository/xmlui/handle/20.500.12024/2457)]([https://ota.bodleian.ox.ac.uk/repository/xmlui/handle/20.500.12024/2457](https://ota.bodleian.ox.ac.uk/repository/xmlui/handle/20.500.12024/2457)) (accessed on 1 July 2023)), which consists of 1489 essays written by Swedish university students learning English. The majority of the essays belong to students in their first term of full-time studies. Essays found in the 'a2' folder in the repository were used for two main reasons: the substantial amount of essays in that folder and the nature of the task. Learners wrote argumentative essays on diverse topics. While argumentative essays are linguistically more complex than introductory or personal experience texts, they are easier to generate using AI. The language proficiency of the students (A2) reflects the performance of a basic user of the language. The total number of human-generated essays in English was 335.
2. **L2 Spanish:** To obtain L2 Spanish data, the UC Davis Corpus of Written Spanish, L2 and Heritage Speakers (COWSL2 HS ([[https://github.com/ucdavisch/cowsl2h](https://github.com/ucdavisch/cowsl2h)]([https://github.com/ucdavisch/cowsl2h](https://github.com/ucdavisch/cowsl2h)) (accessed on 1 July 2023)))) was used. The corpus includes essays written by students in university-level Spanish courses. Essays written only by L2 learners were considered. Similarly to L2 English essays, the language proficiency of the learners was that of a basic user and topics were varied; 350 essays were compiled for analysis.  
The two datasets were complemented with the same amount of AI-generated essays. ChatGPT wrote essays in both languages. For English, the following propmpt was used: \"Write an 800-word essay on [topic] as a second language speaker\". The same instruction was used to collect Spanish texts: \"Escribe un ensayo de 800 palabras sobre [tema] como un hablante de segunda lengua\". [topic] and [tema] were matched for each student essay in the dataset. Data collection occurred in December 2022, a few days after the release of ChatGPT. Thus, drawbacks occurred when generating essays using this tool: word limits or paragraph lengths were not considered in the output provided; requesting the telling of a personal story yielded no results since ChatGPT has no experiences; after the first inquiries on a topic, the output exhibited a high degree of repetition; and there exists a limit on the number of inquiries within an hour. The English dataset is comprised of 670 essays, 335 found in the corpus and 355 generated by AI. The Spanish dataset is made up of 700 essays, equally distributed between human (350) and machine-generated (350) essays. Table 2 shows examples of the dataset.