| Long texts can become difficult to read when displayed in one row, so
| it's often better to visualize them sentence-by-sentence instead. As of
| v2.0.12, #[code displacy] supports rendering both
| #[+api("doc") #[code Doc]] and #[+api("span") #[code Span]] objects, as
| well as lists of #[code Doc]s or #[code Span]s. Instead of passing the
| full #[code Doc] to #[code displacy.serve], you can also pass in a list
| of the #[code doc.sents]. This will create one visualization for each
| sentence.
+code.
import spacy
from spacy import displacy
nlp = spacy.load('en')
text = u"""In ancient Rome, some neighbors live in three adjacent houses. In the center is the house of Senex, who lives there with wife Domina, son Hero, and several slaves, including head slave Hysterium and the musical's main character Pseudolus. A slave belonging to Hero, Pseudolus wishes to buy, win, or steal his freedom. One of the neighboring houses is owned by Marcus Lycus, who is a buyer and seller of beautiful women; the other belongs to the ancient Erronius, who is abroad searching for his long-lost children (stolen in infancy by pirates). One day, Senex and Domina go on a trip and leave Pseudolus in charge of Hero. Hero confides in Pseudolus that he is in love with the lovely Philia, one of the courtesans in the House of Lycus (albeit still a virgin)."""