<jupyter_start><jupyter_text><jupyter_code>!pip install -U spacy
import en_core_web_sm as model
from spacy.lang.en import English
import spacy
nlp= model.load()
text="""For years, the foundations of cancer treatment were surgery, chemotherapy, and radiation therapy. Over the last two decades, targeted therapies like imatinib (Gleevec®)  and trastuzumab (Herceptin®) —drugs that target cancer cells by homing in on specific molecular changes seen primarily in those cells—have also cemented themselves as standard treatments for many cancers.

But over the past several years, immunotherapy—therapies that enlist and strengthen the power of a patient's immune system to attack tumors—has emerged as what many in the cancer community now call the "fifth pillar" of cancer treatment.

ON THIS PAGE
A Tipping Point in Clinical Development
A "Living Drug"
A Possible Option Where None Had Existed
Understanding, Managing Side Effects
New Target Antigens for CAR T Cells
Expanding CAR T Cells to Solid Tumors?
Evolution of CAR T-Cell Therapies
A Tipping Point in Clinical Development
A rapidly emerging immunotherapy approach is called adoptive cell transfer (ACT): collecting and using patients' own immune cells to treat their cancer. There are several types of ACT (see the box below, titled "ACT: TILs, TCRs, and CARs"), but, thus far, the one that has advanced the furthest in clinical development is called CAR T-cell therapy.

Until recently, the use of CAR T-cell therapy has been restricted to small clinical trials, largely in patients with advanced blood cancers. But these treatments have nevertheless captured the attention of researchers and the public alike because of the remarkable responses they have produced in some patients—both children and adults—for whom all other treatments had stopped working."""

doc= nlp(text)
[(token.text,token.pos_,token.dep_,token.head.text) for token in doc]
[(ent.text,ent.label_,spacy.explain(ent.label_)) for ent in doc.ents]
from spacy.matcher import Matcher
matcher= Matcher(nlp.vocab)
pattern=[{'TEXT':'CAR','POS':'NOUN'},{'TEXT':'T','OP':'?'}]
matcher.add("CART-matcher",None,pattern)
matches=matcher(doc)
for _,start,end in matches:
  print(doc[start:end].text)
hash_id= nlp.vocab.strings["Coffee"]
#string_from_hash= nlp.vocab.strings[hash_id]
hash_id
lexeme= nlp.vocab["$"] # doc looks for the tokens in the lexemes, lexemes for hash tables
lexeme.is_currency<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07481602616516762, 'fraction_numerical': 0.0, 'mean_word_length': 5.892957746478873, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '129948', 'license': 'Apache-2.0', 'n_tokens_mistral': 708, 'n_tokens_neox': 666, 'n_words': 312, 'path': 'Text/spacy_tutorial.ipynb', 'repo_name': 'SPThole/pyTrch', 'size': '2446'}