flaiR is an R package that provides convenient access to flairNLP/flair, a powerful Python-based NLP toolkit developed by Humboldt University of Berlin. flaiR package is maintained by Yen-Chieh Liao (University of Birmingham) and Stefan Müller from Next Generation Energy Systems and Text and Policy Research Group at UCD.
Through flaiR, R users can easily utilize and combine various word embeddings, train deep learning models, and fine-tune the latest transformer models from Hugging Face, bridging advanced NLP techniques with popular quantitative text analysis toolkits like quanteda in the R environment.
For more detailed tutorial instructions, please visit Flair NLP and flaiR for Social Science.
Required Softwares
- Python >= 3.10
- R >= 4.2.0
- Rstudio
Operation Systems
OS | R Versions | Python Version |
---|---|---|
Mac | 4.3.2, 4.2.0, |
3.10.x, 3.9 |
Windows | 4.0.5, Latest | 3.10.x, 3.9 |
Ubuntu | 4.3.2, 4.2.0, 4.2.1 | 3.10.x, 3.9 |
*: On R 4.2.1, particularly when using the Matrix package on ARM 64 architecture Macs (M1/M2), compatibility issues with gfortran may occur. It’s recommended to avoid this combination.
install.packages("remotes")
remotes::install_github("davidycliao/flaiR", force = TRUE)
library(flaiR)
#> flaiR: An R Wrapper for Accessing Flair NLP 0.13.1
Intel/AMD Processors:
# Pull image
docker pull ghcr.io/davidycliao/flair-rstudio:latest
# Run container
docker run -d -p 8787:8787 --user root --name flair-rstudio ghcr.io/davidycliao/flair-rstudio:latest
Apple Silicon (M1/M2 Mac):
# Pull image
docker pull --platform linux/amd64 ghcr.io/davidycliao/flair-rstudio:latest
# Run container
docker run -d -p 8787:8787 --platform linux/amd64 --user root --name flair-rstudio ghcr.io/davidycliao/flair-rstudio:latest
After running these commands in terminal (or powershell), open your
browser and navigate to http://localhost:8787
to access RStudio. For detailed installation instructions, please visit
Quick Start
Guide.
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.