Highlight Entities with Colors
David (Yen-Chieh) Liao
Postdoc at Text and Policy Research Group and SPIRe in UCDSource:
vignettes/highlight_text.Rmd
highlight_text.Rmd
Create Text with Named Entities
library(flaiR)
data("uk_immigration")
uk_immigration <- uk_immigration[30,]
tagger_ner <- load_tagger_ner("ner")
#> 2024-09-23 11:44:46,639 SequenceTagger predicts: Dictionary with 20 tags: <unk>, O, S-ORG, S-MISC, B-PER, E-PER, S-LOC, B-ORG, E-ORG, I-PER, S-PER, B-MISC, I-MISC, E-MISC, I-ORG, B-LOC, E-LOC, I-LOC, <START>, <STOP>
result <- get_entities(uk_immigration$text,
tagger = tagger_ner,
show.text_id = FALSE
)
#> Warning in check_texts_and_ids(texts, doc_ids): doc_ids is NULL.
#> Auto-assigning doc_ids.
Highlight Text with Entities
highlighted_text <- highlight_text(text = uk_immigration$text,
entities_mapping = map_entities(result))
highlighted_text
I am grateful to the Minister for that most helpful intervention. Perhaps I should bring us back on track. Although asylum is an important issue for all hon. Members and our constituents, the number of asylum claims is small compared with immigration as a whole. I believe that asylum claims are now running at a rate of about 30,000 a year, which is only 10 per cent. of net foreign migration. The big problem in this country is legal immigration, which brings us back to the population projections of 70 million. I understand that a migrant now arrives on our shores every minute. We must build a new home every six minutes for new migrants. Immigration will add 7 million to the population of England (LOC) in the next 15 to 20 years, which is seven times the population of Birmingham (LOC). Immigration directly added a million people to the UK (LOC)'s population in the years 2003 to 2007. There was a net inflow of 2.3 million people to the UK (LOC) between 1991 and 2006, and 8 per cent. came from the new east European (MISC) members of the EU (ORG). I differ from my party in not agreeing with the free movement of people across EU (ORG) borders. Effectively, we have, by agreement of our Government, uncontrolled immigration within the EU (ORG). The Government told us that there would be 13,000 new arrivals from the new entrant eastern European (MISC) EU (ORG) countries, but the figure was approaching 1 million at its peak-perhaps the Minister will confirm what the figure was-which was a world apart from the 13,000 that we were told about, and it has placed huge strain on local infrastructure.