library(TextAnalysisR)
packageVersion("TextAnalysisR")## [1] '0.1.4'
mydata <- SpecialEduTech[seq_len(20), c("title", "abstract")]
united <- unite_cols(mydata, listed_vars = c("title", "abstract"))
toks <- prep_texts(united, text_field = "united_texts")
dfm <- quanteda::dfm(toks)
extract_keywords_tfidf(dfm, top_n = 10)## Keyword TF_IDF_Score Frequency
## 1 was 15.258649 44
## 2 practice 10.837080 18
## 3 groups 10.484550 15
## 4 educable 10.000000 10
## 5 were 9.948500 25
## 6 drill 9.785580 14
## 7 achievement 9.550560 24
## 8 mentally 9.062996 11
## 9 experimental 9.030900 15
## 10 assisted 9.016475 26
TextAnalysisR provides AI features via cloud-based providers.
On the hosted web app, Gemini usage is free, supported by the Google Cloud Research program. OpenAI calls require a personal API key.
Providers
| Provider | Type | API Key | Best For |
|---|---|---|---|
| OpenAI | Web-based | OPENAI_API_KEY | Quality, speed |
| Gemini | Web-based | None on hosted app; otherwise GEMINI_API_KEY | Quality, speed |
| spaCy | Local | None | Linguistic analysis |
| Transformers | Local | None | Embeddings, sentiment |
Setup
Set keys via .Renviron (persistent) or
Sys.setenv() (session). The cloud chat, embedding, and RAG
functions (call_llm_api(), call_openai_chat(),
call_gemini_chat(), get_api_embeddings(),
run_rag_search()) require an API key and network access;
see their reference pages for usage.
Default Models
| Provider | Chat Model | Embedding Model |
|---|---|---|
| OpenAI | gpt-4.1-mini | text-embedding-3-small |
| Gemini | gemini-2.5-flash | gemini-embedding-001 |
| Local | - | all-MiniLM-L6-v2 |
Responsible AI Design
All AI features follow NIST AI Risk Management Framework principles:
| Principle | Implementation |
|---|---|
| Human oversight | AI suggests; review and approve |
| User control | Edit, regenerate, or override any output |
| Transparency | View prompts and parameters used |
| Privacy | Local sentence-transformers and spaCy options for sensitive data |
| Grounding | Content based on input data, not generic knowledge |
