Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

`nlp.add_pipe` now takes the string name of the registered component factory

import spacy
import re
from spacy.language import Language

nlp = spacy.load('en_core_web_sm')
boundary = re.compile('^[0-9]$')

@Language.component("component")
def custom_seg(doc):
    prev = doc[0].text
    length = len(doc)
    for index, token in enumerate(doc):
        if (token.text == '.' and boundary.match(prev) and index!=(length - 1)):
            doc[index+1].sent_start = False
        prev = token.text
    return doc
    
nlp.add_pipe("component", before='parser')
Comment

PREVIOUS NEXT
Code Example
Python :: sf.query_all( ) dataFrame records relation Id 
Python :: matplotlib share colorbar 
Python :: def LinearSearch(array, n, k): 
Python :: table is not creating in django 
Python :: Use of Pass 
Python :: print all elements of dictionary except one in python 
Python :: 2d vector in python 
Python :: subtract 2 datetime objects django 
Python :: libraries used in ANN with Keras Sequential Model 
Python :: how to replace zero with null in python 
Python :: configparser error reading relative file path 
Python :: f2 polar or nonpolar 
Python :: convert month weeks days into month days in python pandas 
Python :: pylint no name in module opencv 
Python :: get the mean of all not nan values 
Python :: como fazer print no python 
Python :: django filter word count greater than 
Python :: numpy bitwise_or multiple images 
Python :: vehari weather 
Python :: legend matplotlib twinx 
Python :: copy any files from one folder to another folder in python 
Python :: atan of number python 
Python :: copy element dynamo revit 
Python :: get element tag name beautfulsoup 
Python :: python get last cell value 
Python :: check if timestamp is NaT 
Python :: how to insert ele in python 
Python :: get the least value from a list of dictionaries 
Python :: how to solve differential equations in python 
Python :: python deconstruct tuple 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =