Here is one possible solution.
library(tidyverse)
#> Warning: package 'tibble' was built under R version 4.1.2
DF <- data.frame(Text=c("Monitors are bright", "Monitor bright",
"The sky is very blue", "The sky is blue",
"other text"))
DF <- DF |> mutate(Text=case_when(
str_detect(Text, "Monitor") & str_detect(Text, "bright") ~ "1",
str_detect(Text, "sky") & str_detect(Text, "blue") ~ "2",
TRUE ~ Text
))
DF
#> Text
#> 1 1
#> 2 1
#> 3 2
#> 4 2
#> 5 other text
Created on 2022-07-14 by the reprex package (v2.0.1)