#Coding=utf-8ImportSPACYNLP=spacy.load ('en_core_web_md-1.2.1') docx=NLP (U'The ways to process documents is so varied and application-and language-dependent that I decided to not constrain th EM by any interface. Instead, a document is represented by the features extracted from it, not by its ' surface ' string form:how you get to the Features is up to you. Below I describe one common, general-purpose approach (called bag-of-words), but keep in mind that different application D Omains call for different features, and, as always, it's garbage in, garbage out ...')" "Functional Testing" "#1. Participle tokenizePrint '################ #tokenization' forTokeninchdocx:Printtoken#2. Pos tagging taggingPrint '################ #part of speech tagging' forTokeninchdocx:Print(token, token.pos_, Token.pos)#3. Named entity recognition Named entity recognitionPrint '################# Named Entity recognition' forEntinchdocx.ents:Print(Ent,ent.label_,ent.label)#4. Stemmers lemmatizePrint '################ #Lemmatize' forTokeninchdocx:Print(Token,token.lemma_,token.lemma)#5. Noun phrase extraction Noun Phrase ExtractionPrint '################ #Noun Phrase Extraction' forNpinchdocx.noun_chunks:PrintNP#6. Segmentation sentence SegmentationPrint '################ #Sentence Segmentation' forSentinchdocx.sents:PrintSent
The basic processing task of natural language is recorded as an example of function call in Spacy