B An]a@s6ddlmZddlmZddZddZd d d Zd S) )unicode_literals)Matcherc CsR|js |S|6}x.|jD]$}|jj|jjd}|j||dqWWdQRX|S)zMerge noun chunks into a single token. doc (Doc): The Doc object. RETURNS (Doc): The Doc object with merged noun chunks. DOCS: https://spacy.io/api/pipeline-functions#merge_noun_chunks )tagdep)attrsN) is_parsed retokenize noun_chunksrootrrmerge)doc retokenizernprr{/home/app_decipher_dev_19-4/dev/decipher-analysis/serverless-application/helper/df_spacy/python/spacy/pipeline/functions.pymerge_noun_chunkss  rc CsL|:}x2|jD](}|jj|jj|jd}|j||dqWWdQRX|S)zMerge entities into a single token. doc (Doc): The Doc object. RETURNS (Doc): The Doc object with merged entities. DOCS: https://spacy.io/api/pipeline-functions#merge_entities )rrent_type)rN)r entsr rrlabelr )r rentrrrrmerge_entitiess   rsubtokc sjtj}|dd|ddg|}fdd|D}}x|D]}||qJWWdQRXS)zMerge subtokens into a single token. doc (Doc): The Doc object. label (unicode): The subtoken dependency label. RETURNS (Doc): The Doc object with merged subtokens. DOCS: https://spacy.io/api/pipeline-functions#merge_subtokens SUBTOKN+)DEPopcs"g|]\}}}||dqS)r).0_startend)r rr 3sz#merge_subtokens..)rvocabaddr r )r rmergermatchesspansrspanr)r rmerge_subtokens's   r)N)r) __future__rmatcherrrrr)rrrrs