Skip to content

flairR: An R Wrapper for Accessing Flair NLP Library

R-MacOS R-ubuntu R-Windows

R-CMD-Check coverage codecov CodeFactor

flaiR is an R package for accessing the flairNLP/flair Python library, maintained by David Liao, Stefan Müller from Next Generation Energy Systems and friends at Text and Policy Research Group and Connected_Politics Lab in UCD. flaiR provides convenient access to the main functionalities of flairNLP for training word embedding-based deep learning models and fine-tune state-of-the-art transformers hosted on Hugging Face. Our team trains and fine-tunes the models with Flair in our projects.


Installation via GitHub

install.packages("remotes")
remotes::install_github("davidycliao/flaiR", force = TRUE)
library(flaiR)


Requirements

flaiR runs the Flair NLP backend in Python, thus requiring Python installation. We have extensively tested flaiR using CI/CD with GitHub Actions, conducting integration tests across various operating systems. These tests includes integration between R versions 4.2.1, 4.3.2, and 4.2.0, along with Python 3.9 and 3.10.x. Additionally, the testing includes environments with PyTorch, Flair NLP, and their dependencies in both R and Python. For stable usage, we strongly recommend installing these specific versions.

OS R Versions Python Version
Mac 4.3.2, 4.2.0, 4.2.1 3.10.x
Mac Latest 3.9
Windows 4.0.5 3.10.x
Windows Latest 3.9
Ubuntu 4.3.2, 4.2.0, 4.2.1 3.10.x
Ubuntu Latest 3.9


Contribution and Open Source

R developers who want to contribute to flaiR are welcome – flaiR is an open source project. We warmly invite R users who share similar interests to join in contributing to this package. Please feel free to shoot me an email us to collaborate on the task. Contributions – whether they be comments, code suggestions, tutorial examples, or forking the repository – are greatly appreciated. Please note that the flaiR is released with the Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

The primary communication channel for R users can be found here. Please feel free to share your insights on the Discussion page and report any issues related to the R interface in the Issue section. If the issue pertains to the actual implementation of Flair in Python, please submit a pull request to the offical flair NLP.