Skip to content

shinde-rahul/displacyr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

displacyr

A micro-package for R that visualizes, in the terminal, entities in text parsed with spacyr.

Styled terminal output uses the crayon package.

Installation

devtools::install_github("weihuangwong/displacyr")

Usage

spacyr and crayon must be installed and working. Given a character string txt,

library(displacyr)
library(spacyr)
spacy_initialize()

txt <- "Kenneth Benoit is currently Professor of Computational Social
Science in the Department of Methodology at the London School of
Economics and Political Science. He has previously held positions in
the Department of Political Science at Trinity College Dublin and at
the Central European University (Budapest)."
txt <- gsub("\n", " ", txt)

spacy_parse it with additional_attributes = "whitespace_"

parsed <- spacy_parse(txt, additional_attributes = "whitespace_")

and then call display_ent on the parsed object

display_ent(parsed, deco = "yellow")

About

A micro-package for R that visualizes, in the terminal, entities in text parsed with Spacy.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%